use of org.neo4j.storageengine.api.StorageRelationshipTraversalCursor in project neo4j by neo4j.
the class DefaultRelationshipTraversalCursorTest method emptyStoreOutgoingOfType.
// Empty store, but filter tx-state
@Test
void emptyStoreOutgoingOfType() {
// given
StorageRelationshipTraversalCursor storeCursor = emptyStoreCursor();
DefaultRelationshipTraversalCursor cursor = new DefaultRelationshipTraversalCursor(pool::accept, storeCursor, mock(DefaultNodeCursor.class));
Read read = txState(rel(3, node, 50, type), rel(4, 50, node, type), rel(5, node, 50, type2), rel(6, node, node, type), rel(7, node, 52, type));
// when
cursor.init(node, relationship, selection(type, Direction.OUTGOING), read);
// then
assertRelationships(cursor, 3, 7, 6);
}
use of org.neo4j.storageengine.api.StorageRelationshipTraversalCursor in project neo4j by neo4j.
the class DefaultRelationshipTraversalCursorTest method regularTraversalWithTxState.
@Test
void regularTraversalWithTxState() {
// given
StorageRelationshipTraversalCursor storeCursor = storeCursor(100, 102, 104);
DefaultRelationshipTraversalCursor cursor = new DefaultRelationshipTraversalCursor(pool::accept, storeCursor, mock(DefaultNodeCursor.class));
Read read = txState(3, 4);
// when
cursor.init(node, relationship, ALL_RELATIONSHIPS, read);
// then
assertRelationships(cursor, 3, 4, 100, 102, 104);
}
use of org.neo4j.storageengine.api.StorageRelationshipTraversalCursor in project neo4j by neo4j.
the class DefaultRelationshipTraversalCursorTest method emptyStoreIncomingOfType.
@Test
void emptyStoreIncomingOfType() {
// given
StorageRelationshipTraversalCursor storeCursor = emptyStoreCursor();
DefaultRelationshipTraversalCursor cursor = new DefaultRelationshipTraversalCursor(pool::accept, storeCursor, mock(DefaultNodeCursor.class));
Read read = txState(rel(3, node, 50, type), rel(4, 50, node, type), rel(5, 50, node, type2), rel(6, node, node, type), rel(7, 56, node, type), rel(8, node, 52, type));
// when
cursor.init(node, relationship, selection(type, Direction.INCOMING), read);
// then
assertRelationships(cursor, 4, 7, 6);
}
use of org.neo4j.storageengine.api.StorageRelationshipTraversalCursor in project neo4j by neo4j.
the class DefaultRelationshipTraversalCursorTest method regularTraversal.
// Regular traversal of a sparse chain
@Test
void regularTraversal() {
// given
StorageRelationshipTraversalCursor storeCursor = storeCursor(100, 102, 104);
DefaultRelationshipTraversalCursor cursor = new DefaultRelationshipTraversalCursor(pool::accept, storeCursor, mock(DefaultNodeCursor.class));
Read read = emptyTxState();
// when
cursor.init(node, relationship, ALL_RELATIONSHIPS, read);
// then
assertRelationships(cursor, 100, 102, 104);
}
use of org.neo4j.storageengine.api.StorageRelationshipTraversalCursor in project neo4j by neo4j.
the class DefaultRelationshipTraversalCursorTest method traversalWithTxStateFiltering.
// Sparse traversal but with tx-state filtering
@Test
void traversalWithTxStateFiltering() {
// given
StorageRelationshipTraversalCursor storeCursor = storeCursor(// <- the filter template
rel(100, node, 50, type), rel(102, node, 51, type), rel(104, node, 52, type));
DefaultRelationshipTraversalCursor cursor = new DefaultRelationshipTraversalCursor(pool::accept, storeCursor, mock(DefaultNodeCursor.class));
Read read = txState(rel(3, node, 50, type), rel(4, 50, node, type), rel(5, node, 50, type2), rel(6, node, node, type), rel(7, node, 52, type));
// when
cursor.init(node, relationship, // relationships of a specific type/direction
selection(type, Direction.OUTGOING), read);
// then
assertRelationships(cursor, 3, 7, 6, 100, 102, 104);
}
Aggregations