aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1081762 - /aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/fixture/ArchiveFixture.java
Date Tue, 15 Mar 2011 13:07:52 GMT
Author: not
Date: Tue Mar 15 13:07:51 2011
New Revision: 1081762

URL: http://svn.apache.org/viewvc?rev=1081762&view=rev
Log:
ARIES-611 Update test support to add a getInputStream method for new bp tests


Modified:
    aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/fixture/ArchiveFixture.java

Modified: aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/fixture/ArchiveFixture.java
URL: http://svn.apache.org/viewvc/aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/fixture/ArchiveFixture.java?rev=1081762&r1=1081761&r2=1081762&view=diff
==============================================================================
--- aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/fixture/ArchiveFixture.java
(original)
+++ aries/trunk/testsupport/testsupport-unit/src/main/java/org/apache/aries/unittest/fixture/ArchiveFixture.java
Tue Mar 15 13:07:51 2011
@@ -268,7 +268,7 @@ public class ArchiveFixture
     }
     
     @Override
-    public void writeOut(OutputStream out) throws IOException
+    public InputStream getInputStream() throws IOException
     {
       if (bytes == null) {
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
@@ -287,8 +287,7 @@ public class ArchiveFixture
         bytes = bout.toByteArray();
       }
       
-      ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
-      copy(bin, out);
+      return new ByteArrayInputStream(bytes);
     }
   }
   
@@ -451,6 +450,11 @@ public class ArchiveFixture
     
     public void writeOut(OutputStream out) throws IOException 
     {
+      copy(getInputStream(), out);
+    }
+    
+    public InputStream getInputStream() throws IOException
+    {
       /*
        * For better reuse this method delegate the writing to writeAllEntries, which
        * can be reused by the JarFixture.
@@ -465,9 +469,7 @@ public class ArchiveFixture
       
       bytes = bout.toByteArray();
 
-      ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
-      copy(bin, out);
+      return new ByteArrayInputStream(bytes);
     }
   }
-
 }



Mime
View raw message