Search in sources :

Example 6 with SchemaStore

use of org.neo4j.kernel.impl.store.SchemaStore in project neo4j by neo4j.

the class FullCheckIntegrationTest method createNodePropertyExistenceConstraint.

private void createNodePropertyExistenceConstraint(int labelId, int propertyKeyId) {
    SchemaStore schemaStore = (SchemaStore) fixture.directStoreAccess().nativeStores().getSchemaStore();
    ConstraintRule rule = nodePropertyExistenceConstraintRule(schemaStore.nextId(), labelId, propertyKeyId);
    Collection<DynamicRecord> records = schemaStore.allocateFrom(rule);
    for (DynamicRecord record : records) {
        schemaStore.updateRecord(record);
    }
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) SchemaStore(org.neo4j.kernel.impl.store.SchemaStore) SchemaRuleUtil.uniquenessConstraintRule(org.neo4j.consistency.checking.SchemaRuleUtil.uniquenessConstraintRule) SchemaRuleUtil.relPropertyExistenceConstraintRule(org.neo4j.consistency.checking.SchemaRuleUtil.relPropertyExistenceConstraintRule) ConstraintRule(org.neo4j.kernel.impl.store.record.ConstraintRule) SchemaRuleUtil.nodePropertyExistenceConstraintRule(org.neo4j.consistency.checking.SchemaRuleUtil.nodePropertyExistenceConstraintRule)

Example 7 with SchemaStore

use of org.neo4j.kernel.impl.store.SchemaStore 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());
}
Also used : IndexRule(org.neo4j.kernel.impl.store.record.IndexRule) PopulationProgress(org.neo4j.storageengine.api.schema.PopulationProgress) SchemaStore(org.neo4j.kernel.impl.store.SchemaStore) PropertyKeyTokenHolder(org.neo4j.kernel.impl.core.PropertyKeyTokenHolder) LabelTokenHolder(org.neo4j.kernel.impl.core.LabelTokenHolder) Test(org.junit.Test)

Aggregations

SchemaStore (org.neo4j.kernel.impl.store.SchemaStore)7 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)4 NeoStores (org.neo4j.kernel.impl.store.NeoStores)3 ConstraintRule (org.neo4j.kernel.impl.store.record.ConstraintRule)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 SchemaRuleUtil.nodePropertyExistenceConstraintRule (org.neo4j.consistency.checking.SchemaRuleUtil.nodePropertyExistenceConstraintRule)2 SchemaRuleUtil.relPropertyExistenceConstraintRule (org.neo4j.consistency.checking.SchemaRuleUtil.relPropertyExistenceConstraintRule)2 SchemaRuleUtil.uniquenessConstraintRule (org.neo4j.consistency.checking.SchemaRuleUtil.uniquenessConstraintRule)2 RecordStorageEngine (org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)2 SchemaStorage (org.neo4j.kernel.impl.store.SchemaStorage)2 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)2 List (java.util.List)1 BeforeClass (org.junit.BeforeClass)1 Matchers.anyLong (org.mockito.Matchers.anyLong)1 DependencyResolver (org.neo4j.graphdb.DependencyResolver)1 Label (org.neo4j.graphdb.Label)1 Node (org.neo4j.graphdb.Node)1 Transaction (org.neo4j.graphdb.Transaction)1 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)1