@ -58,7 +58,6 @@ import java.util.Arrays;
import java.util.Collection ;
import java.util.Collection ;
import java.util.Collections ;
import java.util.Collections ;
import java.util.Comparator ;
import java.util.Comparator ;
import java.util.Iterator ;
import java.util.LinkedList ;
import java.util.LinkedList ;
import java.util.List ;
import java.util.List ;
@ -125,9 +124,11 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
/ * *
/ * *
* Test constructor for exceptions , default settings , initialization .
* Test constructor for exceptions , default settings , initialization .
*
* @throws IOException
* /
* /
@Test
@Test
public void testContructor ( ) {
public void testContructor ( ) throws IOException {
writer = new PackWriter ( config , db . newObjectReader ( ) ) ;
writer = new PackWriter ( config , db . newObjectReader ( ) ) ;
assertEquals ( false , writer . isDeltaBaseAsOffset ( ) ) ;
assertEquals ( false , writer . isDeltaBaseAsOffset ( ) ) ;
assertEquals ( true , config . isReuseDeltas ( ) ) ;
assertEquals ( true , config . isReuseDeltas ( ) ) ;
@ -177,7 +178,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
* /
* /
@Test
@Test
public void testWriteEmptyPack2 ( ) throws IOException {
public void testWriteEmptyPack2 ( ) throws IOException {
createVerifyOpenPack ( EMPTY_LIST_REVS . iterator ( ) ) ;
createVerifyOpenPack ( EMPTY_LIST_REVS ) ;
assertEquals ( 0 , writer . getObjectsNumber ( ) ) ;
assertEquals ( 0 , writer . getObjectsNumber ( ) ) ;
assertEquals ( 0 , pack . getObjectCount ( ) ) ;
assertEquals ( 0 , pack . getObjectCount ( ) ) ;
@ -320,7 +321,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
for ( int i = 0 ; i < forcedOrder . length ; i + + )
for ( int i = 0 ; i < forcedOrder . length ; i + + )
forcedOrderRevs [ i ] = parser . parseAny ( forcedOrder [ i ] ) ;
forcedOrderRevs [ i ] = parser . parseAny ( forcedOrder [ i ] ) ;
createVerifyOpenPack ( Arrays . asList ( forcedOrderRevs ) . iterator ( ) ) ;
createVerifyOpenPack ( Arrays . asList ( forcedOrderRevs ) ) ;
assertEquals ( forcedOrder . length , writer . getObjectsNumber ( ) ) ;
assertEquals ( forcedOrder . length , writer . getObjectsNumber ( ) ) ;
verifyObjectsOrder ( forcedOrder ) ;
verifyObjectsOrder ( forcedOrder ) ;
@ -544,11 +545,12 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
verifyOpenPack ( thin ) ;
verifyOpenPack ( thin ) ;
}
}
private void createVerifyOpenPack ( final Iterator < RevObject > objectSource )
private void createVerifyOpenPack ( final List < RevObject > objectSource )
throws MissingObjectException , IOException {
throws MissingObjectException , IOException {
NullProgressMonitor m = NullProgressMonitor . INSTANCE ;
NullProgressMonitor m = NullProgressMonitor . INSTANCE ;
writer = new PackWriter ( config , db . newObjectReader ( ) ) ;
writer = new PackWriter ( config , db . newObjectReader ( ) ) ;
writer . preparePack ( objectSource ) ;
writer . preparePack ( objectSource . iterator ( ) ) ;
assertEquals ( objectSource . size ( ) , writer . getObjectsNumber ( ) ) ;
writer . writePack ( m , m , os ) ;
writer . writePack ( m , m , os ) ;
writer . release ( ) ;
writer . release ( ) ;
verifyOpenPack ( false ) ;
verifyOpenPack ( false ) ;