Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sherfert authored and MishaDemianenko committed Nov 27, 2017
1 parent 105f2de commit 03e88c0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Expand Up @@ -47,6 +47,7 @@
import org.neo4j.kernel.impl.store.MetaDataStore; import org.neo4j.kernel.impl.store.MetaDataStore;
import org.neo4j.kernel.impl.store.format.standard.StandardV2_3; import org.neo4j.kernel.impl.store.format.standard.StandardV2_3;
import org.neo4j.kernel.impl.store.format.standard.StandardV3_2; import org.neo4j.kernel.impl.store.format.standard.StandardV3_2;
import org.neo4j.kernel.impl.store.format.standard.StandardV3_4;
import org.neo4j.kernel.impl.util.monitoring.ProgressReporter; import org.neo4j.kernel.impl.util.monitoring.ProgressReporter;
import org.neo4j.kernel.lifecycle.Lifespan; import org.neo4j.kernel.lifecycle.Lifespan;
import org.neo4j.kernel.monitoring.Monitors; import org.neo4j.kernel.monitoring.Monitors;
Expand Down Expand Up @@ -155,8 +156,8 @@ public void moveCreatedNativeLabelIndexBackToStoreDirectory() throws IOException
@Test @Test
public void populateNativeLabelScanIndexDuringMigration() throws IOException public void populateNativeLabelScanIndexDuringMigration() throws IOException
{ {
prepare32DatabaseWithNodes(); prepare34DatabaseWithNodes();
indexMigrator.migrate( storeDir, migrationDir, progressReporter, StandardV3_2.STORE_VERSION, StandardV3_2.STORE_VERSION ); indexMigrator.migrate( storeDir, migrationDir, progressReporter, StandardV3_4.STORE_VERSION, StandardV3_4.STORE_VERSION );
indexMigrator.moveMigratedFiles( migrationDir, storeDir, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION ); indexMigrator.moveMigratedFiles( migrationDir, storeDir, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION );


try ( Lifespan lifespan = new Lifespan() ) try ( Lifespan lifespan = new Lifespan() )
Expand All @@ -178,8 +179,8 @@ public void populateNativeLabelScanIndexDuringMigration() throws IOException
@Test @Test
public void reportProgressOnNativeIndexPopulation() throws IOException public void reportProgressOnNativeIndexPopulation() throws IOException
{ {
prepare32DatabaseWithNodes(); prepare34DatabaseWithNodes();
indexMigrator.migrate( storeDir, migrationDir, progressReporter, StandardV3_2.STORE_VERSION, StandardV3_2.STORE_VERSION ); indexMigrator.migrate( storeDir, migrationDir, progressReporter, StandardV3_4.STORE_VERSION, StandardV3_4.STORE_VERSION );
indexMigrator.moveMigratedFiles( migrationDir, storeDir, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION ); indexMigrator.moveMigratedFiles( migrationDir, storeDir, StandardV2_3.STORE_VERSION, StandardV3_2.STORE_VERSION );


verify( progressReporter ).start( 10 ); verify( progressReporter ).start( 10 );
Expand Down Expand Up @@ -228,7 +229,7 @@ private ByteBuffer writeNativeIndexFile( File file, byte[] content ) throws IOEx
return sourceBuffer; return sourceBuffer;
} }


private void prepare32DatabaseWithNodes() private void prepare34DatabaseWithNodes()
{ {
GraphDatabaseService embeddedDatabase = new TestGraphDatabaseFactory().newEmbeddedDatabase( storeDir ); GraphDatabaseService embeddedDatabase = new TestGraphDatabaseFactory().newEmbeddedDatabase( storeDir );
try try
Expand Down
Expand Up @@ -44,14 +44,14 @@
*/ */
public class HighLimit extends BaseRecordFormats public class HighLimit extends BaseRecordFormats
{ {
public static final String STORE_VERSION = StoreVersion.HIGH_LIMIT_V3_2_0.versionString(); public static final String STORE_VERSION = StoreVersion.HIGH_LIMIT_V3_4_0.versionString();


public static final RecordFormats RECORD_FORMATS = new HighLimit(); public static final RecordFormats RECORD_FORMATS = new HighLimit();
public static final String NAME = "high_limit"; public static final String NAME = "high_limit";


public HighLimit() public HighLimit()
{ {
super( STORE_VERSION, StoreVersion.HIGH_LIMIT_V3_2_0.introductionVersion(), 4, Capability.DENSE_NODES, super( STORE_VERSION, StoreVersion.HIGH_LIMIT_V3_4_0.introductionVersion(), 5, Capability.DENSE_NODES,
Capability.RELATIONSHIP_TYPE_3BYTES, Capability.SCHEMA, Capability.LUCENE_5, Capability.POINT_PROPERTIES ); Capability.RELATIONSHIP_TYPE_3BYTES, Capability.SCHEMA, Capability.LUCENE_5, Capability.POINT_PROPERTIES );
} }


Expand Down
Expand Up @@ -109,12 +109,16 @@ public void detectObsoleteCountStoresToRebuildDuringMigration() throws IOExcepti
Set<String> expectedVersions = new TreeSet<>( Set<String> expectedVersions = new TreeSet<>(
Arrays.stream( StoreVersion.values() ).map( StoreVersion::versionString ) Arrays.stream( StoreVersion.values() ).map( StoreVersion::versionString )
.collect( Collectors.toSet() ) ); .collect( Collectors.toSet() ) );

assertTrue( storeMigrator.countStoreRebuildRequired( StoreVersion.STANDARD_V2_3.versionString() ) ); assertTrue( storeMigrator.countStoreRebuildRequired( StoreVersion.STANDARD_V2_3.versionString() ) );
actualVersions.add( StoreVersion.STANDARD_V2_3.versionString() ); actualVersions.add( StoreVersion.STANDARD_V2_3.versionString() );
assertTrue( storeMigrator.countStoreRebuildRequired( StoreVersion.STANDARD_V3_0.versionString() ) ); assertTrue( storeMigrator.countStoreRebuildRequired( StoreVersion.STANDARD_V3_0.versionString() ) );
actualVersions.add( StoreVersion.STANDARD_V3_0.versionString() ); actualVersions.add( StoreVersion.STANDARD_V3_0.versionString() );
assertFalse( storeMigrator.countStoreRebuildRequired( StoreVersion.STANDARD_V3_2.versionString() ) ); assertFalse( storeMigrator.countStoreRebuildRequired( StoreVersion.STANDARD_V3_2.versionString() ) );
actualVersions.add( StoreVersion.STANDARD_V3_2.versionString() ); actualVersions.add( StoreVersion.STANDARD_V3_2.versionString() );
assertFalse( storeMigrator.countStoreRebuildRequired( StoreVersion.STANDARD_V3_4.versionString() ) );
actualVersions.add( StoreVersion.STANDARD_V3_4.versionString() );

assertTrue( storeMigrator.countStoreRebuildRequired( StoreVersion.HIGH_LIMIT_V3_0_0.versionString() ) ); assertTrue( storeMigrator.countStoreRebuildRequired( StoreVersion.HIGH_LIMIT_V3_0_0.versionString() ) );
actualVersions.add( StoreVersion.HIGH_LIMIT_V3_0_0.versionString() ); actualVersions.add( StoreVersion.HIGH_LIMIT_V3_0_0.versionString() );
assertTrue( storeMigrator.countStoreRebuildRequired( StoreVersion.HIGH_LIMIT_V3_0_6.versionString() ) ); assertTrue( storeMigrator.countStoreRebuildRequired( StoreVersion.HIGH_LIMIT_V3_0_6.versionString() ) );
Expand All @@ -123,6 +127,9 @@ public void detectObsoleteCountStoresToRebuildDuringMigration() throws IOExcepti
actualVersions.add( StoreVersion.HIGH_LIMIT_V3_1_0.versionString() ); actualVersions.add( StoreVersion.HIGH_LIMIT_V3_1_0.versionString() );
assertFalse( storeMigrator.countStoreRebuildRequired( StoreVersion.HIGH_LIMIT_V3_2_0.versionString() ) ); assertFalse( storeMigrator.countStoreRebuildRequired( StoreVersion.HIGH_LIMIT_V3_2_0.versionString() ) );
actualVersions.add( StoreVersion.HIGH_LIMIT_V3_2_0.versionString() ); actualVersions.add( StoreVersion.HIGH_LIMIT_V3_2_0.versionString() );
assertFalse( storeMigrator.countStoreRebuildRequired( StoreVersion.HIGH_LIMIT_V3_4_0.versionString() ) );
actualVersions.add( StoreVersion.HIGH_LIMIT_V3_4_0.versionString() );

assertEquals( expectedVersions, actualVersions ); assertEquals( expectedVersions, actualVersions );
} }


Expand Down

0 comments on commit 03e88c0

Please sign in to comment.