diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/index/LuceneSchemaIndexPopulationIT.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/index/LuceneSchemaIndexPopulationIT.java index 2915ebdd77065..fc164a5863948 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/index/LuceneSchemaIndexPopulationIT.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/index/LuceneSchemaIndexPopulationIT.java @@ -100,8 +100,7 @@ public void partitionedIndexPopulation() throws Exception assertEquals( 0, uniqueIndex.allDocumentsReader().maxCount() ); assertFalse( uniqueIndex.exists() ); - try ( LuceneIndexAccessor indexAccessor = new LuceneIndexAccessor( uniqueIndex, - NewIndexDescriptorFactory.forLabel( 1, 1 ) ) ) + try ( LuceneIndexAccessor indexAccessor = new LuceneIndexAccessor( uniqueIndex, descriptor ) ) { generateUpdates( indexAccessor, affectedNodes ); indexAccessor.force(); diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/AccessUniqueDatabaseIndexTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/AccessUniqueDatabaseIndexTest.java index 59ee996ff978f..8da8828c01258 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/AccessUniqueDatabaseIndexTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/AccessUniqueDatabaseIndexTest.java @@ -137,7 +137,7 @@ private LuceneIndexAccessor createAccessor( PartitionedIndexStorage indexStorage .withIndexStorage( indexStorage ) .build(); luceneIndex.open(); - return new LuceneIndexAccessor( luceneIndex, NewIndexDescriptorFactory.forLabel( 1, 1 ) ); + return new LuceneIndexAccessor( luceneIndex, index ); } private PartitionedIndexStorage getIndexStorage() throws IOException diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/DatabaseIndexAccessorTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/DatabaseIndexAccessorTest.java index e73ce330b7f2c..4e40b5891c0cf 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/DatabaseIndexAccessorTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/DatabaseIndexAccessorTest.java @@ -67,31 +67,31 @@ public class DatabaseIndexAccessorTest { public static final int PROP_ID = 1; - private static final NewIndexDescriptor SOME_INDEX_DESCRIPTOR = NewIndexDescriptorFactory.forLabel( 1, PROP_ID ); @Rule public final ThreadingRule threading = new ThreadingRule(); @ClassRule public static final EphemeralFileSystemRule fileSystemRule = new EphemeralFileSystemRule(); - @Parameterized.Parameter + @Parameterized.Parameter(0) + public NewIndexDescriptor index; + @Parameterized.Parameter(1) public IOFunction accessorFactory; private LuceneIndexAccessor accessor; private final long nodeId = 1, nodeId2 = 2; private final Object value = "value", value2 = 40; private DirectoryFactory.InMemoryDirectoryFactory dirFactory; - private static final NewIndexDescriptor indexDescriptor = NewIndexDescriptorFactory.forLabel( 0, PROP_ID ); - private static final NewIndexDescriptor uniqueIndexDescriptor = NewIndexDescriptorFactory - .uniqueForLabel( 1, PROP_ID ); + private static final NewIndexDescriptor GENERAL_INDEX = NewIndexDescriptorFactory.forLabel( 0, PROP_ID ); + private static final NewIndexDescriptor UNIQUE_INDEX = NewIndexDescriptorFactory.uniqueForLabel( 1, PROP_ID ); @Parameterized.Parameters( name = "{0}" ) - public static Collection[]> implementations() + public static Collection implementations() { final File dir = new File( "dir" ); return Arrays.asList( - arg( dirFactory1 -> { - SchemaIndex index = LuceneSchemaIndexBuilder.create( indexDescriptor ) + arg( GENERAL_INDEX, dirFactory1 -> { + SchemaIndex index = LuceneSchemaIndexBuilder.create( GENERAL_INDEX ) .withFileSystem( fileSystemRule.get() ) .withDirectoryFactory( dirFactory1 ) .withIndexRootFolder( dir ) @@ -100,10 +100,10 @@ public static Collection[]> imp index.create(); index.open(); - return new LuceneIndexAccessor( index, SOME_INDEX_DESCRIPTOR ); + return new LuceneIndexAccessor( index, GENERAL_INDEX ); } ), - arg( dirFactory1 -> { - SchemaIndex index = LuceneSchemaIndexBuilder.create( uniqueIndexDescriptor ) + arg( UNIQUE_INDEX, dirFactory1 -> { + SchemaIndex index = LuceneSchemaIndexBuilder.create( UNIQUE_INDEX ) .withFileSystem( fileSystemRule.get() ) .withDirectoryFactory( dirFactory1 ) .withIndexRootFolder( dir ) @@ -112,15 +112,16 @@ public static Collection[]> imp index.create(); index.open(); - return new LuceneIndexAccessor( index, SOME_INDEX_DESCRIPTOR ); + return new LuceneIndexAccessor( index, UNIQUE_INDEX ); } ) ); } - private static IOFunction[] arg( + private static Object[] arg( + NewIndexDescriptor index, IOFunction foo ) { - return new IOFunction[]{foo}; + return new Object[]{index, foo}; } @Before @@ -324,17 +325,17 @@ public void shouldStopSamplingWhenIndexIsDropped() throws Exception private IndexEntryUpdate add( long nodeId, Object value ) { - return IndexEntryUpdate.add( nodeId, indexDescriptor.schema(), value ); + return IndexEntryUpdate.add( nodeId, index.schema(), value ); } private IndexEntryUpdate remove( long nodeId, Object value ) { - return IndexEntryUpdate.remove( nodeId, indexDescriptor.schema(), value ); + return IndexEntryUpdate.remove( nodeId, index.schema(), value ); } private IndexEntryUpdate change( long nodeId, Object valueBefore, Object valueAfter ) { - return IndexEntryUpdate.change( nodeId, indexDescriptor.schema(), valueBefore, valueAfter ); + return IndexEntryUpdate.change( nodeId, index.schema(), valueBefore, valueAfter ); } private void updateAndCommit( List nodePropertyUpdates ) diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexIT.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexIT.java index 35823ff6c25fd..41a35b1d061e8 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexIT.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexIT.java @@ -257,7 +257,7 @@ private LuceneIndexAccessor createDefaultIndexAccessor() throws IOException .build(); index.create(); index.open(); - return new LuceneIndexAccessor( index, NewIndexDescriptorFactory.forLabel( 1, 1 ) ); + return new LuceneIndexAccessor( index, descriptor ); } private Map countTemplateMatches( List nameTemplates, List fileNames ) diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/populator/NonUniqueDatabaseIndexPopulatingUpdaterTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/populator/NonUniqueDatabaseIndexPopulatingUpdaterTest.java index 63bb635360ecf..afaaad24f5c51 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/populator/NonUniqueDatabaseIndexPopulatingUpdaterTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/populator/NonUniqueDatabaseIndexPopulatingUpdaterTest.java @@ -284,7 +284,7 @@ public void removalsDeliveredToIndexWriter() throws Exception updater.process( remove( 3, SCHEMA_DESCRIPTOR, "baz" ) ); verify( writer ).deleteDocuments( newTermForChangeOrRemove( 3 ) ); - updater.process( remove( 4, SCHEMA_DESCRIPTOR, "bit", "baz" ) ); + updater.process( remove( 4, COMPOSITE_SCHEMA_DESCRIPTOR, "bit", "baz" ) ); verify( writer ).deleteDocuments( newTermForChangeOrRemove( 4 ) ); } diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/populator/UniqueDatabaseIndexPopulatorTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/populator/UniqueDatabaseIndexPopulatorTest.java index 645dc4bbaa789..33411ea9fe443 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/populator/UniqueDatabaseIndexPopulatorTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/populator/UniqueDatabaseIndexPopulatorTest.java @@ -530,13 +530,12 @@ public void sampleIncludedUpdates() throws Exception @Test public void addUpdates() throws Exception { - LabelSchemaDescriptor schemaDescriptor = SchemaDescriptorFactory.forLabel( 1, 1 ); populator = newPopulator(); List updates = Arrays.asList( - IndexEntryUpdate.add( 1, schemaDescriptor, "aaa" ), - IndexEntryUpdate.add( 2, schemaDescriptor, "bbb" ), - IndexEntryUpdate.add( 3, schemaDescriptor, "ccc" ) ); + IndexEntryUpdate.add( 1, descriptor.schema(), "aaa" ), + IndexEntryUpdate.add( 2, descriptor.schema(), "bbb" ), + IndexEntryUpdate.add( 3, descriptor.schema(), "ccc" ) ); populator.add( updates ); @@ -558,8 +557,7 @@ private UniqueLuceneIndexPopulator newPopulator() throws IOException private static void addUpdate( UniqueLuceneIndexPopulator populator, long nodeId, Object value ) throws IOException, IndexEntryConflictException { - NewIndexDescriptor indexDescriptor = NewIndexDescriptorFactory.forLabel( 0, 0 ); - IndexEntryUpdate update = IndexEntryUpdate.add( nodeId, indexDescriptor.schema(), value ); + IndexEntryUpdate update = IndexEntryUpdate.add( nodeId, descriptor.schema(), value ); populator.add( Collections.singletonList( update ) ); } }