commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r759352 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
Date Fri, 27 Mar 2009 21:08:27 GMT
Author: tcurdt
Date: Fri Mar 27 21:08:27 2009
New Revision: 759352

URL: http://svn.apache.org/viewvc?rev=759352&view=rev
Log:
tracked down the problem of https://issues.apache.org/jira/browse/COMPRESS-11



Modified:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java?rev=759352&r1=759351&r2=759352&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/ArTestCase.java
Fri Mar 27 21:08:27 2009
@@ -107,10 +107,16 @@
 			out.close();
 		}
 		
+		assertEquals(282, output.length());
+		
 		final File output2 = new File(dir, "bla2.ar");		
 
+		int copied = 0;
+		int deleted = 0;
+
 		{
 			// remove all but one file
+
 			final InputStream is = new FileInputStream(output);
 			final OutputStream os = new FileOutputStream(output2);
 			final ArchiveOutputStream aos = new ArchiveStreamFactory().createArchiveOutputStream("ar",
os);
@@ -124,8 +130,11 @@
 				if ("test1.xml".equals(entry.getName())) {
 					aos.putArchiveEntry(entry);
 					IOUtils.copy(ais, aos);
+					aos.closeArchiveEntry();
+					copied++;
 				} else {
 			        IOUtils.copy(ais, new ByteArrayOutputStream());
+			        deleted++;
 				}
 			
 			}
@@ -135,7 +144,11 @@
 			os.close();			
 		}
 
+		assertEquals(1, copied);
+		assertEquals(1, deleted);
+		assertEquals(144, output2.length());
 		
+		long files = 0;
 		long sum = 0;
 
 		{
@@ -150,11 +163,13 @@
 		        IOUtils.copy(ais, new ByteArrayOutputStream());
 		        
 		        sum +=  entry.getLength();
+		        files++;
 			}
 			ais.close();
 			is.close();			
 		}
 
+		assertEquals(1, files);
 		assertEquals(76, sum);
 		
 	}



Mime
View raw message