commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r744923 - in /commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress: AbstractTestCase.java DetectArchiverTestCase.java archivers/ZipTestCase.java changes/ChangeSetTestCase.java
Date Mon, 16 Feb 2009 14:21:15 GMT
Author: bodewig
Date: Mon Feb 16 14:21:12 2009
New Revision: 744923

URL: http://svn.apache.org/viewvc?rev=744923&view=rev
Log:
fix whitespace

Modified:
    commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
    commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
    commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
    commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java

Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java?rev=744923&r1=744922&r2=744923&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java (original)
+++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java Mon Feb 16 14:21:12 2009
@@ -40,145 +40,145 @@
 
 public abstract class AbstractTestCase extends TestCase {
 
-	protected File dir;
-	
-	protected void setUp() throws Exception {
-		dir = File.createTempFile("dir", "");
-		dir.delete();
-		dir.mkdir();
-
-		addURL(new File("src/test/resources").toURL());
-	}
-
-	protected File getFile( String path ) {
-		return new File(getClass().getClassLoader().getResource(path).getFile());		
-	}
-	
-	protected void tearDown() throws Exception {
-		dir.delete();
-		dir = null;
-	}
-
-	/**
-	 * Adds a URL to the classpath. This method is necessary when running 
-	 * junit tests from within eclipse.
-	 * @param url the url to add
-	 * @throws Exception if an error occurs
-	 */
-	public void addURL(URL url) throws Exception {
-		URLClassLoader classLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
-		Class clazz = URLClassLoader.class;
-
-		Method method= clazz.getDeclaredMethod("addURL", new Class[] { URL.class });
-		method.setAccessible(true);
-		method.invoke(classLoader, new Object[] { url });
-	}
-
-	/**
-	 * Creates an archive of 5 textbased files in several directories.
-	 * The archivername is the factory identifier for the archiver, for example
-	 * zip, tar, cpio, jar, ar.
-	 * The archive is created as a temp file.
-	 * 
-	 * The archive contains the following files:
-	 * <ul>
-	 * <li>testdata/test1.xml</li>
-	 * <li>testdata/test2.xml</li>
-	 * <li>test/test3.xml</li>
-	 * <li>bla/test4.xml</li>
-	 * <li>test.txt</li>
-	 * <li>something/bla</li>
-	 * <li>test with spaces.txt</li>
-	 * </ul>
-	 * 
-	 * @param archivename the identifier of this archive
-	 * @return the newly created file
-	 * @throws Exception in case something goes wrong
-	 */
-	protected File createArchive(String archivename) throws Exception {
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		try {
-			File temp = File.createTempFile("test", "." + archivename);
-			
-			final OutputStream stream = new FileOutputStream(temp);
-			out = new ArchiveStreamFactory().createArchiveOutputStream(archivename, stream);
-			
-			final File file1 = getFile("test1.xml");
-			final File file2 = getFile("test2.xml");
-			final File file3 = getFile("test3.xml");
-			final File file4 = getFile("test4.xml");
-			final File file5 = getFile("test.txt");
-			final File file6 = getFile("test with spaces.txt");
-			
-			ZipArchiveEntry entry = new ZipArchiveEntry("testdata/test1.xml");
-			entry.setSize(file1.length());
-	        out.putArchiveEntry(entry);
-	        IOUtils.copy(new FileInputStream(file1), out);
-	        out.closeArchiveEntry();
-	        
-	        out.putArchiveEntry(new ZipArchiveEntry("testdata/test2.xml"));
-	        IOUtils.copy(new FileInputStream(file2), out);
-	        out.closeArchiveEntry();
-
-	        out.putArchiveEntry(new ZipArchiveEntry("test/test3.xml"));
-	        IOUtils.copy(new FileInputStream(file3), out);
-	        out.closeArchiveEntry();
-	        
-	        out.putArchiveEntry(new ZipArchiveEntry("bla/test4.xml"));
-	        IOUtils.copy(new FileInputStream(file4), out);
-	        out.closeArchiveEntry();
-	        
-	        out.putArchiveEntry(new ZipArchiveEntry("test.txt"));
-	        IOUtils.copy(new FileInputStream(file5), out);
-	        out.closeArchiveEntry();
-	        
-	        out.putArchiveEntry(new ZipArchiveEntry("something/bla"));
-	        IOUtils.copy(new FileInputStream(file6), out);
-	        out.closeArchiveEntry();
-	        
-	        out.putArchiveEntry(new ZipArchiveEntry("test with spaces.txt"));
-	        IOUtils.copy(new FileInputStream(file6), out);
-	        out.closeArchiveEntry();
-	        
-	     	return temp;
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-	}
-	
-	/**
-	 * Checks if an archive contains all expected files.
-	 * 
-	 * @param archive 
-	 * 				the archive to check
-	 * @param expected 
-	 * 				a list with expected string filenames
-	 * @throws Exception
-	 */
-	protected void checkArchiveContent(File archive, List expected) 
-	 	throws Exception {
-	    final InputStream is = new FileInputStream(archive);
-	    final BufferedInputStream buf = new BufferedInputStream(is);
-	    final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream(buf);
-	 
-	    File result = File.createTempFile("dir-result", "");
-	    result.delete();
-	    result.mkdir();
-			
-	    ArchiveEntry entry = null;
-	    while((entry = (ArchiveEntry)in.getNextEntry()) != null) {
-	      	File outfile = new File(result.getCanonicalPath() + "/result/" + entry.getName());
-	       	outfile.getParentFile().mkdirs();
-	       	OutputStream out = new FileOutputStream(outfile);
-		    if(!expected.remove(entry.getName())) {
-		       	fail("unexpected entry: " + entry.getName());
-		    } 
-		    IOUtils.copy(in, out);
-		    out.close();
-	    }
-	    in.close();
-	    assertEquals(expected.size(), 0);
-	}
+    protected File dir;
+
+    protected void setUp() throws Exception {
+        dir = File.createTempFile("dir", "");
+        dir.delete();
+        dir.mkdir();
+
+        addURL(new File("src/test/resources").toURL());
+    }
+
+    protected File getFile( String path ) {
+        return new File(getClass().getClassLoader().getResource(path).getFile());
+    }
+
+    protected void tearDown() throws Exception {
+        dir.delete();
+        dir = null;
+    }
+
+    /**
+     * Adds a URL to the classpath. This method is necessary when running 
+     * junit tests from within eclipse.
+     * @param url the url to add
+     * @throws Exception if an error occurs
+     */
+    public void addURL(URL url) throws Exception {
+        URLClassLoader classLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
+        Class clazz = URLClassLoader.class;
+
+        Method method= clazz.getDeclaredMethod("addURL", new Class[] { URL.class });
+        method.setAccessible(true);
+        method.invoke(classLoader, new Object[] { url });
+    }
+
+    /**
+     * Creates an archive of 5 textbased files in several directories.
+     * The archivername is the factory identifier for the archiver, for example
+     * zip, tar, cpio, jar, ar.
+     * The archive is created as a temp file.
+     * 
+     * The archive contains the following files:
+     * <ul>
+     * <li>testdata/test1.xml</li>
+     * <li>testdata/test2.xml</li>
+     * <li>test/test3.xml</li>
+     * <li>bla/test4.xml</li>
+     * <li>test.txt</li>
+     * <li>something/bla</li>
+     * <li>test with spaces.txt</li>
+     * </ul>
+     * 
+     * @param archivename the identifier of this archive
+     * @return the newly created file
+     * @throws Exception in case something goes wrong
+     */
+    protected File createArchive(String archivename) throws Exception {
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        try {
+            File temp = File.createTempFile("test", "." + archivename);
+
+            final OutputStream stream = new FileOutputStream(temp);
+            out = new ArchiveStreamFactory().createArchiveOutputStream(archivename, stream);
+
+            final File file1 = getFile("test1.xml");
+            final File file2 = getFile("test2.xml");
+            final File file3 = getFile("test3.xml");
+            final File file4 = getFile("test4.xml");
+            final File file5 = getFile("test.txt");
+            final File file6 = getFile("test with spaces.txt");
+
+            ZipArchiveEntry entry = new ZipArchiveEntry("testdata/test1.xml");
+            entry.setSize(file1.length());
+            out.putArchiveEntry(entry);
+            IOUtils.copy(new FileInputStream(file1), out);
+            out.closeArchiveEntry();
+
+            out.putArchiveEntry(new ZipArchiveEntry("testdata/test2.xml"));
+            IOUtils.copy(new FileInputStream(file2), out);
+            out.closeArchiveEntry();
+
+            out.putArchiveEntry(new ZipArchiveEntry("test/test3.xml"));
+            IOUtils.copy(new FileInputStream(file3), out);
+            out.closeArchiveEntry();
+
+            out.putArchiveEntry(new ZipArchiveEntry("bla/test4.xml"));
+            IOUtils.copy(new FileInputStream(file4), out);
+            out.closeArchiveEntry();
+
+            out.putArchiveEntry(new ZipArchiveEntry("test.txt"));
+            IOUtils.copy(new FileInputStream(file5), out);
+            out.closeArchiveEntry();
+
+            out.putArchiveEntry(new ZipArchiveEntry("something/bla"));
+            IOUtils.copy(new FileInputStream(file6), out);
+            out.closeArchiveEntry();
+
+            out.putArchiveEntry(new ZipArchiveEntry("test with spaces.txt"));
+            IOUtils.copy(new FileInputStream(file6), out);
+            out.closeArchiveEntry();
+
+            return temp;
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+    }
+
+    /**
+     * Checks if an archive contains all expected files.
+     * 
+     * @param archive 
+     *                              the archive to check
+     * @param expected 
+     *                              a list with expected string filenames
+     * @throws Exception
+     */
+    protected void checkArchiveContent(File archive, List expected) 
+        throws Exception {
+        final InputStream is = new FileInputStream(archive);
+        final BufferedInputStream buf = new BufferedInputStream(is);
+        final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream(buf);
+
+        File result = File.createTempFile("dir-result", "");
+        result.delete();
+        result.mkdir();
+
+        ArchiveEntry entry = null;
+        while((entry = (ArchiveEntry)in.getNextEntry()) != null) {
+            File outfile = new File(result.getCanonicalPath() + "/result/" + entry.getName());
+            outfile.getParentFile().mkdirs();
+            OutputStream out = new FileOutputStream(outfile);
+            if(!expected.remove(entry.getName())) {
+                fail("unexpected entry: " + entry.getName());
+            } 
+            IOUtils.copy(in, out);
+            out.close();
+        }
+        in.close();
+        assertEquals(expected.size(), 0);
+    }
 }

Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java?rev=744923&r1=744922&r2=744923&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java (original)
+++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/DetectArchiverTestCase.java Mon Feb 16 14:21:12 2009
@@ -33,44 +33,44 @@
 import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
 
 public final class DetectArchiverTestCase extends AbstractTestCase {
-	public void testDetection() throws Exception {
-		final ArchiveStreamFactory factory = new ArchiveStreamFactory();
+    public void testDetection() throws Exception {
+        final ArchiveStreamFactory factory = new ArchiveStreamFactory();
 
-		final ArchiveInputStream ar = factory.createArchiveInputStream(
-				new BufferedInputStream(new FileInputStream(
-						new File(getClass().getClassLoader().getResource("bla.ar").getFile())))); 
-		assertNotNull(ar);
-		assertTrue(ar instanceof ArArchiveInputStream);
-
-		final ArchiveInputStream tar = factory.createArchiveInputStream(
-				new BufferedInputStream(new FileInputStream(
-						new File(getClass().getClassLoader().getResource("bla.tar").getFile()))));
-		assertNotNull(tar);
-		assertTrue(tar instanceof TarArchiveInputStream);
-
-		final ArchiveInputStream zip = factory.createArchiveInputStream(
-				new BufferedInputStream(new FileInputStream(
-						new File(getClass().getClassLoader().getResource("bla.zip").getFile()))));
-		assertNotNull(zip);
-		assertTrue(zip instanceof ZipArchiveInputStream);
-
-		final ArchiveInputStream jar = factory.createArchiveInputStream(
-				new BufferedInputStream(new FileInputStream(
-						new File(getClass().getClassLoader().getResource("bla.jar").getFile()))));
-		assertNotNull(jar);
-		assertTrue(jar instanceof JarArchiveInputStream);
-
-		final ArchiveInputStream cpio = factory.createArchiveInputStream(
-				new BufferedInputStream(new FileInputStream(
-						new File(getClass().getClassLoader().getResource("bla.cpio").getFile()))));
-		assertNotNull(cpio);
-		assertTrue(cpio instanceof CpioArchiveInputStream);
-
-//		final ArchiveInputStream tgz = factory.createArchiveInputStream(
-//				new BufferedInputStream(new FileInputStream(
-//						new File(getClass().getClassLoader().getResource("bla.tgz").getFile()))));
-//		assertTrue(tgz instanceof TarArchiveInputStream);
-		
-	}
+        final ArchiveInputStream ar = factory.createArchiveInputStream(
+                                                                       new BufferedInputStream(new FileInputStream(
+                                                                                                                   new File(getClass().getClassLoader().getResource("bla.ar").getFile())))); 
+        assertNotNull(ar);
+        assertTrue(ar instanceof ArArchiveInputStream);
+
+        final ArchiveInputStream tar = factory.createArchiveInputStream(
+                                                                        new BufferedInputStream(new FileInputStream(
+                                                                                                                    new File(getClass().getClassLoader().getResource("bla.tar").getFile()))));
+        assertNotNull(tar);
+        assertTrue(tar instanceof TarArchiveInputStream);
+
+        final ArchiveInputStream zip = factory.createArchiveInputStream(
+                                                                        new BufferedInputStream(new FileInputStream(
+                                                                                                                    new File(getClass().getClassLoader().getResource("bla.zip").getFile()))));
+        assertNotNull(zip);
+        assertTrue(zip instanceof ZipArchiveInputStream);
+
+        final ArchiveInputStream jar = factory.createArchiveInputStream(
+                                                                        new BufferedInputStream(new FileInputStream(
+                                                                                                                    new File(getClass().getClassLoader().getResource("bla.jar").getFile()))));
+        assertNotNull(jar);
+        assertTrue(jar instanceof JarArchiveInputStream);
+
+        final ArchiveInputStream cpio = factory.createArchiveInputStream(
+                                                                         new BufferedInputStream(new FileInputStream(
+                                                                                                                     new File(getClass().getClassLoader().getResource("bla.cpio").getFile()))));
+        assertNotNull(cpio);
+        assertTrue(cpio instanceof CpioArchiveInputStream);
+
+        //              final ArchiveInputStream tgz = factory.createArchiveInputStream(
+        //                              new BufferedInputStream(new FileInputStream(
+        //                                              new File(getClass().getClassLoader().getResource("bla.tgz").getFile()))));
+        //              assertTrue(tgz instanceof TarArchiveInputStream);
+
+    }
 
 }

Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java?rev=744923&r1=744922&r2=744923&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java (original)
+++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ZipTestCase.java Mon Feb 16 14:21:12 2009
@@ -31,67 +31,67 @@
 import org.apache.commons.compress.utils.IOUtils;
 
 public final class ZipTestCase extends AbstractTestCase {
-	/**
-	 * Archives 2 files and unarchives it again. If the file length of result
-	 * and source is the same, it looks like the operations have worked
-	 * @throws Exception
-	 */
-	public void testZipArchiveCreation() throws Exception {
-		// Archive
-		final File output = new File(dir, "bla.zip");
-		final File file1 = getFile("test1.xml");
-		final File file2 = getFile("test2.xml");
-
-		{
-			final OutputStream out = new FileOutputStream(output);
-	        final ArchiveOutputStream os = new ArchiveStreamFactory().createArchiveOutputStream("zip", out);
-	
-	        os.putArchiveEntry(new ZipArchiveEntry("testdata/test1.xml"));
-	        IOUtils.copy(new FileInputStream(file1), os);
-	        os.closeArchiveEntry();
-	        
-	        os.putArchiveEntry(new ZipArchiveEntry("testdata/test2.xml"));
-	        IOUtils.copy(new FileInputStream(file2), os);
-	        os.closeArchiveEntry();
-	        os.close();
-		}
-		
-		// Unarchive the same
-		List results = new ArrayList();
-		
+    /**
+     * Archives 2 files and unarchives it again. If the file length of result
+     * and source is the same, it looks like the operations have worked
+     * @throws Exception
+     */
+    public void testZipArchiveCreation() throws Exception {
+        // Archive
+        final File output = new File(dir, "bla.zip");
+        final File file1 = getFile("test1.xml");
+        final File file2 = getFile("test2.xml");
+
+        {
+            final OutputStream out = new FileOutputStream(output);
+            final ArchiveOutputStream os = new ArchiveStreamFactory().createArchiveOutputStream("zip", out);
+
+            os.putArchiveEntry(new ZipArchiveEntry("testdata/test1.xml"));
+            IOUtils.copy(new FileInputStream(file1), os);
+            os.closeArchiveEntry();
+
+            os.putArchiveEntry(new ZipArchiveEntry("testdata/test2.xml"));
+            IOUtils.copy(new FileInputStream(file2), os);
+            os.closeArchiveEntry();
+            os.close();
+        }
+
+        // Unarchive the same
+        List results = new ArrayList();
+
         {
-	        final InputStream is = new FileInputStream(output);
-	        final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
-	 
-	        File result = File.createTempFile("dir-result", "");
-	        result.delete();
-	        result.mkdir();
-			
-	        ZipArchiveEntry entry = null;
-	        while((entry = (ZipArchiveEntry)in.getNextEntry()) != null) {
-	        	File outfile = new File(result.getCanonicalPath() + "/result/" + entry.getName());
-	        	outfile.getParentFile().mkdirs();
-	        	OutputStream out = new FileOutputStream(outfile);
-		        IOUtils.copy(in, out);
-		        out.close();
-		        results.add(outfile);
-	        }
-	        in.close();
+            final InputStream is = new FileInputStream(output);
+            final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
+
+            File result = File.createTempFile("dir-result", "");
+            result.delete();
+            result.mkdir();
+
+            ZipArchiveEntry entry = null;
+            while((entry = (ZipArchiveEntry)in.getNextEntry()) != null) {
+                File outfile = new File(result.getCanonicalPath() + "/result/" + entry.getName());
+                outfile.getParentFile().mkdirs();
+                OutputStream out = new FileOutputStream(outfile);
+                IOUtils.copy(in, out);
+                out.close();
+                results.add(outfile);
+            }
+            in.close();
         }
-        
+
         assertEquals(results.size(), 2);
         File result = (File)results.get(0);
         assertEquals(file1.length(), result.length());
         result = (File)results.get(1);
         assertEquals(file2.length(), result.length());
     }
-	
+
     /**
      * Simple unarchive test. Asserts nothing.
      * @throws Exception
      */
     public void testZipUnarchive() throws Exception {
-		final File input = getFile("bla.zip");
+        final File input = getFile("bla.zip");
         final InputStream is = new FileInputStream(input);
         final ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
         final ZipArchiveEntry entry = (ZipArchiveEntry)in.getNextEntry();

Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java?rev=744923&r1=744922&r2=744923&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java (original)
+++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/changes/ChangeSetTestCase.java Mon Feb 16 14:21:12 2009
@@ -39,451 +39,451 @@
  * Checks several ChangeSet business logics.
  */
 public final class ChangeSetTestCase extends AbstractTestCase {
-	/**
-	 * Tries to delete the folder "bla" from a zip file.
-	 * This should result in the deletion of bla/*, which 
-	 * actually means bla/test4.xml should be removed from this zipfile.
-	 * The file something/bla (without ending, named like the folder) should
-	 * not be deleted.
-	 * 
-	 * @throws Exception
-	 */
-	public void XtestDeleteDir() throws Exception {
-		File input = this.createArchive("zip");
-		
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		File result = File.createTempFile("test", ".zip");
-		try {
-			
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
-			
-			out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
-
-			ChangeSet changes = new ChangeSet();
-			changes.delete("bla");
-			changes.perform(ais, out);
-			
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		
-		List expected = new ArrayList();
-		expected.add("testdata/test1.xml");
-		expected.add("testdata/test2.xml");
-		expected.add("test/test3.xml");
-		expected.add("test.txt");
-		expected.add("something/bla");
-		expected.add("test with spaces.txt");
-		
-		this.checkArchiveContent(result, expected);
-	}
-	
-	/**
-	 * Tries to delete a directory with a file and adds 
-	 * a new directory with a new file and with the same name.
+    /**
+     * Tries to delete the folder "bla" from a zip file.
+     * This should result in the deletion of bla/*, which 
+     * actually means bla/test4.xml should be removed from this zipfile.
+     * The file something/bla (without ending, named like the folder) should
+     * not be deleted.
+     * 
+     * @throws Exception
+     */
+    public void XtestDeleteDir() throws Exception {
+        File input = this.createArchive("zip");
+
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        File result = File.createTempFile("test", ".zip");
+        try {
+
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
+
+            out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
+
+            ChangeSet changes = new ChangeSet();
+            changes.delete("bla");
+            changes.perform(ais, out);
+
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+
+        List expected = new ArrayList();
+        expected.add("testdata/test1.xml");
+        expected.add("testdata/test2.xml");
+        expected.add("test/test3.xml");
+        expected.add("test.txt");
+        expected.add("something/bla");
+        expected.add("test with spaces.txt");
+
+        this.checkArchiveContent(result, expected);
+    }
+
+    /**
+     * Tries to delete a directory with a file and adds 
+     * a new directory with a new file and with the same name.
      * Should delete dir1/* and add dir1/test.txt at the end
      * 
-	 * @throws Exception
-	 */
-	public void XtestDeletePlusAdd() throws Exception {
-		File input = this.createArchive("zip");
-		
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		File result = File.createTempFile("test", ".zip");
-		try {
-			
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
-			out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
-
-			ChangeSet changes = new ChangeSet();
-			changes.delete("bla");
-			
-			// Add a file
-			final File file1 = getFile("test.txt");
-			ArchiveEntry entry = new ZipArchiveEntry("bla/test.txt");
-			changes.add(entry, new FileInputStream(file1));
-
-			changes.perform(ais, out);
-			
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		
-		List expected = new ArrayList();
-		expected.add("testdata/test1.xml");
-		expected.add("testdata/test2.xml");
-		expected.add("test/test3.xml");
-		expected.add("test.txt");
-		expected.add("something/bla");
-		expected.add("bla/test.txt");
-		expected.add("test with spaces.txt");
-		
-		this.checkArchiveContent(result, expected);
-	}
-	
-	/**
-	 * Adds a file to a zip archive. Deletes an other file.
-	 * @throws Exception
-	 */
-	public void testDeleteFromAndAddToZip() throws Exception {
-		File input = this.createArchive("zip");
-		
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		File result = File.createTempFile("test", ".zip");
-		try {
-			
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
-			out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
-
-			ChangeSet changes = new ChangeSet();
-			
-			final File file1 = getFile("test.txt");
-			ArchiveEntry entry = new ZipArchiveEntry("blub/test.txt");
-			changes.add(entry, new FileInputStream(file1));
-			
-			changes.delete("testdata/test1.xml");
-			
-			changes.perform(ais, out);
-			
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		
-		List expected = new ArrayList();
-		expected.add("testdata/test2.xml");
-		expected.add("test/test3.xml");
-		expected.add("blub/test.txt");
-		expected.add("test.txt");
-		expected.add("something/bla");
-		expected.add("bla/test4.xml");
-		expected.add("test with spaces.txt");
-		
-		this.checkArchiveContent(result, expected);
-	}
-	
-	/**
-	 * add blub/test.txt + delete blub
+     * @throws Exception
+     */
+    public void XtestDeletePlusAdd() throws Exception {
+        File input = this.createArchive("zip");
+
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        File result = File.createTempFile("test", ".zip");
+        try {
+
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
+            out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
+
+            ChangeSet changes = new ChangeSet();
+            changes.delete("bla");
+
+            // Add a file
+            final File file1 = getFile("test.txt");
+            ArchiveEntry entry = new ZipArchiveEntry("bla/test.txt");
+            changes.add(entry, new FileInputStream(file1));
+
+            changes.perform(ais, out);
+
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+
+        List expected = new ArrayList();
+        expected.add("testdata/test1.xml");
+        expected.add("testdata/test2.xml");
+        expected.add("test/test3.xml");
+        expected.add("test.txt");
+        expected.add("something/bla");
+        expected.add("bla/test.txt");
+        expected.add("test with spaces.txt");
+
+        this.checkArchiveContent(result, expected);
+    }
+
+    /**
+     * Adds a file to a zip archive. Deletes an other file.
+     * @throws Exception
+     */
+    public void testDeleteFromAndAddToZip() throws Exception {
+        File input = this.createArchive("zip");
+
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        File result = File.createTempFile("test", ".zip");
+        try {
+
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
+            out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
+
+            ChangeSet changes = new ChangeSet();
+
+            final File file1 = getFile("test.txt");
+            ArchiveEntry entry = new ZipArchiveEntry("blub/test.txt");
+            changes.add(entry, new FileInputStream(file1));
+
+            changes.delete("testdata/test1.xml");
+
+            changes.perform(ais, out);
+
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+
+        List expected = new ArrayList();
+        expected.add("testdata/test2.xml");
+        expected.add("test/test3.xml");
+        expected.add("blub/test.txt");
+        expected.add("test.txt");
+        expected.add("something/bla");
+        expected.add("bla/test4.xml");
+        expected.add("test with spaces.txt");
+
+        this.checkArchiveContent(result, expected);
+    }
+
+    /**
+     * add blub/test.txt + delete blub
      * Should add dir1/test.txt and delete it afterwards. In this example,
      * the zip archive should stay untouched.
-	 * @throws Exception
-	 */
-	public void XtestAddDeleteAdd() throws Exception {
-		File input = this.createArchive("zip");
-		
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		File result = File.createTempFile("test", ".zip");
-		try {
-			
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
-			out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
-
-			ChangeSet changes = new ChangeSet();
-			
-			final File file1 = getFile("test.txt");
-			ArchiveEntry entry = new ZipArchiveEntry("blub/test.txt");
-			changes.add(entry, new FileInputStream(file1));
-			
-			changes.delete("blub");
-			
-			changes.perform(ais, out);
-			
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		
-		List expected = new ArrayList();
-		expected.add("testdata/test1.xml");
-		expected.add("testdata/test2.xml");
-		expected.add("test/test3.xml");
-		expected.add("test.txt");
-		expected.add("something/bla");
-		expected.add("bla/test4.xml");
-		expected.add("test with spaces.txt");
-		
-		this.checkArchiveContent(result, expected);
-	}
-	
-	
-	/**
-	 * delete bla + add bla/test.txt + delete bla
-	 * Deletes dir1/* first, then surpresses the add of bla.txt cause there
-	 * is a delete operation later.
-	 * @throws Exception
-	 */
-	public void XtestDeleteAddDelete() throws Exception {
-		File input = this.createArchive("zip");
-		
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		File result = File.createTempFile("test", ".zip");
-		try {
-			
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
-			out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
-
-			ChangeSet changes = new ChangeSet();
-			
-			changes.delete("bla");
-			
-			final File file1 = getFile("test.txt");
-			ArchiveEntry entry = new ZipArchiveEntry("bla/test.txt");
-			changes.add(entry, new FileInputStream(file1));
-			
-			changes.delete("bla");
-			
-			changes.perform(ais, out);
-			
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		
-		List expected = new ArrayList();
-		expected.add("testdata/test1.xml");
-		expected.add("testdata/test2.xml");
-		expected.add("test/test3.xml");
-		expected.add("test.txt");
-		expected.add("something/bla");
-		expected.add("test with spaces.txt");
-		
-		this.checkArchiveContent(result, expected);
-	}
-	
-	/**
-	 * Simple Delete from a zip file.
-	 * @throws Exception
-	 */
-	public void testDeleteFromZip() throws Exception {
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		try {
-			ChangeSet changes = new ChangeSet();
-			changes.delete("test2.xml");
-			
-			final File input = getFile("bla.zip");
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
-			
-			File temp = File.createTempFile("test", ".zip");
-			out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(temp));
-
-			changes.perform(ais, out);
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		// TODO add asserts
-	}
-
-	/**
-	 * Simple delete from a tar file
-	 * @throws Exception
-	 */
-	public void testDeleteFromTar() throws Exception {
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		try {
-			ChangeSet changes = new ChangeSet();
-			changes.delete("test2.xml");
-			
-			final File input = getFile("bla.tar");
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("tar", is);
-			
-			File temp = new File(dir, "bla.tar");
-			out = new ArchiveStreamFactory().createArchiveOutputStream("tar", new FileOutputStream(temp));
-
-			changes.perform(ais, out);
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		// TODO add asserts
-	}
-
-	/**
-	 * Simple delete from a jar file
-	 * @throws Exception
-	 */
-	public void testDeleteFromJar() throws Exception {
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		try {
-			ChangeSet changes = new ChangeSet();
-			changes.delete("test2.xml");
-			changes.delete("META-INF/MANIFEST.MF");
-			
-			final File input = getFile("bla.jar");
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("jar", is);
-			
-			File temp = new File(dir, "bla.jar");
-			out = new ArchiveStreamFactory().createArchiveOutputStream("jar", new FileOutputStream(temp));
-
-			changes.perform(ais, out);
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		// TODO add asserts
-	}
-
-	/**
-	 * Simple delete from an ar file
-	 * @throws Exception
-	 */
-	public void testDeleteFromAr() throws Exception {
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		try {
-			ChangeSet changes = new ChangeSet();
-			changes.delete("test2.xml");
-			
-			final File input = getFile("bla.ar");
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("ar", is);
-			
-			File temp = new File(dir, "bla.ar");
-			out = new ArchiveStreamFactory().createArchiveOutputStream("ar", new FileOutputStream(temp));
-
-			changes.perform(ais, out);
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		// TODO add asserts
-	}
-
-	public void testDeleteFromAndAddToTar() throws Exception {
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		try {
-			ChangeSet changes = new ChangeSet();
-			changes.delete("test2.xml");
-			
-			final File file1 = getFile("test.txt");
-			
-			final TarArchiveEntry entry = new TarArchiveEntry("testdata/test.txt");
-		    entry.setModTime(0);
-		    entry.setSize(file1.length());
-		    entry.setUserId(0);
-		    entry.setGroupId(0);
-		    entry.setUserName("avalon");
-		    entry.setGroupName("excalibur");
-		    entry.setMode(0100000);
-			
-	        changes.add(entry, new FileInputStream(file1));
-			
-			final File input = getFile("bla.tar");
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("tar", is);
-			
-			File temp = new File(dir, "bla.tar");
-			out = new ArchiveStreamFactory().createArchiveOutputStream("tar", new FileOutputStream(temp));
-
-			changes.perform(ais, out);
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		// TODO add asserts
-	}
-	
-	/**
-	 * Delete from a jar file and add another file
-	 * @throws Exception
-	 */
-	public void testDeleteFromAndAddToJar() throws Exception {
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		try {
-			ChangeSet changes = new ChangeSet();
-			changes.delete("test2.xml");
-			
-			final File file1 = getFile("test.txt");
-			JarArchiveEntry entry = new JarArchiveEntry("testdata/test.txt");
-	        changes.add(entry, new FileInputStream(file1));
-			
-			final File input = getFile("bla.jar");
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("jar", is);
-			
-			File temp = new File(dir, "bla.jar");
-			out = new ArchiveStreamFactory().createArchiveOutputStream("jar", new FileOutputStream(temp));
-
-			changes.perform(ais, out);
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		// TODO add asserts
-	}
-
-	/**
-	 * Deletes a file from an AR-archive and adds another
-	 * @throws Exception
-	 */
-	public void testDeleteFromAndAddToAr() throws Exception {
-		ArchiveOutputStream out = null;
-		ArchiveInputStream ais = null;
-		try {
-			ChangeSet changes = new ChangeSet();
-			changes.delete("test2.xml");
-			
-			final File file1 = getFile("test.txt");
-			
-			final ArArchiveEntry entry = new ArArchiveEntry("test.txt", file1.length());
-		   
-	        changes.add(entry, new FileInputStream(file1));
-			
-			final File input = getFile("bla.ar");
-			final InputStream is = new FileInputStream(input);
-			ais = new ArchiveStreamFactory().createArchiveInputStream("ar", is);
-			
-			File temp = new File(dir, "bla.ar");
-			out = new ArchiveStreamFactory().createArchiveOutputStream("ar", new FileOutputStream(temp));
-
-			changes.perform(ais, out);
-		} finally {
-			if(out != null) out.close();
-			if(ais != null) ais.close();
-		}
-		// TODO add asserts
-	}
-	
-	/**
-	 * TODO: Move operations are not supported currently
-	 * 
-	 * mv dir1/test.text dir2/test.txt + delete dir1
-	 * Moves the file to dir2 and deletes everything in dir1
-	 * @throws Exception
-	 */
-	public void testRenameAndDelete() throws Exception {
-	}
-	
-	/**
-	 * TODO: Move operations are not supported currently
-	 * 
-	 * add dir1/bla.txt + mv dir1/test.text dir2/test.txt + delete dir1
-	 * 
-	 * Add dir1/bla.txt should be surpressed. All other dir1 files will be
-	 * deleted, except dir1/test.text will be moved
-	 * 
-	 * @throws Exception
-	 */
-	public void testAddMoveDelete() throws Exception {
-	}
+     * @throws Exception
+     */
+    public void XtestAddDeleteAdd() throws Exception {
+        File input = this.createArchive("zip");
+
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        File result = File.createTempFile("test", ".zip");
+        try {
+
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
+            out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
+
+            ChangeSet changes = new ChangeSet();
+
+            final File file1 = getFile("test.txt");
+            ArchiveEntry entry = new ZipArchiveEntry("blub/test.txt");
+            changes.add(entry, new FileInputStream(file1));
+
+            changes.delete("blub");
+
+            changes.perform(ais, out);
+
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+
+        List expected = new ArrayList();
+        expected.add("testdata/test1.xml");
+        expected.add("testdata/test2.xml");
+        expected.add("test/test3.xml");
+        expected.add("test.txt");
+        expected.add("something/bla");
+        expected.add("bla/test4.xml");
+        expected.add("test with spaces.txt");
+
+        this.checkArchiveContent(result, expected);
+    }
+
+
+    /**
+     * delete bla + add bla/test.txt + delete bla
+     * Deletes dir1/* first, then surpresses the add of bla.txt cause there
+     * is a delete operation later.
+     * @throws Exception
+     */
+    public void XtestDeleteAddDelete() throws Exception {
+        File input = this.createArchive("zip");
+
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        File result = File.createTempFile("test", ".zip");
+        try {
+
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
+            out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(result));
+
+            ChangeSet changes = new ChangeSet();
+
+            changes.delete("bla");
+
+            final File file1 = getFile("test.txt");
+            ArchiveEntry entry = new ZipArchiveEntry("bla/test.txt");
+            changes.add(entry, new FileInputStream(file1));
+
+            changes.delete("bla");
+
+            changes.perform(ais, out);
+
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+
+        List expected = new ArrayList();
+        expected.add("testdata/test1.xml");
+        expected.add("testdata/test2.xml");
+        expected.add("test/test3.xml");
+        expected.add("test.txt");
+        expected.add("something/bla");
+        expected.add("test with spaces.txt");
+
+        this.checkArchiveContent(result, expected);
+    }
+
+    /**
+     * Simple Delete from a zip file.
+     * @throws Exception
+     */
+    public void testDeleteFromZip() throws Exception {
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        try {
+            ChangeSet changes = new ChangeSet();
+            changes.delete("test2.xml");
+
+            final File input = getFile("bla.zip");
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
+
+            File temp = File.createTempFile("test", ".zip");
+            out = new ArchiveStreamFactory().createArchiveOutputStream("zip", new FileOutputStream(temp));
+
+            changes.perform(ais, out);
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+        // TODO add asserts
+    }
+
+    /**
+     * Simple delete from a tar file
+     * @throws Exception
+     */
+    public void testDeleteFromTar() throws Exception {
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        try {
+            ChangeSet changes = new ChangeSet();
+            changes.delete("test2.xml");
+
+            final File input = getFile("bla.tar");
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("tar", is);
+
+            File temp = new File(dir, "bla.tar");
+            out = new ArchiveStreamFactory().createArchiveOutputStream("tar", new FileOutputStream(temp));
+
+            changes.perform(ais, out);
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+        // TODO add asserts
+    }
+
+    /**
+     * Simple delete from a jar file
+     * @throws Exception
+     */
+    public void testDeleteFromJar() throws Exception {
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        try {
+            ChangeSet changes = new ChangeSet();
+            changes.delete("test2.xml");
+            changes.delete("META-INF/MANIFEST.MF");
+
+            final File input = getFile("bla.jar");
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("jar", is);
+
+            File temp = new File(dir, "bla.jar");
+            out = new ArchiveStreamFactory().createArchiveOutputStream("jar", new FileOutputStream(temp));
+
+            changes.perform(ais, out);
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+        // TODO add asserts
+    }
+
+    /**
+     * Simple delete from an ar file
+     * @throws Exception
+     */
+    public void testDeleteFromAr() throws Exception {
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        try {
+            ChangeSet changes = new ChangeSet();
+            changes.delete("test2.xml");
+
+            final File input = getFile("bla.ar");
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("ar", is);
+
+            File temp = new File(dir, "bla.ar");
+            out = new ArchiveStreamFactory().createArchiveOutputStream("ar", new FileOutputStream(temp));
+
+            changes.perform(ais, out);
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+        // TODO add asserts
+    }
+
+    public void testDeleteFromAndAddToTar() throws Exception {
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        try {
+            ChangeSet changes = new ChangeSet();
+            changes.delete("test2.xml");
+
+            final File file1 = getFile("test.txt");
+
+            final TarArchiveEntry entry = new TarArchiveEntry("testdata/test.txt");
+            entry.setModTime(0);
+            entry.setSize(file1.length());
+            entry.setUserId(0);
+            entry.setGroupId(0);
+            entry.setUserName("avalon");
+            entry.setGroupName("excalibur");
+            entry.setMode(0100000);
+
+            changes.add(entry, new FileInputStream(file1));
+
+            final File input = getFile("bla.tar");
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("tar", is);
+
+            File temp = new File(dir, "bla.tar");
+            out = new ArchiveStreamFactory().createArchiveOutputStream("tar", new FileOutputStream(temp));
+
+            changes.perform(ais, out);
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+        // TODO add asserts
+    }
+
+    /**
+     * Delete from a jar file and add another file
+     * @throws Exception
+     */
+    public void testDeleteFromAndAddToJar() throws Exception {
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        try {
+            ChangeSet changes = new ChangeSet();
+            changes.delete("test2.xml");
+
+            final File file1 = getFile("test.txt");
+            JarArchiveEntry entry = new JarArchiveEntry("testdata/test.txt");
+            changes.add(entry, new FileInputStream(file1));
+
+            final File input = getFile("bla.jar");
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("jar", is);
+
+            File temp = new File(dir, "bla.jar");
+            out = new ArchiveStreamFactory().createArchiveOutputStream("jar", new FileOutputStream(temp));
+
+            changes.perform(ais, out);
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+        // TODO add asserts
+    }
+
+    /**
+     * Deletes a file from an AR-archive and adds another
+     * @throws Exception
+     */
+    public void testDeleteFromAndAddToAr() throws Exception {
+        ArchiveOutputStream out = null;
+        ArchiveInputStream ais = null;
+        try {
+            ChangeSet changes = new ChangeSet();
+            changes.delete("test2.xml");
+
+            final File file1 = getFile("test.txt");
+
+            final ArArchiveEntry entry = new ArArchiveEntry("test.txt", file1.length());
+
+            changes.add(entry, new FileInputStream(file1));
+
+            final File input = getFile("bla.ar");
+            final InputStream is = new FileInputStream(input);
+            ais = new ArchiveStreamFactory().createArchiveInputStream("ar", is);
+
+            File temp = new File(dir, "bla.ar");
+            out = new ArchiveStreamFactory().createArchiveOutputStream("ar", new FileOutputStream(temp));
+
+            changes.perform(ais, out);
+        } finally {
+            if(out != null) out.close();
+            if(ais != null) ais.close();
+        }
+        // TODO add asserts
+    }
+
+    /**
+     * TODO: Move operations are not supported currently
+     * 
+     * mv dir1/test.text dir2/test.txt + delete dir1
+     * Moves the file to dir2 and deletes everything in dir1
+     * @throws Exception
+     */
+    public void testRenameAndDelete() throws Exception {
+    }
+
+    /**
+     * TODO: Move operations are not supported currently
+     * 
+     * add dir1/bla.txt + mv dir1/test.text dir2/test.txt + delete dir1
+     * 
+     * Add dir1/bla.txt should be surpressed. All other dir1 files will be
+     * deleted, except dir1/test.text will be moved
+     * 
+     * @throws Exception
+     */
+    public void testAddMoveDelete() throws Exception {
+    }
 }



Mime
View raw message