use of org.neo4j.internal.kernel.api.InternalIndexState in project neo4j by neo4j.
the class IndexProviderTests method shouldReportInitialStateAsPopulatingIfPopulationStartedButIncomplete.
@Test
void shouldReportInitialStateAsPopulatingIfPopulationStartedButIncomplete() throws IOException {
// given
provider = newProvider();
IndexPopulator populator = provider.getPopulator(descriptor(), samplingConfig(), heapBufferFactory(1024), INSTANCE, tokenNameLookup);
populator.create();
// when
InternalIndexState state = provider.getInitialState(descriptor(), NULL);
// then
assertEquals(InternalIndexState.POPULATING, state);
populator.close(true, NULL);
}
use of org.neo4j.internal.kernel.api.InternalIndexState 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.kernel.api.InternalIndexState 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());
}
use of org.neo4j.internal.kernel.api.InternalIndexState in project neo4j by neo4j.
the class SchemaStatementProcedureTest method schemaStatementsShouldHandleIndexWithBackticks.
@Test
void schemaStatementsShouldHandleIndexWithBackticks() throws IndexNotFoundKernelException, ProcedureException, LabelNotFoundKernelException, PropertyKeyIdNotFoundKernelException {
IndexDescriptor index = forSchema(forLabel(1, 1)).withName(NAME_WITH_BACKTICKS).materialise(1);
InternalIndexState internalIndexState = InternalIndexState.ONLINE;
SchemaReadCore schemaReadCore = getSchemaReadCore(index, internalIndexState);
TokenRead tokenRead = mock(TokenRead.class);
when(tokenRead.nodeLabelName(1)).thenReturn(LABEL_WITH_BACKTICKS);
when(tokenRead.propertyKeyName(1)).thenReturn(PROPERTY_KEY_WITH_BACKTICKS);
Collection<BuiltInProcedures.SchemaStatementResult> result = createSchemaStatementResults(schemaReadCore, tokenRead);
Iterator<BuiltInProcedures.SchemaStatementResult> iter = result.iterator();
assertTrue(iter.hasNext());
BuiltInProcedures.SchemaStatementResult next = iter.next();
assertEquals(NAME_WITH_BACKTICKS, next.name);
assertEquals(format("CALL db.createIndex('%s', ['%s'], ['%s'], 'Undecided-0', {})", NAME_WITH_BACKTICKS, LABEL_WITH_BACKTICKS, PROPERTY_KEY_WITH_BACKTICKS), next.createStatement);
assertEquals(format("DROP INDEX %s", ESCAPED_NAME_WITH_BACKTICKS), next.dropStatement);
assertFalse(iter.hasNext());
}
use of org.neo4j.internal.kernel.api.InternalIndexState in project neo4j by neo4j.
the class SchemaStatementProcedureTest method schemaStatementsMustNotIncludeFailedIndexes.
@Test
void schemaStatementsMustNotIncludeFailedIndexes() throws IndexNotFoundKernelException, ProcedureException {
IndexDescriptor index = someIndex();
InternalIndexState indexState = InternalIndexState.FAILED;
SchemaReadCore schemaReadCore = getSchemaReadCore(index, indexState);
TokenRead tokenRead = mock(TokenRead.class);
Collection<BuiltInProcedures.SchemaStatementResult> result = createSchemaStatementResults(schemaReadCore, tokenRead);
assertEquals(0, result.size());
}
Aggregations