Search in sources :

Example 1 with LabelTokenStore

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

the class IndexLookupTest method setUp.

@BeforeClass
public static void setUp() {
    api = dbRule.getGraphDatabaseAPI();
    String notUsedIndexPropKey = "notUsed";
    String usedIndexPropKey = "used";
    Label usedLabel = Label.label("UsedLabel");
    Label notUsedLabel = Label.label("NotUsedLabel");
    try (Transaction transaction = api.beginTx()) {
        api.schema().indexFor(usedLabel).on(usedIndexPropKey).create();
        transaction.success();
    }
    try (Transaction transaction = api.beginTx()) {
        api.schema().awaitIndexesOnline(10, TimeUnit.SECONDS);
        indexedNodePropertyValue = "value1";
        notIndexedNodePropertyValue = "value2";
        Node nodeA = api.createNode(usedLabel);
        nodeA.setProperty(usedIndexPropKey, indexedNodePropertyValue);
        nodeA.setProperty(notUsedIndexPropKey, notIndexedNodePropertyValue);
        indexedNode = nodeA.getId();
        Node nodeB = api.createNode(notUsedLabel);
        nodeB.setProperty(usedIndexPropKey, notIndexedNodePropertyValue);
        nodeB.setProperty(notUsedIndexPropKey, indexedNodePropertyValue);
        notIndexedNode = nodeB.getId();
        transaction.success();
    }
    DependencyResolver resolver = api.getDependencyResolver();
    NeoStores neoStores = resolver.resolveDependency(RecordStorageEngine.class).testAccessNeoStores();
    SchemaStore schemaStore = neoStores.getSchemaStore();
    SchemaIndexProvider schemaIndexProvider = resolver.resolveDependency(SchemaIndexProvider.class);
    indexLookup = new IndexLookup(schemaStore, schemaIndexProvider);
    LabelTokenStore labelTokenStore = neoStores.getLabelTokenStore();
    notUsedLabelId = findTokenFor(labelTokenStore, notUsedLabel.name()).id();
    usedLabelId = findTokenFor(labelTokenStore, usedLabel.name()).id();
    PropertyKeyTokenStore propertyKeyTokenStore = neoStores.getPropertyKeyTokenStore();
    notUsedPropertyId = findTokenFor(propertyKeyTokenStore, notUsedIndexPropKey).id();
    usedPropertyId = findTokenFor(propertyKeyTokenStore, usedIndexPropKey).id();
}
Also used : LabelTokenStore(org.neo4j.kernel.impl.store.LabelTokenStore) PropertyKeyTokenStore(org.neo4j.kernel.impl.store.PropertyKeyTokenStore) SchemaIndexProvider(org.neo4j.kernel.api.index.SchemaIndexProvider) Transaction(org.neo4j.graphdb.Transaction) SchemaStore(org.neo4j.kernel.impl.store.SchemaStore) RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine) Node(org.neo4j.graphdb.Node) NeoStores(org.neo4j.kernel.impl.store.NeoStores) Label(org.neo4j.graphdb.Label) DependencyResolver(org.neo4j.graphdb.DependencyResolver) BeforeClass(org.junit.BeforeClass)

Example 2 with LabelTokenStore

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

the class DumpCountsStoreTest method createNeoStores.

private NeoStores createNeoStores() {
    NeoStores neoStores = mock(NeoStores.class);
    LabelTokenStore labelTokenStore = mock(LabelTokenStore.class);
    RelationshipTypeTokenStore typeTokenStore = mock(RelationshipTypeTokenStore.class);
    PropertyKeyTokenStore propertyKeyTokenStore = mock(PropertyKeyTokenStore.class);
    when(labelTokenStore.getTokens(Integer.MAX_VALUE)).thenReturn(getLabelTokens());
    when(typeTokenStore.getTokens(Integer.MAX_VALUE)).thenReturn(getTypeTokes());
    when(propertyKeyTokenStore.getTokens(Integer.MAX_VALUE)).thenReturn(getPropertyTokens());
    when(neoStores.getLabelTokenStore()).thenReturn(labelTokenStore);
    when(neoStores.getRelationshipTypeTokenStore()).thenReturn(typeTokenStore);
    when(neoStores.getPropertyKeyTokenStore()).thenReturn(propertyKeyTokenStore);
    return neoStores;
}
Also used : LabelTokenStore(org.neo4j.kernel.impl.store.LabelTokenStore) PropertyKeyTokenStore(org.neo4j.kernel.impl.store.PropertyKeyTokenStore) RelationshipTypeTokenStore(org.neo4j.kernel.impl.store.RelationshipTypeTokenStore) NeoStores(org.neo4j.kernel.impl.store.NeoStores)

Aggregations

LabelTokenStore (org.neo4j.kernel.impl.store.LabelTokenStore)2 NeoStores (org.neo4j.kernel.impl.store.NeoStores)2 PropertyKeyTokenStore (org.neo4j.kernel.impl.store.PropertyKeyTokenStore)2 BeforeClass (org.junit.BeforeClass)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 RecordStorageEngine (org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)1 RelationshipTypeTokenStore (org.neo4j.kernel.impl.store.RelationshipTypeTokenStore)1 SchemaStore (org.neo4j.kernel.impl.store.SchemaStore)1