use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class BuiltInProceduresTest method givenUniqueConstraint.
private void givenUniqueConstraint(String label, String propKey) {
int labelId = token(label, labels);
int propId = token(propKey, propKeys);
LabelSchemaDescriptor schema = forLabel(labelId, propId);
int id = uniqueIndexes.size() + 1000;
final String name = "constraint_" + id;
IndexDescriptor index = IndexPrototype.uniqueForSchema(schema, EMPTY.getProviderDescriptor()).withName(name).materialise(id);
uniqueIndexes.add(index);
final UniquenessConstraintDescriptor constraint = ConstraintDescriptorFactory.uniqueForLabel(labelId, propId).withName(name);
constraints.add(constraint);
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class ResampleIndexProcedureTest method shouldLookUpTheCompositeIndexByName.
@Test
void shouldLookUpTheCompositeIndexByName() throws ProcedureException {
IndexDescriptor index = IndexPrototype.forSchema(forLabel(0, 0, 1)).withName("index_42").materialise(42);
when(schemaRead.indexGetForName(anyString())).thenReturn(index);
procedure.resampleIndex("index_42");
verify(schemaRead).indexGetForName("index_42");
verifyNoMoreInteractions(schemaRead);
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class ResampleIndexProcedureTest method shouldLookUpTheIndexByName.
@Test
void shouldLookUpTheIndexByName() throws ProcedureException {
IndexDescriptor index = IndexPrototype.forSchema(forLabel(0, 0)).withName("index_42").materialise(42);
when(schemaRead.indexGetForName(anyString())).thenReturn(index);
procedure.resampleIndex("index_42");
verify(schemaRead).indexGetForName("index_42");
verifyNoMoreInteractions(schemaRead);
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class SchemaStatementProcedureTest method schemaStatementsMustNotIncludeIndexBackedConstraintsWithFailedIndexIndex.
@Test
void schemaStatementsMustNotIncludeIndexBackedConstraintsWithFailedIndexIndex() throws IndexNotFoundKernelException, ProcedureException {
IndexDescriptor index = someOrphanedIndex();
ConstraintDescriptor constraint = indexBackedConstraint(index);
index = indexBoundToConstraint(index, constraint);
InternalIndexState internalIndexState = InternalIndexState.FAILED;
SchemaReadCore schemaReadCore = getSchemaReadCore(constraint, index, internalIndexState);
TokenRead tokenRead = mock(TokenRead.class);
Collection<BuiltInProcedures.SchemaStatementResult> result = createSchemaStatementResults(schemaReadCore, tokenRead);
assertEquals(0, result.size());
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class SchemaStatementProcedureTest method schemaStatementsMustNotIncludeOrphanedIndexes.
@Test
void schemaStatementsMustNotIncludeOrphanedIndexes() throws IndexNotFoundKernelException, ProcedureException {
IndexDescriptor index = someOrphanedIndex();
InternalIndexState indexState = InternalIndexState.ONLINE;
SchemaReadCore schemaReadCore = getSchemaReadCore(index, indexState);
TokenRead tokenRead = mock(TokenRead.class);
Collection<BuiltInProcedures.SchemaStatementResult> result = createSchemaStatementResults(schemaReadCore, tokenRead);
assertEquals(0, result.size());
}
Aggregations