@ -55,11 +55,11 @@ import java.io.FileOutputStream;
import java.io.IOException ;
import java.io.IOException ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.Arrays ;
import java.util.Collection ;
import java.util.Collections ;
import java.util.Collections ;
import java.util.Comparator ;
import java.util.Comparator ;
import java.util.LinkedLis t ;
import java.util.HashSe t ;
import java.util.List ;
import java.util.List ;
import java.util.Set ;
import org.eclipse.jgit.errors.MissingObjectException ;
import org.eclipse.jgit.errors.MissingObjectException ;
import org.eclipse.jgit.junit.JGitTestUtil ;
import org.eclipse.jgit.junit.JGitTestUtil ;
@ -79,8 +79,8 @@ import org.junit.Test;
public class PackWriterTest extends SampleDataRepositoryTestCase {
public class PackWriterTest extends SampleDataRepositoryTestCase {
private static final Lis t< ObjectId > EMPTY_LI ST_OBJECT = Collections
private static final Se t< ObjectId > EMPTY_SE T_OBJECT = Collections
. < ObjectId > emptyLis t ( ) ;
. < ObjectId > emptySe t ( ) ;
private static final List < RevObject > EMPTY_LIST_REVS = Collections
private static final List < RevObject > EMPTY_LIST_REVS = Collections
. < RevObject > emptyList ( ) ;
. < RevObject > emptyList ( ) ;
@ -162,7 +162,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
* /
* /
@Test
@Test
public void testWriteEmptyPack1 ( ) throws IOException {
public void testWriteEmptyPack1 ( ) throws IOException {
createVerifyOpenPack ( EMPTY_LI ST_OBJECT , EMPTY_LI ST_OBJECT , false , false ) ;
createVerifyOpenPack ( EMPTY_SE T_OBJECT , EMPTY_SE T_OBJECT , false , false ) ;
assertEquals ( 0 , writer . getObjectCount ( ) ) ;
assertEquals ( 0 , writer . getObjectCount ( ) ) ;
assertEquals ( 0 , pack . getObjectCount ( ) ) ;
assertEquals ( 0 , pack . getObjectCount ( ) ) ;
@ -195,7 +195,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
final ObjectId nonExisting = ObjectId
final ObjectId nonExisting = ObjectId
. fromString ( "0000000000000000000000000000000000000001" ) ;
. fromString ( "0000000000000000000000000000000000000001" ) ;
try {
try {
createVerifyOpenPack ( EMPTY_LI ST_OBJECT , Collections . nCopies ( 1 ,
createVerifyOpenPack ( EMPTY_SE T_OBJECT , Collections . singleton (
nonExisting ) , false , false ) ;
nonExisting ) , false , false ) ;
fail ( "Should have thrown MissingObjectException" ) ;
fail ( "Should have thrown MissingObjectException" ) ;
} catch ( MissingObjectException x ) {
} catch ( MissingObjectException x ) {
@ -212,7 +212,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
public void testIgnoreNonExistingObjects ( ) throws IOException {
public void testIgnoreNonExistingObjects ( ) throws IOException {
final ObjectId nonExisting = ObjectId
final ObjectId nonExisting = ObjectId
. fromString ( "0000000000000000000000000000000000000001" ) ;
. fromString ( "0000000000000000000000000000000000000001" ) ;
createVerifyOpenPack ( EMPTY_LI ST_OBJECT , Collections . nCopies ( 1 ,
createVerifyOpenPack ( EMPTY_SE T_OBJECT , Collections . singleton (
nonExisting ) , false , true ) ;
nonExisting ) , false , true ) ;
// shouldn't throw anything
// shouldn't throw anything
}
}
@ -451,10 +451,10 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
// TODO: testWritePackDeltasDepth()
// TODO: testWritePackDeltasDepth()
private void writeVerifyPack1 ( ) throws IOException {
private void writeVerifyPack1 ( ) throws IOException {
final LinkedLis t< ObjectId > interestings = new LinkedLis t< ObjectId > ( ) ;
final HashSe t< ObjectId > interestings = new HashSe t< ObjectId > ( ) ;
interestings . add ( ObjectId
interestings . add ( ObjectId
. fromString ( "82c6b885ff600be425b4ea96dee75dca255b69e7" ) ) ;
. fromString ( "82c6b885ff600be425b4ea96dee75dca255b69e7" ) ) ;
createVerifyOpenPack ( interestings , EMPTY_LI ST_OBJECT , false , false ) ;
createVerifyOpenPack ( interestings , EMPTY_SE T_OBJECT , false , false ) ;
final ObjectId expectedOrder [ ] = new ObjectId [ ] {
final ObjectId expectedOrder [ ] = new ObjectId [ ] {
ObjectId . fromString ( "82c6b885ff600be425b4ea96dee75dca255b69e7" ) ,
ObjectId . fromString ( "82c6b885ff600be425b4ea96dee75dca255b69e7" ) ,
@ -474,10 +474,10 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
private void writeVerifyPack2 ( boolean deltaReuse ) throws IOException {
private void writeVerifyPack2 ( boolean deltaReuse ) throws IOException {
config . setReuseDeltas ( deltaReuse ) ;
config . setReuseDeltas ( deltaReuse ) ;
final LinkedLis t< ObjectId > interestings = new LinkedLis t< ObjectId > ( ) ;
final HashSe t< ObjectId > interestings = new HashSe t< ObjectId > ( ) ;
interestings . add ( ObjectId
interestings . add ( ObjectId
. fromString ( "82c6b885ff600be425b4ea96dee75dca255b69e7" ) ) ;
. fromString ( "82c6b885ff600be425b4ea96dee75dca255b69e7" ) ) ;
final LinkedLis t< ObjectId > uninterestings = new LinkedLis t< ObjectId > ( ) ;
final HashSe t< ObjectId > uninterestings = new HashSe t< ObjectId > ( ) ;
uninterestings . add ( ObjectId
uninterestings . add ( ObjectId
. fromString ( "540a36d136cf413e4b064c2b0e0a4db60f77feab" ) ) ;
. fromString ( "540a36d136cf413e4b064c2b0e0a4db60f77feab" ) ) ;
createVerifyOpenPack ( interestings , uninterestings , false , false ) ;
createVerifyOpenPack ( interestings , uninterestings , false , false ) ;
@ -502,10 +502,10 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
}
}
private void writeVerifyPack4 ( final boolean thin ) throws IOException {
private void writeVerifyPack4 ( final boolean thin ) throws IOException {
final LinkedLis t< ObjectId > interestings = new LinkedLis t< ObjectId > ( ) ;
final HashSe t< ObjectId > interestings = new HashSe t< ObjectId > ( ) ;
interestings . add ( ObjectId
interestings . add ( ObjectId
. fromString ( "82c6b885ff600be425b4ea96dee75dca255b69e7" ) ) ;
. fromString ( "82c6b885ff600be425b4ea96dee75dca255b69e7" ) ) ;
final LinkedLis t< ObjectId > uninterestings = new LinkedLis t< ObjectId > ( ) ;
final HashSe t< ObjectId > uninterestings = new HashSe t< ObjectId > ( ) ;
uninterestings . add ( ObjectId
uninterestings . add ( ObjectId
. fromString ( "c59759f143fb1fe21c197981df75a7ee00290799" ) ) ;
. fromString ( "c59759f143fb1fe21c197981df75a7ee00290799" ) ) ;
createVerifyOpenPack ( interestings , uninterestings , thin , false ) ;
createVerifyOpenPack ( interestings , uninterestings , thin , false ) ;
@ -531,8 +531,8 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
. computeName ( ) . name ( ) ) ;
. computeName ( ) . name ( ) ) ;
}
}
private void createVerifyOpenPack ( final Collection < ObjectId > interestings ,
private void createVerifyOpenPack ( final Set < ObjectId > interestings ,
final Collection < ObjectId > uninterestings , final boolean thin ,
final Set < ObjectId > uninterestings , final boolean thin ,
final boolean ignoreMissingUninteresting )
final boolean ignoreMissingUninteresting )
throws MissingObjectException , IOException {
throws MissingObjectException , IOException {
NullProgressMonitor m = NullProgressMonitor . INSTANCE ;
NullProgressMonitor m = NullProgressMonitor . INSTANCE ;