use of org.neo4j.internal.kernel.api.helpers.StubRead in project neo4j by neo4j.
the class OperationsTest method returnRelationships.
public static void returnRelationships(KernelTransactionImplementation ktx, final TestRelationshipChain relIds) {
StubRead read = new StubRead();
when(ktx.dataRead()).thenReturn(read);
StubCursorFactory cursorFactory = new StubCursorFactory(true);
cursorFactory.withRelationshipTraversalCursors(new StubRelationshipCursor(relIds));
when(ktx.lockTracer()).thenReturn(NONE);
when(ktx.cursors()).thenReturn(cursorFactory);
when(ktx.ambientNodeCursor()).thenAnswer(args -> new StubNodeCursor(false).withNode(42L));
}
use of org.neo4j.internal.kernel.api.helpers.StubRead in project neo4j by neo4j.
the class CursorPropertyAccessorTest method shouldLookupProperty.
@Test
void shouldLookupProperty() throws EntityNotFoundException {
// given
long nodeId = 10;
Value value = Values.of("abc");
int propertyKeyId = 0;
StubNodeCursor nodeCursor = new StubNodeCursor().withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345), propertyKeyId, value));
CursorPropertyAccessor accessor = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());
// when
Value readValue = accessor.getNodePropertyValue(nodeId, propertyKeyId, NULL);
// then
assertEquals(value, readValue);
}
use of org.neo4j.internal.kernel.api.helpers.StubRead in project neo4j by neo4j.
the class CursorPropertyAccessorTest method shouldReturnNoValueOnMissingProperty.
@Test
void shouldReturnNoValueOnMissingProperty() throws EntityNotFoundException {
// given
long nodeId = 10;
StubNodeCursor nodeCursor = new StubNodeCursor().withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345)));
CursorPropertyAccessor accessor = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());
// when
Value readValue = accessor.getNodePropertyValue(nodeId, 0, NULL);
// then
assertEquals(NO_VALUE, readValue);
}
use of org.neo4j.internal.kernel.api.helpers.StubRead in project neo4j by neo4j.
the class CursorPropertyAccessorTest method shouldThrowOnEntityNotFound.
@Test
void shouldThrowOnEntityNotFound() {
// given
long nodeId = 10;
Value value = Values.of("abc");
int propertyKeyId = 0;
StubNodeCursor nodeCursor = new StubNodeCursor().withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345), propertyKeyId, value));
CursorPropertyAccessor accessor = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());
// when
assertThrows(EntityNotFoundException.class, () -> accessor.getNodePropertyValue(nodeId + 1, propertyKeyId, NULL));
}
Aggregations