use of org.neo4j.kernel.impl.core.PropertyKeyTokenHolder in project neo4j by neo4j.
the class IndexingServiceIntegrationTest method testSchemaIndexMatchIndexingService.
@Test
public void testSchemaIndexMatchIndexingService() throws IndexNotFoundKernelException {
try (Transaction transaction = database.beginTx()) {
database.schema().constraintFor(Label.label(CLOTHES_LABEL)).assertPropertyIsUnique(PROPERTY_NAME).create();
database.schema().indexFor(Label.label(WEATHER_LABEL)).on(PROPERTY_NAME).create();
transaction.success();
}
try (Transaction transaction = database.beginTx()) {
database.schema().awaitIndexesOnline(1, TimeUnit.MINUTES);
}
IndexingService indexingService = getIndexingService(database);
LabelTokenHolder labelTokenHolder = getLabelTokenHolder(database);
PropertyKeyTokenHolder propertyKeyTokenHolder = getPropertyKeyTokenHolder(database);
int clothedLabelId = labelTokenHolder.getIdByName(CLOTHES_LABEL);
int weatherLabelId = labelTokenHolder.getIdByName(WEATHER_LABEL);
int propertyId = propertyKeyTokenHolder.getIdByName(PROPERTY_NAME);
IndexProxy clothesIndex = indexingService.getIndexProxy(SchemaDescriptorFactory.forLabel(clothedLabelId, propertyId));
IndexProxy weatherIndex = indexingService.getIndexProxy(SchemaDescriptorFactory.forLabel(weatherLabelId, propertyId));
assertEquals(InternalIndexState.ONLINE, clothesIndex.getState());
assertEquals(InternalIndexState.ONLINE, weatherIndex.getState());
}
use of org.neo4j.kernel.impl.core.PropertyKeyTokenHolder in project neo4j by neo4j.
the class IndexingServiceIntegrationTest method testManualIndexPopulation.
@Test
public void testManualIndexPopulation() throws IOException, IndexNotFoundKernelException, InterruptedException {
IndexingService indexingService = getIndexingService(database);
SchemaStore schemaStore = getSchemaStore(database);
LabelTokenHolder labelTokenHolder = getLabelTokenHolder(database);
PropertyKeyTokenHolder propertyKeyTokenHolder = getPropertyKeyTokenHolder(database);
int foodId = labelTokenHolder.getIdByName(FOOD_LABEL);
int propertyId = propertyKeyTokenHolder.getIdByName(PROPERTY_NAME);
IndexRule rule = IndexRule.indexRule(schemaStore.nextId(), NewIndexDescriptorFactory.forLabel(foodId, propertyId), indexDescriptor);
indexingService.createIndexes(rule);
IndexProxy indexProxy = indexingService.getIndexProxy(rule.getId());
waitIndexOnline(indexProxy);
assertEquals(InternalIndexState.ONLINE, indexProxy.getState());
PopulationProgress progress = indexProxy.getIndexPopulationProgress();
assertEquals(progress.getCompleted(), progress.getTotal());
}
Aggregations