diff --git a/community/consistency-check/src/test/java/org/neo4j/consistency/checking/full/FullCheckIntegrationTest.java b/community/consistency-check/src/test/java/org/neo4j/consistency/checking/full/FullCheckIntegrationTest.java index 3165dd88dc96a..49ac18c6c8214 100644 --- a/community/consistency-check/src/test/java/org/neo4j/consistency/checking/full/FullCheckIntegrationTest.java +++ b/community/consistency-check/src/test/java/org/neo4j/consistency/checking/full/FullCheckIntegrationTest.java @@ -415,7 +415,7 @@ public void shouldNotReportIndexInconsistenciesIfIndexIsFailed() throws Exceptio while ( rules.hasNext() ) { IndexRule rule = rules.next(); - IndexDescriptor descriptor = IndexDescriptorFactory.from( rule ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( rule ); IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE; IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() ); IndexPopulator populator = diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/IndexDescriptorCompatibility.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/IndexDescriptorCompatibility.scala index f42f3cb632a3e..e7c5f6ba8c024 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/IndexDescriptorCompatibility.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/IndexDescriptorCompatibility.scala @@ -27,5 +27,5 @@ trait IndexDescriptorCompatibility { new IndexDescriptor(index.getLabelId(), index.getPropertyKeyId); implicit def toNewIndexDescriptor(index: IndexDescriptor): org.neo4j.kernel.api.schema.IndexDescriptor = - IndexDescriptorFactory.from(IndexDescriptorFactory.getNodePropertyDescriptor(index.getLabelId(), index.getPropertyKeyId)); + IndexDescriptorFactory.of(index.getLabelId(), index.getPropertyKeyId); } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundGraphStatistics.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundGraphStatistics.scala index cf484c0ad79d7..6a9789503b3c4 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundGraphStatistics.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundGraphStatistics.scala @@ -35,7 +35,7 @@ object TransactionBoundGraphStatistics { def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = try { - val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) + val indexDescriptor = IndexDescriptorFactory.of( label, property ) val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble // Probability of any node with the given label, to have a property with a given value @@ -51,7 +51,7 @@ object TransactionBoundGraphStatistics { def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = try { - val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) + val indexDescriptor = IndexDescriptorFactory.of( label, property ) val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble // Probability of any node with the given label, to have a given property diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundQueryContext.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundQueryContext.scala index 505281a2b4930..3364698f9b757 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundQueryContext.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundQueryContext.scala @@ -468,7 +468,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper) } def dropIndexRule(labelId: Int, propertyKeyId: Int) = - tc.statement.schemaWriteOperations().indexDrop(IndexDescriptorFactory.from(new NodePropertyDescriptor(labelId, propertyKeyId))) + tc.statement.schemaWriteOperations().indexDrop(IndexDescriptorFactory.of( labelId, propertyKeyId )) def createUniqueConstraint(labelId: Int, propertyKeyId: Int): IdempotentResult[UniquenessConstraint] = try { IdempotentResult(tc.statement.schemaWriteOperations().uniquePropertyConstraintCreate(new NodePropertyDescriptor(labelId, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundGraphStatistics.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundGraphStatistics.scala index 18c715edf55a8..7a95ffd5fe22f 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundGraphStatistics.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundGraphStatistics.scala @@ -24,7 +24,7 @@ import org.neo4j.cypher.internal.compiler.v3_1.spi.{GraphStatistics, StatisticsC import org.neo4j.cypher.internal.frontend.v3_1.{LabelId, NameId, PropertyKeyId, RelTypeId} import org.neo4j.kernel.api.ReadOperations import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException -import org.neo4j.kernel.api.schema.{IndexDescriptorFactory, NodePropertyDescriptor} +import org.neo4j.kernel.api.schema.IndexDescriptorFactory object TransactionBoundGraphStatistics { def apply(ops: ReadOperations) = new StatisticsCompletingGraphStatistics(new BaseTransactionBoundGraphStatistics(ops)) @@ -35,7 +35,7 @@ object TransactionBoundGraphStatistics { def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = try { - val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) + val indexDescriptor = IndexDescriptorFactory.of( label, property ) val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble // Probability of any node with the given label, to have a property with a given value @@ -51,7 +51,7 @@ object TransactionBoundGraphStatistics { def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = try { - val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) + val indexDescriptor = IndexDescriptorFactory.of( label, property ) val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble // Probability of any node with the given label, to have a given property diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundQueryContext.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundQueryContext.scala index e8380bdce74c1..f44bf75812c56 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundQueryContext.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundQueryContext.scala @@ -472,7 +472,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper) } override def dropIndexRule(labelId: Int, propertyKeyId: Int) = - txContext.statement.schemaWriteOperations().indexDrop(IndexDescriptorFactory.from(new NodePropertyDescriptor(labelId, propertyKeyId))) + txContext.statement.schemaWriteOperations().indexDrop(IndexDescriptorFactory.of( labelId, propertyKeyId )) override def createUniqueConstraint(labelId: Int, propertyKeyId: Int): IdempotentResult[UniquenessConstraint] = try { IdempotentResult(txContext.statement.schemaWriteOperations().uniquePropertyConstraintCreate(new NodePropertyDescriptor(labelId, propertyKeyId))) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_2/TransactionBoundGraphStatistics.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_2/TransactionBoundGraphStatistics.scala index 517a65e20294d..7a9f0c50b208c 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_2/TransactionBoundGraphStatistics.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_2/TransactionBoundGraphStatistics.scala @@ -24,7 +24,7 @@ import org.neo4j.cypher.internal.frontend.v3_2.{LabelId, NameId, PropertyKeyId, import org.neo4j.cypher.internal.ir.v3_2.{Cardinality, Selectivity} import org.neo4j.kernel.api.ReadOperations import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException -import org.neo4j.kernel.api.schema.{IndexDescriptorFactory, NodePropertyDescriptor} +import org.neo4j.kernel.api.schema.IndexDescriptorFactory object TransactionBoundGraphStatistics { def apply(ops: ReadOperations) = new StatisticsCompletingGraphStatistics(new BaseTransactionBoundGraphStatistics(ops)) @@ -35,7 +35,7 @@ object TransactionBoundGraphStatistics { def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = try { - val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) + val indexDescriptor = IndexDescriptorFactory.of( label, property ) val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble // Probability of any node with the given label, to have a property with a given value @@ -51,7 +51,7 @@ object TransactionBoundGraphStatistics { def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = try { - val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) + val indexDescriptor = IndexDescriptorFactory.of( label, property ) val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble // Probability of any node with the given label, to have a given property diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_2/TransactionBoundQueryContext.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_2/TransactionBoundQueryContext.scala index 734b51f28623d..d39c6aee7097f 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_2/TransactionBoundQueryContext.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_2/TransactionBoundQueryContext.scala @@ -263,10 +263,10 @@ final class TransactionBoundQueryContext(val transactionalContext: Transactional } implicit private def toKernelIndexDescriptor(descriptor: CypherIndexDescriptor): IndexDescriptor = - IndexDescriptorFactory.from(toNodePropertyDescriptor(descriptor)) + IndexDescriptorFactory.of(toNodePropertyDescriptor(descriptor)) implicit private def toIndexDescriptor(descriptor: NodePropertyDescriptor): IndexDescriptor = - IndexDescriptorFactory.from(descriptor) + IndexDescriptorFactory.of(descriptor) implicit private def toNodePropertyDescriptor(descriptor: CypherIndexDescriptor): NodePropertyDescriptor = if (descriptor.isComposite) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/constraints/NodePropertyConstraint.java b/community/kernel/src/main/java/org/neo4j/kernel/api/constraints/NodePropertyConstraint.java index 228436d4b34d8..72285367adc79 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/api/constraints/NodePropertyConstraint.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/api/constraints/NodePropertyConstraint.java @@ -54,7 +54,7 @@ public boolean matches( NodePropertyDescriptor descriptor ) @Override public IndexDescriptor indexDescriptor() { - return IndexDescriptorFactory.from( descriptor ); + return IndexDescriptorFactory.of( descriptor ); } @Override diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/schema/IndexDescriptorFactory.java b/community/kernel/src/main/java/org/neo4j/kernel/api/schema/IndexDescriptorFactory.java index e0f01cbb64415..e38225dcb9d7c 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/api/schema/IndexDescriptorFactory.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/api/schema/IndexDescriptorFactory.java @@ -34,16 +34,32 @@ */ public class IndexDescriptorFactory { - public static IndexDescriptor from( NodePropertyDescriptor descriptor ) + public static IndexDescriptor of( int labelId, int... propertyKeyIds ) + { + if ( propertyKeyIds.length == 0 ) + { + throw new IllegalArgumentException( "Index descriptors must contain at least one property" ); + } + else if ( propertyKeyIds.length == 1 ) + { + return new SinglePropertyIndexDescriptor( labelId, propertyKeyIds[0] ); + } + else + { + return new CompositeIndexDescriptor( labelId, propertyKeyIds ); + } + } + + public static IndexDescriptor of( NodePropertyDescriptor descriptor ) { return descriptor.isComposite() ? new CompositeIndexDescriptor( descriptor.getLabelId(), descriptor.getPropertyKeyIds() ) : new SinglePropertyIndexDescriptor( descriptor.getLabelId(), descriptor.getPropertyKeyId() ); } - public static IndexDescriptor from( IndexRule rule ) + public static IndexDescriptor of( IndexRule rule ) { - return from( rule.descriptor() ); + return of( rule.descriptor() ); } public static NodePropertyDescriptor getNodePropertyDescriptor( int labelId, int[] propertyKeyIds ) @@ -63,8 +79,7 @@ public static NodePropertyDescriptor getOrCreateTokens( SchemaWriteOperations sc int labelId = schemaWriteOperations.labelGetOrCreateForName( indexDefinition.getLabel().name() ); int[] propertyKeyIds = getOrCreatePropertyKeyIds( schemaWriteOperations, indexDefinition ); - return propertyKeyIds.length > 1 ? new NodeMultiPropertyDescriptor( labelId, propertyKeyIds ) - : new NodePropertyDescriptor( labelId, propertyKeyIds[0] ); + return getNodePropertyDescriptor( labelId, propertyKeyIds ); } public static NodePropertyDescriptor getTokens( ReadOperations readOperations, IndexDefinition indexDefinition ) @@ -72,7 +87,6 @@ public static NodePropertyDescriptor getTokens( ReadOperations readOperations, I int labelId = readOperations.labelGetForName( indexDefinition.getLabel().name() ); int[] propertyKeyIds = getPropertyKeyIds( readOperations, indexDefinition.getPropertyKeys() ); - return propertyKeyIds.length > 1 ? new NodeMultiPropertyDescriptor( labelId, propertyKeyIds ) - : new NodePropertyDescriptor( labelId, propertyKeyIds[0] ); + return getNodePropertyDescriptor( labelId, propertyKeyIds ); } } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/StateHandlingStatementOperations.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/StateHandlingStatementOperations.java index a8d4135c38946..90b8669ef9c58 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/StateHandlingStatementOperations.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/StateHandlingStatementOperations.java @@ -377,7 +377,7 @@ public long relationshipsGetCount( KernelStatement state ) @Override public IndexDescriptor indexCreate( KernelStatement state, NodePropertyDescriptor descriptor ) { - IndexDescriptor indexDescriptor = IndexDescriptorFactory.from(descriptor); + IndexDescriptor indexDescriptor = IndexDescriptorFactory.of(descriptor); state.txState().indexRuleDoAdd( indexDescriptor ); return indexDescriptor; } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexUpdaterMap.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexUpdaterMap.java index bf4496b4c40ff..84c062ff55d01 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexUpdaterMap.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexUpdaterMap.java @@ -31,7 +31,6 @@ import org.neo4j.helpers.collection.Pair; import org.neo4j.helpers.collection.PrefetchingIterator; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; @@ -63,7 +62,7 @@ class IndexUpdaterMap implements AutoCloseable, Iterable List getUpdaters( int labelId, int propertyKeyId ) { - IndexDescriptor key = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ); + IndexDescriptor key = IndexDescriptorFactory.of( labelId, propertyKeyId ); IndexUpdater updater = getUpdater( key ); if ( updater != null ) { diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexingService.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexingService.java index 88a17a2b29fe2..06ca9bfc79e41 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexingService.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexingService.java @@ -196,7 +196,7 @@ public void init() IndexProxy indexProxy; long indexId = indexRule.getId(); - IndexDescriptor descriptor = IndexDescriptorFactory.from( indexRule ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( indexRule ); SchemaIndexProvider.Descriptor providerDescriptor = indexRule.getProviderDescriptor(); SchemaIndexProvider provider = providerMap.apply( providerDescriptor ); InternalIndexState initialState = provider.getInitialState( indexId ); @@ -532,7 +532,7 @@ public void createIndexes( IndexRule... rules ) throws IOException indexMapRef.setIndexMap( indexMap ); continue; } - final IndexDescriptor descriptor = IndexDescriptorFactory.from( rule ); + final IndexDescriptor descriptor = IndexDescriptorFactory.of( rule ); SchemaIndexProvider.Descriptor providerDescriptor = rule.getProviderDescriptor(); boolean constraint = rule.isConstraintIndex(); if ( state == State.RUNNING ) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/CacheLayer.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/CacheLayer.java index 8230b7498fc41..a7eb3df101444 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/CacheLayer.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/CacheLayer.java @@ -105,7 +105,7 @@ private static Iterator toIndexDescriptors( Iterable filteredRules = Iterators.filter( item -> item.getKind() == kind, rules.iterator() ); - return Iterators.map( from -> IndexDescriptorFactory.from( (IndexRule) from ), filteredRules ); + return Iterators.map( from -> IndexDescriptorFactory.of( (IndexRule) from ), filteredRules ); } @Override diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/DiskLayer.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/DiskLayer.java index 34f5af4525980..efbc0fe54a7a4 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/DiskLayer.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/DiskLayer.java @@ -187,7 +187,7 @@ public IndexDescriptor indexGetForLabelAndPropertyKey( NodePropertyDescriptor de private static IndexDescriptor descriptor( IndexRule ruleRecord ) { - return IndexDescriptorFactory.from( ruleRecord ); + return IndexDescriptorFactory.of( ruleRecord ); } @Override diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/SchemaCache.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/SchemaCache.java index 39781d0df6f19..d9afe6244aba5 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/SchemaCache.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/SchemaCache.java @@ -147,7 +147,7 @@ else if ( constraint instanceof RelationshipPropertyConstraint ) else if ( rule instanceof IndexRule ) { IndexRule indexRule = (IndexRule) rule; - IndexDescriptor index = IndexDescriptorFactory.from( indexRule ); + IndexDescriptor index = IndexDescriptorFactory.of( indexRule ); if ( !indexDescriptors.containsKey( index ) ) { indexDescriptors.put( index, new CommittedIndexDescriptor( index, indexRule.getId() ) ); @@ -218,13 +218,13 @@ else if ( rule instanceof RelationshipPropertyConstraintRule ) else if ( rule instanceof IndexRule ) { IndexRule indexRule = (IndexRule) rule; - indexDescriptors.remove( IndexDescriptorFactory.from( indexRule ) ); + indexDescriptors.remove( IndexDescriptorFactory.of( indexRule ) ); } } public IndexDescriptor indexDescriptor( NodePropertyDescriptor descriptor ) { - IndexDescriptor indexDescriptor = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor indexDescriptor = IndexDescriptorFactory.of( descriptor ); return indexDescriptors.containsKey(indexDescriptor) ? indexDescriptor : null; } } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/countStore/CountsSnapshotDeserializer.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/countStore/CountsSnapshotDeserializer.java index 8eb66d1726b0a..2114f72d97c12 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/countStore/CountsSnapshotDeserializer.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/countStore/CountsSnapshotDeserializer.java @@ -69,14 +69,14 @@ public static CountsSnapshot deserialize( ReadableClosableChannel channel ) thro break; case INDEX_SAMPLE: - descriptor = IndexDescriptorFactory.from( readPropertyKeyIds( channel ) ); + descriptor = IndexDescriptorFactory.of( readNodePropertyDescriptor( channel ) ); key = indexSampleKey( descriptor ); value = new long[]{channel.getLong(), channel.getLong()}; map.put( key, value ); break; case INDEX_STATISTICS: - descriptor = IndexDescriptorFactory.from( readPropertyKeyIds( channel ) ); + descriptor = IndexDescriptorFactory.of( readNodePropertyDescriptor( channel ) ); key = indexStatisticsKey( descriptor ); value = new long[]{channel.getLong(), channel.getLong()}; map.put( key, value ); @@ -92,7 +92,7 @@ public static CountsSnapshot deserialize( ReadableClosableChannel channel ) thro return new CountsSnapshot( txid, map ); } - private static NodePropertyDescriptor readPropertyKeyIds( ReadableClosableChannel channel ) throws IOException + private static NodePropertyDescriptor readNodePropertyDescriptor( ReadableClosableChannel channel ) throws IOException { int labelId = channel.getInt(); short length = channel.getShort(); diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/counts/KeyFormat.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/counts/KeyFormat.java index 93b82a95542b7..19b8bd83aac6a 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/store/counts/KeyFormat.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/store/counts/KeyFormat.java @@ -146,10 +146,7 @@ public static CountsKey readKey( ReadableBuffer key ) throws UnknownKey { propertyKeyIds[i] = key.getInt( 10 + 4 * i ); } - NodePropertyDescriptor descriptor = - propertyKeyIds.length > 1 ? new NodeMultiPropertyDescriptor( labelId, propertyKeyIds ) - : new NodePropertyDescriptor( labelId, propertyKeyIds[0] ); - IndexDescriptor index = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor index = IndexDescriptorFactory.of( labelId, propertyKeyIds ); byte indexKeyByte = key.getByte( 10 + 4 * propertyKeyIds.length ); switch ( indexKeyByte ) { diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureArgumentFormatter.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureArgumentFormatter.java index f59b50e64e976..4da3c4964e1d2 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureArgumentFormatter.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureArgumentFormatter.java @@ -89,7 +89,7 @@ else if ( arg instanceof IndexDescriptor ) { NodePropertyDescriptor descriptor = (NodePropertyDescriptor) arg; int labelId = descriptor.getLabelId(); - builder.append( format( "IndexDescriptorFactory.from( new NodePropertyDescriptor( %s, %s ) )", labelId, descriptor.propertyIdText( ) ) ); + builder.append( format( "IndexDescriptorFactory.of( %s, %s )", labelId, descriptor.propertyIdText( ) ) ); } else if ( arg instanceof NodePropertyDescriptor ) { diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureCollector.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureCollector.java index 2affabfeb4266..2b9c44eb55bfd 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureCollector.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureCollector.java @@ -335,7 +335,7 @@ public void putIndex( IndexDescriptor descriptor, String userDescription, double public IndexStatistics getIndex( NodePropertyDescriptor descriptor ) { - return indexMap.get( IndexDescriptorFactory.from( descriptor ) ); + return indexMap.get( IndexDescriptorFactory.of( descriptor ) ); } public Iterator> iterator() diff --git a/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/internal/BatchInserterImpl.java b/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/internal/BatchInserterImpl.java index c6aafe1ffc42b..d6b44f833eaba 100644 --- a/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/internal/BatchInserterImpl.java +++ b/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/internal/BatchInserterImpl.java @@ -478,7 +478,7 @@ private void repopulateAllIndexes() throws IOException, IndexEntryConflictExcept propertyKeyIds[i] = propertyKeyId; IndexDescriptor descriptor = - IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ); + IndexDescriptorFactory.of( labelId, propertyKeyId ); populators[i] = schemaIndexProviders.apply( rule.getProviderDescriptor() ) .getPopulator( rule.getId(), descriptor, diff --git a/community/kernel/src/test/java/org/neo4j/kernel/api/index/IndexProviderCompatibilityTestSuite.java b/community/kernel/src/test/java/org/neo4j/kernel/api/index/IndexProviderCompatibilityTestSuite.java index c7f577bf3a810..2800a41f93edc 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/api/index/IndexProviderCompatibilityTestSuite.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/api/index/IndexProviderCompatibilityTestSuite.java @@ -29,7 +29,6 @@ import org.neo4j.io.fs.FileSystemAbstraction; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.test.rule.TestDirectory; import org.neo4j.test.rule.fs.DefaultFileSystemRule; import org.neo4j.test.runner.ParameterizedSuiteRunner; @@ -64,7 +63,7 @@ public void setup() public abstract static class Compatibility { protected final SchemaIndexProvider indexProvider; - protected IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + protected IndexDescriptor descriptor = IndexDescriptorFactory.of( 1, 2 ); public Compatibility( IndexProviderCompatibilityTestSuite testSuite ) { diff --git a/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/AwaitIndexProcedureTest.java b/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/AwaitIndexProcedureTest.java index 372fa6b204f41..73b7c7c33554f 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/AwaitIndexProcedureTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/AwaitIndexProcedureTest.java @@ -62,7 +62,7 @@ public class AwaitIndexProcedureTest private final IndexProcedures procedure = new IndexProcedures( new StubKernelTransaction( operations ), null ); private final NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 123, 456 ); private final NodePropertyDescriptor anyDescriptor = new NodePropertyDescriptor( 0, 0 ); - private final IndexDescriptor anyIndex = IndexDescriptorFactory.from( anyDescriptor ); + private final IndexDescriptor anyIndex = IndexDescriptorFactory.of( anyDescriptor ); @Test public void shouldThrowAnExceptionIfTheLabelDoesntExist() throws ProcedureException diff --git a/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/BuiltInProceduresTest.java b/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/BuiltInProceduresTest.java index 6db5d440c2b9f..276d165430c63 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/BuiltInProceduresTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/BuiltInProceduresTest.java @@ -222,7 +222,7 @@ private void givenIndex( String label, String propKey ) int labelId = token( label, labels ); int propId = token( propKey, propKeys ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propId ) ); + IndexDescriptor index = IndexDescriptorFactory.of( labelId, propId ); indexes.add( index ); } @@ -231,7 +231,7 @@ private void givenUniqueConstraint( String label, String propKey ) int labelId = token( label, labels ); int propId = token( propKey, propKeys ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propId ) ); + IndexDescriptor index = IndexDescriptorFactory.of( labelId, propId ); uniqueIndexes.add( index ); constraints.add( new UniquenessConstraint( index.descriptor() ) ); } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/ResampleIndexProcedureTest.java b/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/ResampleIndexProcedureTest.java index d28a27e50f575..8b1e0668ed2c2 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/ResampleIndexProcedureTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/ResampleIndexProcedureTest.java @@ -85,7 +85,7 @@ public void shouldThrowAnExceptionIfThePropertyKeyDoesntExist() throws Procedure public void shouldLookUpTheIndexByLabelIdAndPropertyKeyId() throws ProcedureException, SchemaRuleNotFoundException, IndexNotFoundKernelException { - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 0 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 0, 0 ); when( operations.labelGetForName( anyString() ) ).thenReturn( 123 ); when( operations.propertyKeyGetForName( anyString() ) ).thenReturn( 456 ); when( operations.indexGetForLabelAndPropertyKey( anyObject() ) ).thenReturn( index ); @@ -120,7 +120,7 @@ public void shouldThrowAnExceptionIfTheIndexDoesNotExist() @Test public void shouldTriggerResampling() throws SchemaRuleNotFoundException, ProcedureException { - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 123, 456 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 123, 456 ); when( operations.indexGetForLabelAndPropertyKey( anyObject() ) ).thenReturn( index ); procedure.resampleIndex( ":Person(name)" ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/DataIntegrityValidatingStatementOperationsTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/DataIntegrityValidatingStatementOperationsTest.java index 8d8fcab60ed74..f055e809eb67e 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/DataIntegrityValidatingStatementOperationsTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/DataIntegrityValidatingStatementOperationsTest.java @@ -57,12 +57,13 @@ public class DataIntegrityValidatingStatementOperationsTest @Rule public ExpectedException exception = ExpectedException.none(); + NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 0, 7 ); + @Test public void shouldDisallowReAddingIndex() throws Exception { // GIVEN - NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 0, 7 ); - IndexDescriptor rule = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor rule = IndexDescriptorFactory.of( descriptor ); SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = @@ -88,8 +89,7 @@ public void shouldDisallowReAddingIndex() throws Exception public void shouldDisallowAddingIndexWhenConstraintIndexExists() throws Exception { // GIVEN - NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 0, 7 ); - IndexDescriptor rule = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor rule = IndexDescriptorFactory.of( descriptor ); SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = @@ -116,8 +116,7 @@ public void shouldDisallowAddingIndexWhenConstraintIndexExists() throws Exceptio public void shouldDisallowDroppingIndexThatDoesNotExist() throws Exception { // GIVEN - NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 0, 7 ); - IndexDescriptor indexDescriptor = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor indexDescriptor = IndexDescriptorFactory.of( descriptor ); SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = @@ -144,8 +143,7 @@ public void shouldDisallowDroppingIndexThatDoesNotExist() throws Exception public void shouldDisallowDroppingIndexWhenConstraintIndexExists() throws Exception { // GIVEN - NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 0, 7 ); - IndexDescriptor indexDescriptor = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor indexDescriptor = IndexDescriptorFactory.of( descriptor ); SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = @@ -173,8 +171,7 @@ public void shouldDisallowDroppingIndexWhenConstraintIndexExists() throws Except public void shouldDisallowDroppingConstraintIndexThatDoesNotExists() throws Exception { // GIVEN - NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 0, 7 ); - IndexDescriptor indexDescriptor = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor indexDescriptor = IndexDescriptorFactory.of( descriptor ); SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = @@ -202,8 +199,7 @@ public void shouldDisallowDroppingConstraintIndexThatDoesNotExists() throws Exce public void shouldDisallowDroppingConstraintIndexThatIsReallyJustRegularIndex() throws Exception { // GIVEN - NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 0, 7 ); - IndexDescriptor indexDescriptor = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor indexDescriptor = IndexDescriptorFactory.of( descriptor ); SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/LockingStatementOperationsTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/LockingStatementOperationsTest.java index 2c7d1c05e489f..6559dc48d3647 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/LockingStatementOperationsTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/LockingStatementOperationsTest.java @@ -49,16 +49,12 @@ import org.neo4j.kernel.impl.api.operations.SchemaStateOperations; import org.neo4j.kernel.impl.api.operations.SchemaWriteOperations; import org.neo4j.kernel.impl.api.state.TxState; -import org.neo4j.kernel.impl.api.store.RelationshipIterator; -import org.neo4j.kernel.impl.api.store.StoreSingleNodeCursor; import org.neo4j.kernel.impl.factory.CanWrite; import org.neo4j.kernel.impl.locking.LockTracer; import org.neo4j.kernel.impl.locking.Locks; import org.neo4j.kernel.impl.locking.ResourceTypes; import org.neo4j.kernel.impl.locking.SimpleStatementLocks; import org.neo4j.kernel.impl.proc.Procedures; -import org.neo4j.storageengine.api.Direction; -import org.neo4j.storageengine.api.NodeItem; import org.neo4j.storageengine.api.StorageStatement; import static org.junit.Assert.assertSame; @@ -227,7 +223,7 @@ public void shouldAcquireSchemaWriteLockBeforeAddingIndexRule() throws Exception public void shouldAcquireSchemaWriteLockBeforeRemovingIndexRule() throws Exception { // given - IndexDescriptor rule = IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 0 ) ); + IndexDescriptor rule = IndexDescriptorFactory.of( 0, 0 ); // when lockingOps.indexDrop( state, rule ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/OperationsFacadeTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/OperationsFacadeTest.java index 29d516320a61e..53459234122ad 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/OperationsFacadeTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/OperationsFacadeTest.java @@ -84,7 +84,7 @@ public void testThrowExceptionWhenDuplicateUniqueIndexFound() throws SchemaRuleNotFoundException, DuplicateIndexSchemaRuleException { SchemaReadOperations readOperations = setupSchemaReadOperations(); - IndexDescriptor index = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor index = IndexDescriptorFactory.of( descriptor ); Mockito.when( readOperations .uniqueIndexesGetForLabel( Mockito.any( KernelStatement.class ), Mockito.eq( descriptor.getLabelId() ) ) ) .thenReturn( Iterators.iterator( index, index ) ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/constraints/ConstraintIndexCreatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/constraints/ConstraintIndexCreatorTest.java index c08663ff25080..fa76eac901035 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/constraints/ConstraintIndexCreatorTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/constraints/ConstraintIndexCreatorTest.java @@ -72,7 +72,7 @@ public void shouldCreateIndexInAnotherTransaction() throws Exception StatementOperationParts constraintCreationContext = mockedParts(); StatementOperationParts indexCreationContext = mockedParts(); - IndexDescriptor index = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor index = IndexDescriptorFactory.of( descriptor ); KernelStatement state = mockedState(); IndexingService indexingService = mock( IndexingService.class ); @@ -105,7 +105,7 @@ public void shouldDropIndexIfPopulationFails() throws Exception StatementOperationParts constraintCreationContext = mockedParts(); KernelStatement state = mockedState(); - IndexDescriptor index = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor index = IndexDescriptorFactory.of( descriptor ); IndexingService indexingService = mock( IndexingService.class ); StubKernel kernel = new StubKernel(); @@ -135,12 +135,12 @@ public void shouldDropIndexIfPopulationFails() throws Exception } assertEquals( 2, kernel.statements.size() ); TransactionState tx1 = kernel.statements.get( 0 ).txState(); - verify( tx1 ).constraintIndexRuleDoAdd( IndexDescriptorFactory.from( new NodePropertyDescriptor( 123, 456 ) ) ); + verify( tx1 ).constraintIndexRuleDoAdd( IndexDescriptorFactory.of( 123, 456 ) ); verifyNoMoreInteractions( tx1 ); verify( constraintCreationContext.schemaReadOperations() ).indexGetCommittedId( state, index, CONSTRAINT ); verifyNoMoreInteractions( constraintCreationContext.schemaReadOperations() ); TransactionState tx2 = kernel.statements.get( 1 ).txState(); - verify( tx2 ).constraintIndexDoDrop( IndexDescriptorFactory.from( new NodePropertyDescriptor( 123, 456 ) ) ); + verify( tx2 ).constraintIndexDoDrop( IndexDescriptorFactory.of( 123, 456 ) ); verifyNoMoreInteractions( tx2 ); } @@ -151,7 +151,7 @@ public void shouldDropIndexInAnotherTransaction() throws Exception StubKernel kernel = new StubKernel(); IndexingService indexingService = mock( IndexingService.class ); - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 123, 456 ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( 123, 456 ); ConstraintIndexCreator creator = new ConstraintIndexCreator( () -> kernel, indexingService ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/BatchingMultipleIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/BatchingMultipleIndexPopulatorTest.java index a5e2c4bf63a27..e332ebabf2596 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/BatchingMultipleIndexPopulatorTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/BatchingMultipleIndexPopulatorTest.java @@ -29,7 +29,6 @@ import java.util.concurrent.TimeUnit; import org.neo4j.helpers.collection.Visitor; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException; import org.neo4j.kernel.api.index.IndexConfiguration; import org.neo4j.kernel.api.schema.IndexDescriptor; @@ -292,7 +291,7 @@ public void populatorMarkedAsFailedAndUpdatesNotAdded() throws Exception private static IndexPopulator addPopulator( BatchingMultipleIndexPopulator batchingPopulator, int id ) { IndexPopulator populator = mock( IndexPopulator.class ); - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( id, id ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( id, id ); IndexProxyFactory indexProxyFactory = mock( IndexProxyFactory.class ); FailedIndexProxyFactory failedIndexProxyFactory = mock( FailedIndexProxyFactory.class ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/FailedIndexProxyTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/FailedIndexProxyTest.java index 1e2026a48461a..0551707274c6a 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/FailedIndexProxyTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/FailedIndexProxyTest.java @@ -23,7 +23,6 @@ import java.io.IOException; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.index.IndexConfiguration; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; @@ -39,7 +38,7 @@ public class FailedIndexProxyTest { - private final IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + private final IndexDescriptor descriptor = IndexDescriptorFactory.of( 1, 2 ); private final IndexConfiguration config = IndexConfiguration.NON_UNIQUE; private final SchemaIndexProvider.Descriptor providerDescriptor = mock( SchemaIndexProvider.Descriptor.class ); private final String userDescription = "description"; @@ -70,7 +69,7 @@ public void shouldLogReasonForDroppingIndex() throws IOException AssertableLogProvider logProvider = new AssertableLogProvider(); // when - new FailedIndexProxy( IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 0 ) ), config, + new FailedIndexProxy( IndexDescriptorFactory.of( 0, 0 ), config, new SchemaIndexProvider.Descriptor( "foo", "bar" ), "foo", mock( IndexPopulator.class ), IndexPopulationFailure.failure( "it broke" ), indexCountsRemover, logProvider ).drop(); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexPopulationJobTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexPopulationJobTest.java index 86053f716175e..5b2a3aebcabf2 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexPopulationJobTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexPopulationJobTest.java @@ -67,6 +67,7 @@ import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; import org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl; import org.neo4j.kernel.impl.coreapi.schema.InternalSchemaActions; +import org.neo4j.kernel.impl.coreapi.schema.PropertyNameUtils; import org.neo4j.kernel.internal.GraphDatabaseAPI; import org.neo4j.logging.AssertableLogProvider; import org.neo4j.logging.AssertableLogProvider.LogMatcherBuilder; @@ -686,7 +687,7 @@ private IndexDescriptor indexDescriptor( Label label, String propertyKey ) throw IndexDefinition indexDefinition = new IndexDefinitionImpl( actions, label, propertyKey, false ); NodePropertyDescriptor descriptor = IndexDescriptorFactory.getTokens( statement.readOperations(), indexDefinition ); - IndexDescriptor index = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor index = IndexDescriptorFactory.of( descriptor ); tx.success(); return index; } @@ -700,7 +701,7 @@ private DoubleLongRegister indexUpdatesAndSize( Label label, String propertyKey int labelId = statement.readOperations().labelGetForName( label.name() ); int propertyKeyId = statement.readOperations().propertyKeyGetForName( propertyKey ); DoubleLongRegister result = - statement.readOperations().indexUpdatesAndSize( IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ), + statement.readOperations().indexUpdatesAndSize( IndexDescriptorFactory.of( labelId, propertyKeyId ), Registers.newDoubleLongRegister() ); tx.success(); return result; @@ -715,7 +716,7 @@ private DoubleLongRegister indexSample( Label label, String propertyKey ) throws DoubleLongRegister result = Registers.newDoubleLongRegister(); int labelId = statement.readOperations().labelGetForName( label.name() ); int propertyKeyId = statement.readOperations().propertyKeyGetForName( propertyKey ); - statement.readOperations().indexSample( IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ), result ); + statement.readOperations().indexSample( IndexDescriptorFactory.of( labelId, propertyKeyId ), result ); tx.success(); return result; } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexStatisticsIT.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexStatisticsIT.java index 0e712675d94c3..9bfec390d17e8 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexStatisticsIT.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexStatisticsIT.java @@ -97,8 +97,7 @@ public void shouldRecoverIndexCountsBySamplingThemOnStartup() awaitIndexOnline( indexAliensBySpecimen() ); // where ALIEN and SPECIMEN are both the first ids of their kind - IndexDescriptor index = - IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId( ALIEN ), pkId( SPECIMEN ) ) ); + IndexDescriptor index = IndexDescriptorFactory.of( labelId( ALIEN ), pkId( SPECIMEN ) ); // for which we don't have index counts resetIndexCounts( index ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexUpdaterMapTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexUpdaterMapTest.java index 01962064f4b47..da5dca54212ba 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexUpdaterMapTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexUpdaterMapTest.java @@ -61,13 +61,13 @@ public void before() throws IOException indexMap = new IndexMap(); indexProxy1 = mock( IndexProxy.class ); - indexDescriptor1 = IndexDescriptorFactory.from( new NodePropertyDescriptor( 2, 3 ) ); + indexDescriptor1 = IndexDescriptorFactory.of( 2, 3 ); indexUpdater1 = mock( IndexUpdater.class ); when( indexProxy1.getDescriptor() ).thenReturn( indexDescriptor1 ); when( indexProxy1.newUpdater( any( IndexUpdateMode.class ) ) ).thenReturn( indexUpdater1 ); indexProxy2 = mock( IndexProxy.class ); - indexDescriptor2 = IndexDescriptorFactory.from( new NodePropertyDescriptor( 5, 6 ) ); + indexDescriptor2 = IndexDescriptorFactory.of( 5, 6 ); IndexUpdater indexUpdater2 = mock( IndexUpdater.class ); when( indexProxy2.getDescriptor() ).thenReturn( indexDescriptor2 ); when( indexProxy2.newUpdater( any( IndexUpdateMode.class ) ) ).thenReturn( indexUpdater2 ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexingServiceTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexingServiceTest.java index bd11d3b4a3498..6fc16f90d6758 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexingServiceTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexingServiceTest.java @@ -523,7 +523,7 @@ public void shouldLogTriggerSamplingOnAnIndexes() throws Exception // given IndexingService indexingService = newIndexingServiceWithMockedDependencies( populator, accessor, withData() ); IndexSamplingMode mode = TRIGGER_REBUILD_ALL; - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 1 ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( 0, 1 ); // when indexingService.triggerIndexSampling( descriptor, mode ); @@ -841,11 +841,11 @@ public void shouldCreateMultipleIndexesInOneCall() throws Exception indexing.createIndexes( indexRule1, indexRule2, indexRule3 ); // THEN - verify( indexProvider ).getPopulator( eq( 0L ), eq( IndexDescriptorFactory.from(descriptor1) ), + verify( indexProvider ).getPopulator( eq( 0L ), eq( IndexDescriptorFactory.of(descriptor1) ), eq( IndexConfiguration.NON_UNIQUE ), any( IndexSamplingConfig.class ) ); - verify( indexProvider ).getPopulator( eq( 1L ), eq( IndexDescriptorFactory.from(descriptor2) ), + verify( indexProvider ).getPopulator( eq( 1L ), eq( IndexDescriptorFactory.of(descriptor2) ), eq( IndexConfiguration.NON_UNIQUE ), any( IndexSamplingConfig.class ) ); - verify( indexProvider ).getPopulator( eq( 2L ), eq( IndexDescriptorFactory.from(descriptor3) ), + verify( indexProvider ).getPopulator( eq( 2L ), eq( IndexDescriptorFactory.of(descriptor3) ), eq( IndexConfiguration.NON_UNIQUE ), any( IndexSamplingConfig.class ) ); waitForIndexesToComeOnline( indexing, 0, 1, 2 ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/MultipleIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/MultipleIndexPopulatorTest.java index ea236f2c04d29..a584fb73164f1 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/MultipleIndexPopulatorTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/MultipleIndexPopulatorTest.java @@ -32,7 +32,6 @@ import java.util.function.IntPredicate; import org.neo4j.helpers.collection.Visitor; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; import org.neo4j.kernel.api.index.IndexConfiguration; import org.neo4j.kernel.api.schema.IndexDescriptor; @@ -160,8 +159,8 @@ public void testFailPopulator() throws IOException @Test public void testFailByPopulation() throws IOException { - IndexDescriptor descriptor1 = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ); - IndexDescriptor descriptor2 = IndexDescriptorFactory.from( new NodePropertyDescriptor( 2, 2 ) ); + IndexDescriptor descriptor1 = IndexDescriptorFactory.of( 1, 1 ); + IndexDescriptor descriptor2 = IndexDescriptorFactory.of( 2, 2 ); IndexPopulator populator1 = createIndexPopulator(); IndexPopulator populator2 = createIndexPopulator(); @@ -178,8 +177,8 @@ public void testFailByPopulation() throws IOException @Test public void testFailByPopulationRemovesPopulator() throws IOException { - IndexDescriptor descriptor1 = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ); - IndexDescriptor descriptor2 = IndexDescriptorFactory.from( new NodePropertyDescriptor( 2, 2 ) ); + IndexDescriptor descriptor1 = IndexDescriptorFactory.of( 1, 1 ); + IndexDescriptor descriptor2 = IndexDescriptorFactory.of( 2, 2 ); IndexPopulator populator1 = createIndexPopulator(); IndexPopulator populator2 = createIndexPopulator(); @@ -198,7 +197,7 @@ public void testFailByPopulationRemovesPopulator() throws IOException @Test public void testFailByNonExistingPopulation() throws IOException { - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( 1, 1 ); IndexPopulation nonExistingPopulation = mock( IndexPopulation.class ); IndexPopulator populator = createIndexPopulator(); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/MultipleIndexPopulatorUpdatesTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/MultipleIndexPopulatorUpdatesTest.java index 73d26788c9d82..747b8d496b667 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/MultipleIndexPopulatorUpdatesTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/MultipleIndexPopulatorUpdatesTest.java @@ -33,7 +33,6 @@ import java.util.function.IntPredicate; import org.neo4j.helpers.collection.Visitor; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; import org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException; import org.neo4j.kernel.api.index.IndexConfiguration; @@ -113,7 +112,7 @@ public void updateForHigherNodeIgnoredWhenUsingFullNodeStoreScan() IndexUpdater indexUpdater = mock( IndexUpdater.class ); when( populator.newPopulatingUpdater( storeView ) ).thenReturn( indexUpdater ); - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( 1, 1 ); addPopulator( indexPopulator, populator, descriptor ); indexPopulator.create(); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/OnlineIndexProxyTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/OnlineIndexProxyTest.java index b7b9b428755fc..1530b2c159920 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/OnlineIndexProxyTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/OnlineIndexProxyTest.java @@ -23,7 +23,6 @@ import java.io.IOException; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.index.IndexAccessor; import org.neo4j.kernel.api.index.IndexConfiguration; import org.neo4j.kernel.api.schema.IndexDescriptor; @@ -36,7 +35,7 @@ public class OnlineIndexProxyTest { - private final IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + private final IndexDescriptor descriptor = IndexDescriptorFactory.of( 1, 2 ); private final IndexConfiguration config = IndexConfiguration.NON_UNIQUE; private final SchemaIndexProvider.Descriptor providerDescriptor = mock( SchemaIndexProvider.Descriptor.class ); private final IndexAccessor accessor = mock( IndexAccessor.class ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/IndexSamplingControllerTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/IndexSamplingControllerTest.java index 9d2941dad775c..25482850ff0e5 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/IndexSamplingControllerTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/IndexSamplingControllerTest.java @@ -364,8 +364,8 @@ public void shouldNotStartForSingleIndexAJobIfTheTrackerCannotHandleIt() { when( samplingConfig.backgroundSampling() ).thenReturn( true ); when( samplingConfig.jobLimit() ).thenReturn( 1 ); - when( indexProxy.getDescriptor() ).thenReturn( IndexDescriptorFactory.from(descriptor) ); - when( anotherIndexProxy.getDescriptor() ).thenReturn( IndexDescriptorFactory.from(anotherDescriptor) ); + when( indexProxy.getDescriptor() ).thenReturn( IndexDescriptorFactory.of( descriptor ) ); + when( anotherIndexProxy.getDescriptor() ).thenReturn( IndexDescriptorFactory.of( anotherDescriptor ) ); when( snapshotProvider.indexMapSnapshot() ).thenReturn( indexMap ); when( jobFactory.create( indexProxy ) ).thenReturn( job ); when( jobFactory.create( anotherIndexProxy ) ).thenReturn( anotherJob ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/IndexSamplingJobTrackerTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/IndexSamplingJobTrackerTest.java index a459ed28b0a56..d113cc8ffdb20 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/IndexSamplingJobTrackerTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/IndexSamplingJobTrackerTest.java @@ -50,9 +50,9 @@ public class IndexSamplingJobTrackerTest NodePropertyDescriptor descriptor11 = new NodePropertyDescriptor( 1, 1 ); NodePropertyDescriptor descriptor12 = new NodePropertyDescriptor( 1, 2 ); NodePropertyDescriptor descriptor22 = new NodePropertyDescriptor( 2, 2 ); - IndexDescriptor index11 = IndexDescriptorFactory.from( descriptor11 ); - IndexDescriptor index12 = IndexDescriptorFactory.from( descriptor12 ); - IndexDescriptor index22 = IndexDescriptorFactory.from( descriptor22 ); + IndexDescriptor index11 = IndexDescriptorFactory.of( descriptor11 ); + IndexDescriptor index12 = IndexDescriptorFactory.of( descriptor12 ); + IndexDescriptor index22 = IndexDescriptorFactory.of( descriptor22 ); @Test public void shouldNotRunASampleJobWhichIsAlreadyRunning() throws Throwable @@ -181,7 +181,7 @@ public void shouldAcceptNewJobWhenRunningJobFinishes() throws Throwable @Override public IndexDescriptor descriptor() { - return IndexDescriptorFactory.from( descriptor11 ); + return IndexDescriptorFactory.of( descriptor11 ); } @Override diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/OnlineIndexSamplingJobTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/OnlineIndexSamplingJobTest.java index 34a63043b4dd5..f855f42abd736 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/OnlineIndexSamplingJobTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/sampling/OnlineIndexSamplingJobTest.java @@ -76,7 +76,7 @@ public void shouldSampleTheIndexButDoNotStoreTheValuesIfTheIndexIsNotOnline() private final LogProvider logProvider = NullLogProvider.getInstance(); private final IndexProxy indexProxy = mock( IndexProxy.class ); private final IndexStoreView indexStoreView = mock( IndexStoreView.class ); - private final IndexDescriptor indexDescriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + private final IndexDescriptor indexDescriptor = IndexDescriptorFactory.of( 1, 2 ); private final IndexReader indexReader = mock( IndexReader.class ); private final IndexSampler indexSampler = mock( IndexSampler.class ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/operations/ConstraintEnforcingEntityOperationsTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/operations/ConstraintEnforcingEntityOperationsTest.java index 77291512d3a07..cabf2a4fcd297 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/operations/ConstraintEnforcingEntityOperationsTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/operations/ConstraintEnforcingEntityOperationsTest.java @@ -49,7 +49,7 @@ public class ConstraintEnforcingEntityOperationsTest private final int propertyKeyId = 2; private final String value = "value"; private final IndexDescriptor indexDescriptor = - IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ); + IndexDescriptorFactory.of( labelId, propertyKeyId ); private EntityReadOperations readOps; private KernelStatement state; private Locks.Client locks; diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/IndexQueryTransactionStateTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/IndexQueryTransactionStateTest.java index b29ad60b6eb9b..03ec915cde57b 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/IndexQueryTransactionStateTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/IndexQueryTransactionStateTest.java @@ -72,7 +72,7 @@ public class IndexQueryTransactionStateTest int propertyKeyId = 3; String value = "My Value"; NodePropertyDescriptor descriptor = new NodePropertyDescriptor( labelId, propertyKeyId ); - IndexDescriptor indexDescriptor = IndexDescriptorFactory.from( descriptor ); + IndexDescriptor indexDescriptor = IndexDescriptorFactory.of( descriptor ); private StoreReadLayer store; private StoreStatement statement; @@ -95,8 +95,7 @@ public void before() throws Exception .emptyList() ) ); when( store.indexesGetAll() ).then( answerAsIteratorFrom( Collections.emptyList() ) ); when( store.constraintsGetForLabel( labelId ) ).thenReturn( Collections.emptyIterator() ); - when( store.indexGetForLabelAndPropertyKey( descriptor ) ) - .thenReturn( IndexDescriptorFactory.from( descriptor ) ); + when( store.indexGetForLabelAndPropertyKey( descriptor ) ).thenReturn( indexDescriptor ); statement = mock( StoreStatement.class ); when( state.getStoreStatement() ).thenReturn( statement ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/LabelTransactionStateTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/LabelTransactionStateTest.java index eee0efb38f8f1..1f9e04cfd95d2 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/LabelTransactionStateTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/LabelTransactionStateTest.java @@ -37,7 +37,6 @@ import org.neo4j.kernel.api.exceptions.EntityNotFoundException; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.txstate.TransactionState; import org.neo4j.kernel.impl.api.KernelStatement; import org.neo4j.kernel.impl.api.StateHandlingStatementOperations; @@ -171,7 +170,7 @@ public void addedLabelsShouldBeReflectedWhenGettingNodesForLabel() throws Except // WHEN List indexes = Collections.singletonList( - IndexDescriptorFactory.from( new NodePropertyDescriptor( 2, 2 ) ) ); + IndexDescriptorFactory.of( 2, 2 ) ); when( store.indexesGetForLabel( 2 ) ).thenReturn( indexes.iterator() ); txContext.nodeAddLabel( state, 2, 2 ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/SchemaTransactionStateTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/SchemaTransactionStateTest.java index 25017fd14d7d5..cfe4d3e59760a 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/SchemaTransactionStateTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/SchemaTransactionStateTest.java @@ -155,7 +155,7 @@ public void shouldReturnNonExistentRuleAddedInTransaction() throws Exception Iterator labelRules = txContext.indexesGetForLabel( state, labelId1 ); // THEN - IndexDescriptor expectedRule = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId1, key1 ) ); + IndexDescriptor expectedRule = IndexDescriptorFactory.of( labelId1, key1 ); assertEquals(expectedRule, rule); assertEquals( asSet( expectedRule ), asSet( labelRules ) ); } @@ -165,10 +165,10 @@ public void shouldReturnNonExistentRuleAddedInTransactionFromLookup() throws Exc { // GIVEN // -- the store already have an index on the label and a different property - IndexDescriptor existingRule1 = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId1, key1 ) ); + IndexDescriptor existingRule1 = IndexDescriptorFactory.of( labelId1, key1 ); when( indexGetForLabelAndPropertyKey( store, labelId1, key1 ) ).thenReturn( existingRule1 ); // -- the store already have an index on a different label with the same property - IndexDescriptor existingRule2 = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId2, key2 ) ); + IndexDescriptor existingRule2 = IndexDescriptorFactory.of( labelId2, key2 ); when( indexGetForLabelAndPropertyKey( store, labelId2, key2 ) ).thenReturn( existingRule2 ); // -- a non-existent rule has been added in the transaction indexCreate( txContext, state, labelId1, key2 ); @@ -177,7 +177,7 @@ public void shouldReturnNonExistentRuleAddedInTransactionFromLookup() throws Exc IndexDescriptor rule = indexGetForLabelAndPropertyKey( txContext, state, labelId1, key2 ); // THEN - assertEquals( IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId1, key2 ) ), rule ); + assertEquals( IndexDescriptorFactory.of( labelId1, key2 ), rule ); } @Test @@ -185,10 +185,10 @@ public void shouldNotReturnRulesAddedInTransactionWithDifferentLabelOrPropertyFr { // GIVEN // -- the store already have an index on the label and a different property - IndexDescriptor existingRule1 = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId1, key1 ) ); + IndexDescriptor existingRule1 = IndexDescriptorFactory.of( labelId1, key1 ); when( indexGetForLabelAndPropertyKey( store,labelId1, key1) ).thenReturn( existingRule1 ); // -- the store already have an index on a different label with the same property - IndexDescriptor existingRule2 = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId2, key2 ) ); + IndexDescriptor existingRule2 = IndexDescriptorFactory.of( labelId2, key2 ); when( indexGetForLabelAndPropertyKey( store, labelId2, key2 ) ).thenReturn( existingRule2 ); // -- a non-existent rule has been added in the transaction indexCreate( txContext, state, labelId1, key2 ); @@ -207,7 +207,7 @@ public void shouldNotReturnExistentRuleDroppedInTransaction() throws Exception { // GIVEN // -- a rule that exists in the store - IndexDescriptor rule = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId1, key1 ) ); + IndexDescriptor rule = IndexDescriptorFactory.of( labelId1, key1 ); when( store.indexesGetForLabel( labelId1 ) ).thenReturn( option( rule ).iterator() ); // -- that same rule dropped in the transaction txContext.indexDrop( state, rule ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/StateHandlingStatementOperationsTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/StateHandlingStatementOperationsTest.java index 327adf13c15a3..eb9122a46fe0e 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/StateHandlingStatementOperationsTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/StateHandlingStatementOperationsTest.java @@ -41,13 +41,11 @@ import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.api.txstate.TransactionState; -import org.neo4j.kernel.impl.api.IndexReaderFactory; import org.neo4j.kernel.impl.api.KernelStatement; import org.neo4j.kernel.impl.api.StateHandlingStatementOperations; import org.neo4j.kernel.impl.api.legacyindex.InternalAutoIndexing; import org.neo4j.kernel.impl.api.store.StoreStatement; import org.neo4j.kernel.impl.index.LegacyIndexStore; -import org.neo4j.kernel.impl.locking.ReentrantLockService; import org.neo4j.kernel.impl.util.Cursors; import org.neo4j.kernel.impl.util.diffsets.DiffSets; import org.neo4j.storageengine.api.LabelItem; @@ -55,7 +53,6 @@ import org.neo4j.storageengine.api.StorageStatement; import org.neo4j.storageengine.api.StoreReadLayer; import org.neo4j.storageengine.api.schema.IndexReader; -import org.neo4j.storageengine.api.schema.LabelScanReader; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; @@ -72,7 +69,6 @@ import static org.neo4j.kernel.impl.api.StatementOperationsTestHelper.mockedState; import static org.neo4j.kernel.impl.api.state.StubCursors.asNodeCursor; import static org.neo4j.kernel.impl.api.state.StubCursors.asPropertyCursor; -import static org.neo4j.test.MockedNeoStores.basicMockedNeoStores; public class StateHandlingStatementOperationsTest { @@ -96,7 +92,7 @@ public void shouldNeverDelegateWrites() throws Exception when( state.txState() ).thenReturn( new TxState() ); StoreStatement storeStatement = mock( StoreStatement.class ); when( state.getStoreStatement() ).thenReturn( storeStatement ); - Iterator indexesIterator = Collections.singletonList( IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 0 ) ) ).iterator(); + Iterator indexesIterator = Collections.singletonList( IndexDescriptorFactory.of( 0, 0 ) ).iterator(); when( inner.indexesGetForLabel( 0 ) ).thenReturn( indexesIterator ); when( storeStatement.acquireSingleNodeCursor( anyLong() ) ). thenReturn( asNodeCursor( 0 ) ); @@ -107,7 +103,7 @@ public void shouldNeverDelegateWrites() throws Exception NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 0, 0 ); ctx.indexCreate( state, descriptor ); ctx.nodeAddLabel( state, 0, 0 ); - ctx.indexDrop( state, IndexDescriptorFactory.from( descriptor ) ); + ctx.indexDrop( state, IndexDescriptorFactory.of( descriptor ) ); ctx.nodeRemoveLabel( state, 0, 0 ); // one for add and one for remove @@ -216,7 +212,7 @@ public void shouldConsiderTransactionStateDuringIndexScan() throws Exception KernelStatement statement = mock( KernelStatement.class ); when( statement.hasTxStateWithChanges() ).thenReturn( true ); when( statement.txState() ).thenReturn( txState ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, 2 ); when( txState.indexUpdatesForScanOrSeek( index, null ) ).thenReturn( new DiffSets<>( Collections.singleton( 42L ), Collections.singleton( 44L ) ) ); @@ -247,7 +243,7 @@ public void shouldConsiderTransactionStateDuringIndexSeek() throws Exception KernelStatement statement = mock( KernelStatement.class ); when( statement.hasTxStateWithChanges() ).thenReturn( true ); when( statement.txState() ).thenReturn( txState ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, 2 ); when( txState.indexUpdatesForScanOrSeek( index, "value" ) ).thenReturn( new DiffSets<>( Collections.singleton( 42L ), Collections.singleton( 44L ) ) ); @@ -277,7 +273,7 @@ public void shouldConsiderTransactionStateDuringIndexRangeSeekByPrefix() throws KernelStatement statement = mock( KernelStatement.class ); when( statement.hasTxStateWithChanges() ).thenReturn( true ); when( statement.txState() ).thenReturn( txState ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, 2 ); when( txState.indexUpdatesForRangeSeekByPrefix( index, "prefix" ) ).thenReturn( new DiffSets<>( Collections.singleton( 42L ), Collections.singleton( 44L ) ) ); @@ -315,7 +311,7 @@ public void shouldConsiderTransactionStateDuringIndexBetweenRangeSeekByNumber() when( statement.txState() ).thenReturn( txState ); StorageStatement storageStatement = mock( StorageStatement.class ); when( statement.getStoreStatement() ).thenReturn( storageStatement ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, propertyKey ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, propertyKey ); when( txState.indexUpdatesForRangeSeekByNumber( index, lower, true, upper, false ) ).thenReturn( new DiffSets<>( Collections.singleton( 42L ), Collections.singleton( 44L ) ) ); @@ -369,7 +365,7 @@ public void shouldConsiderTransactionStateDuringIndexBetweenRangeSeekByString() KernelStatement statement = mock( KernelStatement.class ); when( statement.hasTxStateWithChanges() ).thenReturn( true ); when( statement.txState() ).thenReturn( txState ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, 2 ); when( txState.indexUpdatesForRangeSeekByString( index, "Anne", true, "Bill", false ) ).thenReturn( new DiffSets<>( Collections.singleton( 42L ), Collections.singleton( 44L ) ) ); @@ -405,7 +401,7 @@ public void nodeGetFromUniqueIndexSeekClosesIndexReader() throws Exception StateHandlingStatementOperations operations = newTxStateOps( mock( StoreReadLayer.class ) ); - operations.nodeGetFromUniqueIndexSeek( kernelStatement, IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ), "foo" ); + operations.nodeGetFromUniqueIndexSeek( kernelStatement, IndexDescriptorFactory.of( 1, 1 ), "foo" ); verify( indexReader ).close(); } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/TxStateTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/TxStateTest.java index 1bf43143b3cb3..ac194a788f31f 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/TxStateTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/state/TxStateTest.java @@ -1707,9 +1707,9 @@ protected boolean fetchNext() private final NodePropertyDescriptor descriptorOn_1_1 = new NodePropertyDescriptor( 2, 3 ); private final NodePropertyDescriptor descriptorOn_1_2 = new NodePropertyDescriptor( 2, 4 ); private final NodePropertyDescriptor descriptorOn_2_1 = new NodePropertyDescriptor( 3, 3 ); - private final IndexDescriptor indexOn_1_1 = IndexDescriptorFactory.from( descriptorOn_1_1 ); - private final IndexDescriptor indexOn_1_2 = IndexDescriptorFactory.from( descriptorOn_1_2 ); - private final IndexDescriptor indexOn_2_1 = IndexDescriptorFactory.from( descriptorOn_2_1 ); + private final IndexDescriptor indexOn_1_1 = IndexDescriptorFactory.of( descriptorOn_1_1 ); + private final IndexDescriptor indexOn_1_2 = IndexDescriptorFactory.of( descriptorOn_1_2 ); + private final IndexDescriptor indexOn_2_1 = IndexDescriptorFactory.of( descriptorOn_2_1 ); private TransactionState state; diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/CountsStoreMapGenerator.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/CountsStoreMapGenerator.java index cfaf416adb2a2..9a168de67c17a 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/CountsStoreMapGenerator.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/CountsStoreMapGenerator.java @@ -22,7 +22,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.impl.store.counts.keys.CountsKey; @@ -63,7 +62,7 @@ private static void addIndexSampleKeys( int num, Map map ) { for ( int i = 0; i < num; i++ ) { - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( i, i ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( i, i ); map.put( CountsKeyFactory.indexSampleKey( descriptor ), new long[]{i, i} ); } } @@ -72,7 +71,7 @@ private static void addIndexStatisticsKeys( int num, Map map ) { for ( int i = 0; i < num; i++ ) { - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( i, i ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( i, i ); map.put( CountsKeyFactory.indexStatisticsKey( descriptor ), new long[]{i, i} ); } } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/InMemoryCountsStoreCountsSnapshotSerializerTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/InMemoryCountsStoreCountsSnapshotSerializerTest.java index 8b86dcb105469..0564641dbd269 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/InMemoryCountsStoreCountsSnapshotSerializerTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/InMemoryCountsStoreCountsSnapshotSerializerTest.java @@ -29,7 +29,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.impl.store.counts.keys.CountsKey; @@ -249,7 +248,7 @@ public static IndexStatisticsKey indexStatisticsKey( int labelId, int propertyKe private static IndexDescriptor indexFor( int labelId, int propertyKeyId ) { - return IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ); + return IndexDescriptorFactory.of( labelId, propertyKeyId ); } private void initializeBuffers( int serializedLength ) diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/InMemoryCountsStoreSnapshotDeserializerTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/InMemoryCountsStoreSnapshotDeserializerTest.java index 121b109878bf1..7e3d4bd309f3c 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/InMemoryCountsStoreSnapshotDeserializerTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/countStore/InMemoryCountsStoreSnapshotDeserializerTest.java @@ -29,7 +29,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.impl.store.counts.keys.CountsKey; @@ -165,7 +164,7 @@ public void correctlyDeserializeIndexSample() throws IOException logChannel.putInt( 1 ); logChannel.putLong( 1 ); logChannel.putLong( 1 ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, 1 ); //WHEN IndexSampleKey expectedNode = CountsKeyFactory.indexSampleKey( index ); @@ -189,7 +188,7 @@ public void correctlyDeserializeIndexStatistics() throws IOException logChannel.putInt( 1 ); logChannel.putLong( 1 ); logChannel.putLong( 1 ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, 1 ); //WHEN IndexStatisticsKey expectedNode = CountsKeyFactory.indexStatisticsKey( index ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/counts/CountsTrackerTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/counts/CountsTrackerTest.java index c3c9e663a9b5a..ac6f2fb24acb2 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/counts/CountsTrackerTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/counts/CountsTrackerTest.java @@ -28,7 +28,6 @@ import org.neo4j.function.IOFunction; import org.neo4j.function.ThrowingFunction; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.configuration.Config; @@ -79,7 +78,7 @@ public void shouldBeAbleToWriteDataToCountsTracker() throws Exception { // given CountsTracker tracker = resourceManager.managed( newTracker() ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, 1 ); CountsOracle oracle = new CountsOracle(); { CountsOracle.Node a = oracle.node( 1 ); @@ -275,7 +274,7 @@ public void shouldRotateOnDataChangesEvenIfTransactionIsUnchanged() throws Excep File before = tracker.currentFile(); try ( CountsAccessor.IndexStatsUpdater updater = tracker.updateIndexCounts() ) { - updater.incrementIndexUpdates( IndexDescriptorFactory.from( new NodePropertyDescriptor( 7, 8 ) ), 100 ); + updater.incrementIndexUpdates( IndexDescriptorFactory.of( 7, 8 ), 100 ); } // when @@ -368,7 +367,7 @@ private CountsOracle someData() oracle.relationship( n1, 1, n3 ); oracle.relationship( n1, 1, n2 ); oracle.relationship( n0, 1, n3 ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); + IndexDescriptor index = IndexDescriptorFactory.of( 1, 2 ); oracle.indexUpdatesAndSize( index, 0L, 50L ); oracle.indexSampling( index, 25L, 50L ); return oracle; diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/command/IndexWorkSyncTransactionApplicationStressIT.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/command/IndexWorkSyncTransactionApplicationStressIT.java index ff8eaff2d201d..e714bb0b13b8e 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/command/IndexWorkSyncTransactionApplicationStressIT.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/command/IndexWorkSyncTransactionApplicationStressIT.java @@ -99,7 +99,7 @@ public void shouldApplyIndexUpdatesInWorkSyncedBatches() throws Exception Dependencies dependencies = new Dependencies(); storageEngine.satisfyDependencies( dependencies ); IndexProxy index = dependencies.resolveDependency( IndexingService.class ) - .getIndexProxy( IndexDescriptorFactory.from( descriptor ) ); + .getIndexProxy( IndexDescriptorFactory.of( descriptor ) ); awaitOnline( index ); // WHEN diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/CineastsDbStructure.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/CineastsDbStructure.java index 90a4d242c6579..3fcfe53fc1fa5 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/CineastsDbStructure.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/CineastsDbStructure.java @@ -78,11 +78,11 @@ public void accept( DbStructureVisitor visitor ) visitor.visitRelationshipType( 2, "ACTS_IN" ); visitor.visitRelationshipType( 3, "RATED" ); visitor.visitRelationshipType( 4, "ROOT" ); - visitor.visitIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 9 ) ), ":Movie(title)", 1.0d, 12462L ); - visitor.visitIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 5 ) ), ":Person(name)", 1.0d, 49845L ); - visitor.visitIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 3, 5 ) ), ":Actor(name)", 1.0d, 44689L ); - visitor.visitIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 4, 5 ) ), ":Director(name)", 1.0d, 6010L ); - visitor.visitUniqueIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 2, 3 ) ), ":User(login)", 1.0d, 45L ); + visitor.visitIndex( IndexDescriptorFactory.of( 0, 9 ), ":Movie(title)", 1.0d, 12462L ); + visitor.visitIndex( IndexDescriptorFactory.of( 1, 5 ), ":Person(name)", 1.0d, 49845L ); + visitor.visitIndex( IndexDescriptorFactory.of( 3, 5 ), ":Actor(name)", 1.0d, 44689L ); + visitor.visitIndex( IndexDescriptorFactory.of( 4, 5 ), ":Director(name)", 1.0d, 6010L ); + visitor.visitUniqueIndex( IndexDescriptorFactory.of( 2, 3 ), ":User(login)", 1.0d, 45L ); visitor.visitUniqueConstraint( new UniquenessConstraint( new NodePropertyDescriptor( 2, 3 ) ), "CONSTRAINT ON ( user:User ) ASSERT user.login IS UNIQUE" ); visitor.visitAllNodesCount( 63042L ); visitor.visitNodeCount( 0, "Movie", 12862L ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureArgumentFormatterTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureArgumentFormatterTest.java index d2f7180057059..c157740333866 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureArgumentFormatterTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureArgumentFormatterTest.java @@ -66,7 +66,7 @@ public void shouldFormatDoubles() public void shouldFormatIndexDescriptors() { assertEquals( "IndexDescriptorFactory.from( new NodePropertyDescriptor( 23, 42 ) )", - formatArgument( IndexDescriptorFactory.from( new NodePropertyDescriptor( 23, 42 ) ) ) ); + formatArgument( IndexDescriptorFactory.of( 23, 42 ) ) ); } @Test diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureCollectorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureCollectorTest.java index 4494049dce385..4162afbcb5532 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureCollectorTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureCollectorTest.java @@ -43,9 +43,9 @@ public void collectsDbStructure() collector.visitPropertyKey( 2, "income" ); collector.visitRelationshipType( 1, "LIVES_IN" ); collector.visitRelationshipType( 2, "FRIEND" ); - collector.visitUniqueIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ), ":Person(name)", 1.0d, 1L ); + collector.visitUniqueIndex( IndexDescriptorFactory.of( 1, 1 ), ":Person(name)", 1.0d, 1L ); collector.visitUniqueConstraint( new UniquenessConstraint( new NodePropertyDescriptor( 2, 1 ) ), ":Person(name)" ); - collector.visitIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 2, 2 ) ), ":City(income)", 0.2d, 1L ); + collector.visitIndex( IndexDescriptorFactory.of( 2, 2 ), ":City(income)", 0.2d, 1L ); collector.visitAllNodesCount( 50 ); collector.visitNodeCount( 1, "Person", 20 ); collector.visitNodeCount( 2, "City", 30 ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureInvocationTracingAcceptanceTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureInvocationTracingAcceptanceTest.java index 11fd599b825e3..7c827b24e1b5d 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureInvocationTracingAcceptanceTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/DbStructureInvocationTracingAcceptanceTest.java @@ -131,8 +131,8 @@ private void exerciseVisitor( Function visitor ) visitor.apply( null ).visitPropertyKey( 1, "age" ); visitor.apply( null ).visitRelationshipType( 0, "ACCEPTS" ); visitor.apply( null ).visitRelationshipType( 1, "REJECTS" ); - visitor.apply( null ).visitIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 1 ) ), ":Person(age)", 0.5d, 1L ); - visitor.apply( null ).visitUniqueIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 0 ) ), ":Person(name)", 0.5d, 1L ); + visitor.apply( null ).visitIndex( IndexDescriptorFactory.of( 0, 1 ), ":Person(age)", 0.5d, 1L ); + visitor.apply( null ).visitUniqueIndex( IndexDescriptorFactory.of( 0, 0 ), ":Person(name)", 0.5d, 1L ); visitor.apply( null ).visitUniqueConstraint( new UniquenessConstraint( new NodePropertyDescriptor( 1, 0) ), ":Party(name)" ); visitor.apply( null ).visitAllNodesCount( 55 ); visitor.apply( null ).visitNodeCount( 0, "Person", 50 ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuideTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuideTest.java index 6055e92c1d558..69069d2d70c00 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuideTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuideTest.java @@ -141,7 +141,7 @@ public void visitsUniqueConstraintsAndIndices() throws Exception commitAndReOpen(); UniquenessConstraint constraint = createUniqueConstraint( labelId, pkId ); - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, pkId ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( labelId, pkId ); // WHEN accept( visitor ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/QMULDbStructure.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/QMULDbStructure.java index 5717da16243d8..af900c59a9635 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/QMULDbStructure.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/QMULDbStructure.java @@ -20,7 +20,6 @@ package org.neo4j.kernel.impl.util.dbstructure; import org.neo4j.helpers.collection.Visitable; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; // @@ -61,7 +60,7 @@ public void accept( DbStructureVisitor visitor ) visitor.visitPropertyKey( 16, "location_lat" ); visitor.visitRelationshipType( 0, "friends" ); visitor.visitRelationshipType( 1, "FRIEND" ); - visitor.visitIndex( IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ), ":Person(uid)", 1.0d, 135164L ); + visitor.visitIndex( IndexDescriptorFactory.of( 1, 2 ), ":Person(uid)", 1.0d, 135164L ); visitor.visitAllNodesCount( 135242L ); visitor.visitNodeCount( 1, "Person", 135213L ); visitor.visitRelCount( -1, -1, -1, "MATCH ()-[]->() RETURN count(*)", 4537616L ); diff --git a/community/lucene-index/src/test/java/org/neo4j/concurrencytest/ConstraintIndexConcurrencyTest.java b/community/lucene-index/src/test/java/org/neo4j/concurrencytest/ConstraintIndexConcurrencyTest.java index cedbec702c8d6..7882b5fd46059 100644 --- a/community/lucene-index/src/test/java/org/neo4j/concurrencytest/ConstraintIndexConcurrencyTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/concurrencytest/ConstraintIndexConcurrencyTest.java @@ -26,7 +26,6 @@ import org.neo4j.graphdb.Label; import org.neo4j.graphdb.Transaction; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.Statement; import org.neo4j.kernel.api.exceptions.schema.UniquePropertyConstraintViolationKernelException; import org.neo4j.kernel.api.schema.IndexDescriptor; @@ -76,7 +75,7 @@ public void shouldNotAllowConcurrentViolationOfConstraint() throws Exception Statement statement = statementSupplier.get(); int labelId = statement.readOperations().labelGetForName( label.name() ); int propertyKeyId = statement.readOperations().propertyKeyGetForName( propertyKey ); - IndexDescriptor index = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ); + IndexDescriptor index = IndexDescriptorFactory.of( labelId, propertyKeyId ); statement.readOperations().nodesGetFromIndexSeek( index, "The value is irrelevant, we just want to perform some sort of lookup against this index" ); diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexPopulatorTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexPopulatorTest.java index 1ca25a8dbe555..2d678d6d708a4 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexPopulatorTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexPopulatorTest.java @@ -36,7 +36,6 @@ import java.util.HashSet; import java.util.Set; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; import org.neo4j.kernel.api.impl.index.storage.DirectoryFactory; import org.neo4j.kernel.api.index.IndexConfiguration; @@ -86,7 +85,7 @@ public void before() throws Exception new DirectoryFactory.UncloseableDirectory( directory ) ); provider = new LuceneSchemaIndexProvider( fs.get(), directoryFactory, testDir.directory( "folder" ), NullLogProvider.getInstance(), Config.empty(), OperationalMode.single ); - indexDescriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 42, propertyKeyId ) ); + indexDescriptor = IndexDescriptorFactory.of( 42, propertyKeyId ); indexStoreView = mock( IndexStoreView.class ); IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE; IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() ); diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexProviderTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexProviderTest.java index 623354e385652..749dd763ce052 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexProviderTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/schema/LuceneSchemaIndexProviderTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import org.neo4j.graphdb.factory.GraphDatabaseSettings; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.impl.index.storage.DirectoryFactory; import org.neo4j.kernel.api.index.IndexAccessor; import org.neo4j.kernel.api.index.IndexConfiguration; @@ -61,7 +60,7 @@ public void shouldFailToInvokePopulatorInReadOnlyMode() throws Exception new DirectoryFactory.InMemoryDirectoryFactory() ); expectedException.expect( UnsupportedOperationException.class ); - readOnlyIndexProvider.getPopulator( 1L, IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 1 ) ), + readOnlyIndexProvider.getPopulator( 1L, IndexDescriptorFactory.of( 1, 1 ), IndexConfiguration.NON_UNIQUE, new IndexSamplingConfig( readOnlyConfig ) ); } 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 1bfc874e81018..9084748adfb11 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 @@ -34,7 +34,6 @@ import org.neo4j.collection.primitive.PrimitiveLongCollections; import org.neo4j.io.IOUtils; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; import org.neo4j.kernel.api.impl.index.storage.DirectoryFactory; import org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage; @@ -80,8 +79,7 @@ public class UniqueDatabaseIndexPopulatorTest private static final String INDEX_IDENTIFIER = "42"; private final DirectoryFactory directoryFactory = new DirectoryFactory.InMemoryDirectoryFactory(); - private final IndexDescriptor descriptor = IndexDescriptorFactory - .from( new NodePropertyDescriptor( LABEL_ID, PROPERTY_KEY_ID ) ); + private final IndexDescriptor descriptor = IndexDescriptorFactory.of( LABEL_ID, PROPERTY_KEY_ID ); private final PropertyAccessor propertyAccessor = mock( PropertyAccessor.class ); diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/impl/api/index/IndexingServiceIntegrationTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/impl/api/index/IndexingServiceIntegrationTest.java index 45da43e7ac7d3..3c3af8b306619 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/impl/api/index/IndexingServiceIntegrationTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/impl/api/index/IndexingServiceIntegrationTest.java @@ -119,10 +119,10 @@ public void testSchemaIndexMatchIndexingService() throws IndexNotFoundKernelExce int weatherLabelId = labelTokenHolder.getIdByName( WEATHER_LABEL ); int propertyId = propertyKeyTokenHolder.getIdByName( PROPERTY_NAME ); - NodePropertyDescriptor clothesDescriptor = new NodePropertyDescriptor( clothedLabelId, propertyId ); - NodePropertyDescriptor weatherDescriptor = new NodePropertyDescriptor( weatherLabelId, propertyId ); - IndexProxy clothesIndex = indexingService.getIndexProxy( IndexDescriptorFactory.from( clothesDescriptor ) ); - IndexProxy weatherIndex = indexingService.getIndexProxy( IndexDescriptorFactory.from( weatherDescriptor ) ); + IndexProxy clothesIndex = + indexingService.getIndexProxy( IndexDescriptorFactory.of( clothedLabelId, propertyId ) ); + IndexProxy weatherIndex = + indexingService.getIndexProxy( IndexDescriptorFactory.of( weatherLabelId, propertyId ) ); assertEquals( InternalIndexState.ONLINE, clothesIndex.getState()); assertEquals( InternalIndexState.ONLINE, weatherIndex.getState()); } diff --git a/community/neo4j/src/test/java/org/neo4j/index/IndexSamplingIntegrationTest.java b/community/neo4j/src/test/java/org/neo4j/index/IndexSamplingIntegrationTest.java index 85d45b251ce45..a7df1407cf4e2 100644 --- a/community/neo4j/src/test/java/org/neo4j/index/IndexSamplingIntegrationTest.java +++ b/community/neo4j/src/test/java/org/neo4j/index/IndexSamplingIntegrationTest.java @@ -30,7 +30,6 @@ import org.neo4j.graphdb.Transaction; import org.neo4j.graphdb.schema.IndexDefinition; import org.neo4j.io.fs.FileUtils; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine; @@ -192,7 +191,7 @@ private DoubleLongRegister fetchIndexSamplingValues( GraphDatabaseService db ) GraphDatabaseAPI api = (GraphDatabaseAPI) db; CountsTracker countsTracker = api.getDependencyResolver().resolveDependency( RecordStorageEngine.class ) .testAccessNeoStores().getCounts(); - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 0 ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( 0, 0 ); IndexSampleKey key = CountsKeyFactory.indexSampleKey( descriptor ); // cheating a bit... return countsTracker.get( key, Registers.newDoubleLongRegister() ); } @@ -215,7 +214,7 @@ private DoubleLongRegister fetchIndexSizeValues( GraphDatabaseService db ) GraphDatabaseAPI api = (GraphDatabaseAPI) db; CountsTracker countsTracker = api.getDependencyResolver().resolveDependency( RecordStorageEngine.class ) .testAccessNeoStores().getCounts(); - IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 0, 0 ) ); + IndexDescriptor descriptor = IndexDescriptorFactory.of( 0, 0 ); IndexStatisticsKey key = CountsKeyFactory.indexStatisticsKey( descriptor ); // cheating a bit... return countsTracker.get( key, Registers.newDoubleLongRegister() ); } diff --git a/community/neo4j/src/test/java/schema/IndexPopulationFlipRaceIT.java b/community/neo4j/src/test/java/schema/IndexPopulationFlipRaceIT.java index 1c63cd09e06a6..f219cd98d7892 100644 --- a/community/neo4j/src/test/java/schema/IndexPopulationFlipRaceIT.java +++ b/community/neo4j/src/test/java/schema/IndexPopulationFlipRaceIT.java @@ -28,7 +28,6 @@ import org.neo4j.helpers.collection.Pair; import org.neo4j.kernel.api.KernelAPI; import org.neo4j.kernel.api.KernelTransaction; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.Statement; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; @@ -145,8 +144,8 @@ private void verifyThatThereAreExactlyOneIndexEntryPerNodeInTheIndexes( int i, P int keyAId = statement.readOperations().propertyKeyGetForName( keyA( i ) ); int labelBId = statement.readOperations().labelGetForName( labelB( i ).name() ); int keyBId = statement.readOperations().propertyKeyGetForName( keyB( i ) ); - IndexDescriptor indexA = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelAId, keyAId ) ); - IndexDescriptor indexB = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelBId, keyBId ) ); + IndexDescriptor indexA = IndexDescriptorFactory.of( labelAId, keyAId ); + IndexDescriptor indexB = IndexDescriptorFactory.of( labelBId, keyBId ); for ( int j = 0; j < NODES_PER_INDEX; j++ ) { diff --git a/community/neo4j/src/test/java/schema/MultiIndexPopulationConcurrentUpdatesIT.java b/community/neo4j/src/test/java/schema/MultiIndexPopulationConcurrentUpdatesIT.java index 81119995cd5d7..2f6e9bfdcdea2 100644 --- a/community/neo4j/src/test/java/schema/MultiIndexPopulationConcurrentUpdatesIT.java +++ b/community/neo4j/src/test/java/schema/MultiIndexPopulationConcurrentUpdatesIT.java @@ -210,8 +210,7 @@ public void applyConcurrentChangesToPopulatedIndex() throws Exception private IndexReader getIndexReader( int propertyId, Integer countryLabelId ) throws IndexNotFoundKernelException { - return indexService.getIndexProxy( IndexDescriptorFactory - .from( new NodePropertyDescriptor( countryLabelId, propertyId ) ) ).newReader(); + return indexService.getIndexProxy( IndexDescriptorFactory.of( countryLabelId, propertyId ) ).newReader(); } private void launchCustomIndexPopulation( Map labelNameIdMap, int propertyId, @@ -278,7 +277,7 @@ private void waitIndexOnline( IndexingService indexService, int propertyId, int throws IndexNotFoundKernelException, IndexPopulationFailedKernelException, InterruptedException, IndexActivationFailedKernelException { - IndexProxy indexProxy = indexService.getIndexProxy( IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyId ) ) ); + IndexProxy indexProxy = indexService.getIndexProxy( IndexDescriptorFactory.of( labelId, propertyId ) ); indexProxy.awaitStoreScanCompleted(); indexProxy.activate(); } diff --git a/community/shell/src/main/java/org/neo4j/shell/kernel/apps/Schema.java b/community/shell/src/main/java/org/neo4j/shell/kernel/apps/Schema.java index 54287a8792975..62b240fad37ea 100644 --- a/community/shell/src/main/java/org/neo4j/shell/kernel/apps/Schema.java +++ b/community/shell/src/main/java/org/neo4j/shell/kernel/apps/Schema.java @@ -194,8 +194,7 @@ private void sampleIndexes( Label[] labels, String property, boolean sampleAll, throw new ShellException( "No property associated with '" + property + "' was found" ); } - indexingService.triggerIndexSampling( IndexDescriptorFactory - .from( new NodePropertyDescriptor( labelKey, propertyKey ) ), samplingMode ); + indexingService.triggerIndexSampling( IndexDescriptorFactory.of( labelKey, propertyKey ), samplingMode ); } private IndexSamplingMode getSamplingMode( boolean forceSample ) diff --git a/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/api/integrationtest/UniquenessConstraintCreationIT.java b/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/api/integrationtest/UniquenessConstraintCreationIT.java index d3ac1215e45ee..33a3aaedb00f7 100644 --- a/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/api/integrationtest/UniquenessConstraintCreationIT.java +++ b/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/api/integrationtest/UniquenessConstraintCreationIT.java @@ -181,7 +181,7 @@ public void shouldCreateAnIndexToGoAlongWithAUniquePropertyConstraint() throws E // then { ReadOperations statement = readOperationsInNewTransaction(); - assertEquals( asSet( IndexDescriptorFactory.from( descriptor ) ), + assertEquals( asSet( IndexDescriptorFactory.of( descriptor ) ), asSet( statement.uniqueIndexesGetAll() ) ); } } @@ -193,7 +193,7 @@ public void shouldDropCreatedConstraintIndexWhenRollingBackConstraintCreation() { SchemaWriteOperations statement = schemaWriteOperationsInNewTransaction(); statement.uniquePropertyConstraintCreate( descriptor ); - assertEquals( asSet( IndexDescriptorFactory.from( descriptor ) ), + assertEquals( asSet( IndexDescriptorFactory.of( descriptor ) ), asSet( statement.uniqueIndexesGetAll() ) ); } @@ -278,7 +278,7 @@ public void shouldDropConstraintIndexWhenDroppingConstraint() throws Exception { SchemaWriteOperations statement = schemaWriteOperationsInNewTransaction(); constraint = statement.uniquePropertyConstraintCreate( descriptor ); - assertEquals( asSet( IndexDescriptorFactory.from( descriptor ) ), + assertEquals( asSet( IndexDescriptorFactory.of( descriptor ) ), asSet( statement.uniqueIndexesGetAll() ) ); commit(); } diff --git a/enterprise/management/src/main/java/org/neo4j/management/impl/IndexSamplingManagerBean.java b/enterprise/management/src/main/java/org/neo4j/management/impl/IndexSamplingManagerBean.java index a4e08ea69db96..8a220c1145e68 100644 --- a/enterprise/management/src/main/java/org/neo4j/management/impl/IndexSamplingManagerBean.java +++ b/enterprise/management/src/main/java/org/neo4j/management/impl/IndexSamplingManagerBean.java @@ -127,8 +127,7 @@ public void triggerIndexSampling( String labelKey, String propertyKey, boolean f throw new IllegalArgumentException( "No property or label key was found associated with " + propertyKey + " and " + labelKey ); } - NodePropertyDescriptor descriptor = new NodePropertyDescriptor( labelKeyId, propertyKeyId ); - state.indexingService.triggerIndexSampling( IndexDescriptorFactory.from( descriptor ), + state.indexingService.triggerIndexSampling( IndexDescriptorFactory.of( labelKeyId, propertyKeyId ), getIndexSamplingMode( forceSample ) ); } diff --git a/enterprise/management/src/test/java/org/neo4j/management/impl/IndexSamplingManagerBeanTest.java b/enterprise/management/src/test/java/org/neo4j/management/impl/IndexSamplingManagerBeanTest.java index 3a83c52123742..4d62360f35bfb 100644 --- a/enterprise/management/src/test/java/org/neo4j/management/impl/IndexSamplingManagerBeanTest.java +++ b/enterprise/management/src/test/java/org/neo4j/management/impl/IndexSamplingManagerBeanTest.java @@ -24,7 +24,6 @@ import org.neo4j.graphdb.DependencyResolver; import org.neo4j.kernel.NeoStoreDataSource; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.impl.api.index.IndexingService; import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingMode; @@ -75,7 +74,7 @@ public void samplingTriggeredWhenIdsArePresent() storeAccess.triggerIndexSampling( EXISTING_LABEL, EXISTING_PROPERTY, false ); // Then - verify( indexingService, times( 1 ) ).triggerIndexSampling( IndexDescriptorFactory.from( new NodePropertyDescriptor( LABEL_ID, PROPERTY_ID ) ) , + verify( indexingService, times( 1 ) ).triggerIndexSampling( IndexDescriptorFactory.of( LABEL_ID, PROPERTY_ID ) , IndexSamplingMode.TRIGGER_REBUILD_UPDATED); } @@ -90,8 +89,7 @@ public void forceSamplingTriggeredWhenIdsArePresent() storeAccess.triggerIndexSampling( EXISTING_LABEL, EXISTING_PROPERTY, true ); // Then - verify( indexingService, times( 1 ) ).triggerIndexSampling( IndexDescriptorFactory - .from( new NodePropertyDescriptor( LABEL_ID, PROPERTY_ID ) ) , + verify( indexingService, times( 1 ) ).triggerIndexSampling( IndexDescriptorFactory.of( LABEL_ID, PROPERTY_ID ) , IndexSamplingMode.TRIGGER_REBUILD_ALL); } diff --git a/tools/src/test/java/org/neo4j/tools/dump/DumpCountsStoreTest.java b/tools/src/test/java/org/neo4j/tools/dump/DumpCountsStoreTest.java index bc461b84d9efc..0a6fbc2889c66 100644 --- a/tools/src/test/java/org/neo4j/tools/dump/DumpCountsStoreTest.java +++ b/tools/src/test/java/org/neo4j/tools/dump/DumpCountsStoreTest.java @@ -27,7 +27,6 @@ import java.util.Collections; import java.util.List; -import org.neo4j.kernel.api.schema.NodePropertyDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.impl.core.RelationshipTypeToken; @@ -67,7 +66,7 @@ public class DumpCountsStoreTest private static final String INDEX_PROPERTY = "indexProperty"; private static final IndexDescriptor descriptor = - IndexDescriptorFactory.from( new NodePropertyDescriptor( INDEX_LABEL_ID, INDEX_PROPERTY_KEY_ID ) ); + IndexDescriptorFactory.of( INDEX_LABEL_ID, INDEX_PROPERTY_KEY_ID ); @Rule public SuppressOutput suppressOutput = SuppressOutput.suppressAll();