]> source.dussan.org Git - jgit.git/commitdiff
Remove pack stream from PackWriterTest 19/919/2
authorShawn O. Pearce <spearce@spearce.org>
Tue, 22 Jun 2010 23:54:23 +0000 (16:54 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 23 Jun 2010 23:54:14 +0000 (16:54 -0700)
This stream was used only to determine how many bytes had been
written thus far.  Except we're always dumping it into a simple
ByteArrayOutputStream, which also knows that.  Drop the dependency
on the pack stream and use ByteArrayOutputStream directly.

This lets us later move this test into the new storage.file
package without dragging along the pack stream that is an internal
implementation detail of PackWriter, which is more general than
just the file storage layer.

Change-Id: I291689c0b1ed799270c213ee73b710b2637fb238
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/PackWriterTest.java

index ca626d4db5945e6d1db05b4e380eb4ca41f36472..76b663a29b5bacf144b7506c696e86eb3984b94a 100644 (file)
@@ -77,8 +77,6 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
 
        private ByteArrayOutputStream os;
 
-       private PackOutputStream cos;
-
        private File packBase;
 
        private File packFile;
@@ -90,7 +88,6 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
        public void setUp() throws Exception {
                super.setUp();
                os = new ByteArrayOutputStream();
-               cos = new PackOutputStream(os);
                packBase = new File(trash, "tmp_pack");
                packFile = new File(trash, "tmp_pack.pack");
                indexFile = new File(trash, "tmp_pack.idx");
@@ -314,11 +311,11 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
         */
        public void testWritePack2SizeDeltasVsNoDeltas() throws Exception {
                testWritePack2();
-               final long sizePack2NoDeltas = cos.length();
+               final long sizePack2NoDeltas = os.size();
                tearDown();
                setUp();
                testWritePack2DeltasReuseRefs();
-               final long sizePack2DeltasRefs = cos.length();
+               final long sizePack2DeltasRefs = os.size();
 
                assertTrue(sizePack2NoDeltas > sizePack2DeltasRefs);
        }
@@ -333,11 +330,11 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
         */
        public void testWritePack2SizeOffsetsVsRefs() throws Exception {
                testWritePack2DeltasReuseRefs();
-               final long sizePack2DeltasRefs = cos.length();
+               final long sizePack2DeltasRefs = os.size();
                tearDown();
                setUp();
                testWritePack2DeltasReuseOffsets();
-               final long sizePack2DeltasOffsets = cos.length();
+               final long sizePack2DeltasOffsets = os.size();
 
                assertTrue(sizePack2DeltasRefs > sizePack2DeltasOffsets);
        }
@@ -351,11 +348,11 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
         */
        public void testWritePack4SizeThinVsNoThin() throws Exception {
                testWritePack4();
-               final long sizePack4 = cos.length();
+               final long sizePack4 = os.size();
                tearDown();
                setUp();
                testWritePack4ThinPack();
-               final long sizePack4Thin = cos.length();
+               final long sizePack4Thin = os.size();
 
                assertTrue(sizePack4 > sizePack4Thin);
        }
@@ -482,14 +479,14 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
                writer.setThin(thin);
                writer.setIgnoreMissingUninteresting(ignoreMissingUninteresting);
                writer.preparePack(interestings, uninterestings);
-               writer.writePack(cos);
+               writer.writePack(os);
                verifyOpenPack(thin);
        }
 
        private void createVerifyOpenPack(final Iterator<RevObject> objectSource)
                        throws MissingObjectException, IOException {
                writer.preparePack(objectSource);
-               writer.writePack(cos);
+               writer.writePack(os);
                verifyOpenPack(false);
        }