Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Aug 30, 2018
1 parent 49f546f commit e288224
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Expand Up @@ -43,7 +43,7 @@
import static org.junit.Assert.fail;

/**
* A little trick to automatically tell whether or not index format was changed without
* A little trick to automatically tell whether or not store format was changed without
* incrementing the format version. This is done by keeping a zipped store file which is opened and tested on.
* On failure this test will fail saying that the format version needs update and also update the zipped
* store with the new version.
Expand Down Expand Up @@ -113,14 +113,14 @@ private void doShouldDetectFormatChange( String zipName, File storeFile ) throws
catch ( Throwable t )
{
throw new AssertionError( "If this is the single failing test in this component then this failure is a strong indication that format " +
"has changed without also incrementing TreeNode version(s). Please make necessary format version changes.", t );
"has changed without also incrementing format version(s). Please make necessary format version changes.", t );
}
}

private void tellDeveloperToCommitThisFormatVersion( String zipName )
{
fail( String.format( "This is merely a notification to developer. Format has changed and its version has also " +
"been properly incremented. A tree with this new format has been generated and should be committed. " +
"been properly incremented. A store file with this new format has been generated and should be committed. " +
"Please move:%n %s%ninto %n %s, %nreplacing the existing file there",
globalDir.file( zipName ),
"<corresponding-module>" + pathify( ".src.test.resources." ) +
Expand Down
Expand Up @@ -48,8 +48,13 @@ public class GenericKeyStateFormatTest extends FormatCompatibilityVerifier
public PageCacheRule pageCacheRule = new PageCacheRule();

@Rule
public RandomRule randomRule = new RandomRule().withSeedForAllTests( 20051116 );
public RandomRule randomRule = new RandomRule().withSeedForAllTests( SEED );

// Seed and entity id is intentionally fixed because we have a file stored with all current
// value formats. The stored values are generated by with this seed and we need it to verify
// that we read the content correctly.
private static final int SEED = 20051116;
private static final int ENTITY_ID = 19570320;
private static final int NUMBER_OF_SLOTS = 2;
private List<Value> values;

Expand Down Expand Up @@ -181,7 +186,7 @@ private void putData( PageCursor c )
CompositeGenericKey key = layout.newKey();
for ( Value value : values )
{
key.initialize( 19570320 );
key.initialize( ENTITY_ID );
for ( int i = 0; i < NUMBER_OF_SLOTS; i++ )
{
key.initFromValue( i, value, NativeIndexKey.Inclusion.NEUTRAL );
Expand Down

0 comments on commit e288224

Please sign in to comment.