use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class LuceneSchemaIndexCorruptionTest method shouldRequestIndexPopulationIfTheIndexIsCorrupt.
@Test
public void shouldRequestIndexPopulationIfTheIndexIsCorrupt() throws Exception {
// Given
long faultyIndexId = 1;
CorruptIndexException error = new CorruptIndexException("It's broken.", "");
LuceneSchemaIndexProvider provider = newFaultySchemaIndexProvider(faultyIndexId, error);
// When
NewIndexDescriptor descriptor = NewIndexDescriptorFactory.forLabel(1, 1);
InternalIndexState initialState = provider.getInitialState(faultyIndexId, descriptor);
// Then
assertThat(initialState, equalTo(InternalIndexState.POPULATING));
logProvider.assertAtLeastOnce(loggedException(error));
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class ResampleIndexProcedureTest method shouldTriggerResampling.
@Test
public void shouldTriggerResampling() throws SchemaRuleNotFoundException, ProcedureException, IndexNotFoundKernelException {
NewIndexDescriptor index = NewIndexDescriptorFactory.forLabel(123, 456);
when(operations.indexGetForLabelAndPropertyKey(anyObject())).thenReturn(index);
procedure.resampleIndex(":Person(name)");
verify(indexingService).triggerIndexSampling(index.schema(), IndexSamplingMode.TRIGGER_REBUILD_ALL);
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class ResampleIndexProcedureTest method shouldLookUpTheIndexByLabelIdAndPropertyKeyId.
@Test
public void shouldLookUpTheIndexByLabelIdAndPropertyKeyId() throws ProcedureException, SchemaRuleNotFoundException, IndexNotFoundKernelException {
NewIndexDescriptor index = NewIndexDescriptorFactory.forLabel(0, 0);
when(operations.labelGetForName(anyString())).thenReturn(123);
when(operations.propertyKeyGetForName(anyString())).thenReturn(456);
when(operations.indexGetForLabelAndPropertyKey(anyObject())).thenReturn(index);
procedure.resampleIndex(":Person(name)");
verify(operations).indexGetForLabelAndPropertyKey(new NodePropertyDescriptor(123, 456));
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class KernelSchemaStateFlushingTest method createIndex.
private NewIndexDescriptor createIndex() throws KernelException {
try (KernelTransaction transaction = kernel.newTransaction(KernelTransaction.Type.implicit, AUTH_DISABLED);
Statement statement = transaction.acquireStatement()) {
NewIndexDescriptor descriptor = statement.schemaWriteOperations().indexCreate(SchemaDescriptorFactory.forLabel(1, 1));
transaction.success();
return descriptor;
}
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class KernelSchemaStateFlushingTest method shouldInvalidateSchemaStateOnDropIndex.
@Test
public void shouldInvalidateSchemaStateOnDropIndex() throws Exception {
NewIndexDescriptor descriptor = createIndex();
awaitIndexOnline(descriptor, "test");
commitToSchemaState("test", "before");
dropIndex(descriptor);
// when
String after = commitToSchemaState("test", "after");
// then
assertEquals("after", after);
}
Aggregations