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();
}
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;
}
Aggregations