use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class FullCheckTokenIndexIT method verifyIndexExistAndOnline.
private void verifyIndexExistAndOnline(GraphDatabaseAPI db, IndexDescriptor index) {
awaitIndexesOnline(db);
try (Transaction tx = db.beginTx()) {
var indexes = StreamSupport.stream(tx.schema().getIndexes().spliterator(), false).map(IndexDefinitionImpl.class::cast).map(IndexDefinitionImpl::getIndexReference).collect(Collectors.toList());
assertThat(indexes).hasSize(1);
assertThat(indexes.get(0)).isEqualTo(index);
}
}
use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class SchemaWithPECAcceptanceTest method createUniquenessConstraint.
private ConstraintDefinition createUniquenessConstraint(Label label, String propertyKey) {
SchemaHelper.createUniquenessConstraint(db, label, propertyKey);
SchemaHelper.awaitIndexes(db);
InternalSchemaActions actions = mock(InternalSchemaActions.class);
IndexDefinition index = new IndexDefinitionImpl(actions, label, new String[] { propertyKey }, true);
return new UniquenessConstraintDefinition(actions, index);
}
use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class IndexingServiceIntegrationTest method testManualIndexPopulation.
@ParameterizedTest
@MethodSource("parameters")
void testManualIndexPopulation(GraphDatabaseSettings.SchemaIndex schemaIndex) throws InterruptedException, IndexNotFoundKernelException {
setUp(schemaIndex);
IndexDescriptor index;
try (Transaction tx = database.beginTx()) {
IndexDefinitionImpl indexDefinition = (IndexDefinitionImpl) tx.schema().indexFor(Label.label(FOOD_LABEL)).on(PROPERTY_NAME).create();
index = indexDefinition.getIndexReference();
tx.commit();
}
IndexingService indexingService = getIndexingService(database);
IndexProxy indexProxy = indexingService.getIndexProxy(index);
waitIndexOnline(indexProxy);
assertEquals(InternalIndexState.ONLINE, indexProxy.getState());
PopulationProgress progress = indexProxy.getIndexPopulationProgress();
assertEquals(progress.getCompleted(), progress.getTotal());
}
use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class SchemaLoggingIT method createIndex.
private static long createIndex(GraphDatabaseAPI db, String labelName, String property) {
long indexId;
try (Transaction tx = db.beginTx()) {
IndexDefinition indexDefinition = tx.schema().indexFor(label(labelName)).on(property).create();
indexId = ((IndexDefinitionImpl) indexDefinition).getIndexReference().getId();
tx.commit();
}
try (Transaction tx = db.beginTx()) {
tx.schema().awaitIndexesOnline(2, TimeUnit.MINUTES);
tx.commit();
}
return indexId;
}
use of org.neo4j.kernel.impl.coreapi.schema.IndexDefinitionImpl in project neo4j by neo4j.
the class RecoveryWithTokenIndexesIT method verifyIndexExistAndOnline.
private void verifyIndexExistAndOnline(GraphDatabaseService db, IndexDescriptor index) {
awaitIndexesOnline(db);
try (Transaction tx = db.beginTx()) {
var indexes = StreamSupport.stream(tx.schema().getIndexes().spliterator(), false).map(IndexDefinitionImpl.class::cast).map(IndexDefinitionImpl::getIndexReference).collect(Collectors.toList());
assertThat(indexes).hasSize(1);
assertThat(indexes.get(0)).isEqualTo(index);
}
}
Aggregations