Search in sources :

Example 1 with StorageRelationshipTraversalCursor

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);
}
Also used : StorageRelationshipTraversalCursor(org.neo4j.storageengine.api.StorageRelationshipTraversalCursor) Test(org.junit.jupiter.api.Test)

Example 2 with StorageRelationshipTraversalCursor

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);
}
Also used : StorageRelationshipTraversalCursor(org.neo4j.storageengine.api.StorageRelationshipTraversalCursor) Test(org.junit.jupiter.api.Test)

Example 3 with StorageRelationshipTraversalCursor

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);
}
Also used : StorageRelationshipTraversalCursor(org.neo4j.storageengine.api.StorageRelationshipTraversalCursor) Test(org.junit.jupiter.api.Test)

Example 4 with StorageRelationshipTraversalCursor

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);
}
Also used : StorageRelationshipTraversalCursor(org.neo4j.storageengine.api.StorageRelationshipTraversalCursor) Test(org.junit.jupiter.api.Test)

Example 5 with StorageRelationshipTraversalCursor

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);
}
Also used : StorageRelationshipTraversalCursor(org.neo4j.storageengine.api.StorageRelationshipTraversalCursor) Test(org.junit.jupiter.api.Test)

Aggregations

StorageRelationshipTraversalCursor (org.neo4j.storageengine.api.StorageRelationshipTraversalCursor)8 Test (org.junit.jupiter.api.Test)6 RecordStorageReader (org.neo4j.internal.recordstorage.RecordStorageReader)1 PageCursor (org.neo4j.io.pagecache.PageCursor)1 RelationshipGroupStore (org.neo4j.kernel.impl.store.RelationshipGroupStore)1 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)1