use of org.neo4j.kernel.impl.api.operations.EntityReadOperations in project neo4j by neo4j.
the class NodeSchemaMatcherTest method setup.
@Before
public void setup() {
state = mock(KernelStatement.class);
PrimitiveIntSet labels = Primitive.intSet();
labels.add(labelId1);
Cursor<NodeItem> nodeItemCursor = StubCursors.asNodeCursor(0, labels);
nodeItemCursor.next();
node = nodeItemCursor.get();
PrimitiveIntSet defaultPropertyIds = PrimitiveIntCollections.asSet(new int[] { propId1, propId2, unIndexedPropId });
EntityReadOperations readOps = mock(EntityReadOperations.class);
when(readOps.nodeGetPropertyKeys(state, node)).thenReturn(defaultPropertyIds);
when(readOps.nodeGetProperty(state, node, propId1)).thenReturn("hi1");
when(readOps.nodeGetProperty(state, node, propId2)).thenReturn("hi2");
when(readOps.nodeGetProperty(state, node, unIndexedPropId)).thenReturn("hi3");
nodeSchemaMatcher = new NodeSchemaMatcher<>(readOps);
}
use of org.neo4j.kernel.impl.api.operations.EntityReadOperations in project neo4j by neo4j.
the class IndexTxStateUpdaterTest method setup.
@Before
public void setup() {
state = mock(KernelStatement.class);
txState = mock(TransactionState.class);
when(state.txState()).thenReturn(txState);
SchemaReadOperations schemaReadOps = mock(SchemaReadOperations.class);
when(schemaReadOps.indexesGetAll(state)).thenAnswer(x -> filter(GENERAL, indexes.iterator()));
when(schemaReadOps.uniqueIndexesGetAll(state)).thenAnswer(x -> filter(UNIQUE, indexes.iterator()));
when(schemaReadOps.indexesGetForLabel(state, labelId1)).thenAnswer(x -> filter(GENERAL, filter(hasLabel(labelId1), indexes.iterator())));
when(schemaReadOps.uniqueIndexesGetForLabel(state, labelId1)).thenAnswer(x -> filter(UNIQUE, filter(hasLabel(labelId1), indexes.iterator())));
when(schemaReadOps.indexesGetForLabel(state, labelId2)).thenAnswer(x -> filter(GENERAL, filter(hasLabel(labelId2), indexes.iterator())));
when(schemaReadOps.uniqueIndexesGetForLabel(state, labelId2)).thenAnswer(x -> filter(UNIQUE, filter(hasLabel(labelId2), indexes.iterator())));
PrimitiveIntSet labels = Primitive.intSet();
labels.add(labelId1);
labels.add(labelId2);
Cursor<NodeItem> nodeItemCursor = StubCursors.asNodeCursor(0, labels);
nodeItemCursor.next();
node = nodeItemCursor.get();
PrimitiveIntSet defaultPropertyIds = PrimitiveIntCollections.asSet(new int[] { propId1, propId2, propId3 });
EntityReadOperations readOps = mock(EntityReadOperations.class);
when(readOps.nodeGetPropertyKeys(state, node)).thenReturn(defaultPropertyIds);
when(readOps.nodeGetProperties(state, node)).thenAnswer(p -> StubCursors.asPropertyCursor(Property.property(propId1, "hi1"), Property.property(propId2, "hi2"), Property.property(propId3, "hi3")));
when(readOps.nodeGetProperty(state, node, propId1)).thenReturn("hi1");
when(readOps.nodeGetProperty(state, node, propId2)).thenReturn("hi2");
when(readOps.nodeGetProperty(state, node, propId3)).thenReturn("hi3");
indexTxUpdater = new IndexTxStateUpdater(schemaReadOps, readOps);
}
Aggregations