use of org.neo4j.kernel.impl.store.RelationshipStore in project neo4j by neo4j.
the class StoreIteratorRelationshipCursorTest method getRelationshipStore.
private RelationshipStore getRelationshipStore(RelationshipRecord relationshipRecord, RecordCursor recordCursor) {
RelationshipStore relationshipStore = mock(RelationshipStore.class);
when(recordCursor.acquire(anyLong(), any())).thenReturn(recordCursor);
when(relationshipStore.newRecord()).thenReturn(relationshipRecord);
when(relationshipStore.newRecordCursor(relationshipRecord)).thenReturn(recordCursor);
return relationshipStore;
}
use of org.neo4j.kernel.impl.store.RelationshipStore in project neo4j by neo4j.
the class StoreIteratorRelationshipCursorTest method retrieveUnusedRelationship.
@Test
public void retrieveUnusedRelationship() {
final RelationshipRecord relationshipRecord = new RelationshipRecord(-1);
RecordCursor recordCursor = mock(RecordCursor.class);
RelationshipStore relationshipStore = getRelationshipStore(relationshipRecord, recordCursor);
when(recordCursor.next(RELATIONSHIP_ID, relationshipRecord, RecordLoad.CHECK)).thenAnswer(new RelationshipAnswer(relationshipRecord, false));
try (StoreIteratorRelationshipCursor cursor = createRelationshipCursor(relationshipRecord, relationshipStore)) {
cursor.init(PrimitiveLongCollections.iterator(RELATIONSHIP_ID));
assertTrue(cursor.next());
assertEquals(RELATIONSHIP_ID, cursor.get().id());
}
}
use of org.neo4j.kernel.impl.store.RelationshipStore in project neo4j by neo4j.
the class StoreIteratorRelationshipCursorTest method retrieveUsedRelationship.
@Test
public void retrieveUsedRelationship() throws Exception {
final RelationshipRecord relationshipRecord = new RelationshipRecord(-1);
RecordCursor recordCursor = mock(RecordCursor.class);
RelationshipStore relationshipStore = getRelationshipStore(relationshipRecord, recordCursor);
when(recordCursor.next(RELATIONSHIP_ID, relationshipRecord, RecordLoad.CHECK)).thenAnswer(new RelationshipAnswer(relationshipRecord, true));
try (StoreIteratorRelationshipCursor cursor = createRelationshipCursor(relationshipRecord, relationshipStore)) {
cursor.init(PrimitiveLongCollections.iterator(RELATIONSHIP_ID));
assertTrue(cursor.next());
assertEquals(RELATIONSHIP_ID, cursor.get().id());
}
}
use of org.neo4j.kernel.impl.store.RelationshipStore in project neo4j by neo4j.
the class StoreNodeRelationshipCursorTest method createRelationshipChain.
private void createRelationshipChain(int recordsInChain) {
RelationshipStore relationshipStore = neoStores.getRelationshipStore();
for (int i = 1; i < recordsInChain; i++) {
relationshipStore.updateRecord(createRelationship(i, i + 1));
}
relationshipStore.updateRecord(createRelationship(recordsInChain, NO_NEXT_RELATIONSHIP.intValue()));
if (dense) {
RecordStore<RelationshipGroupRecord> relationshipGroupStore = neoStores.getRelationshipGroupStore();
for (int i = 1; i < recordsInChain; i++) {
relationshipGroupStore.updateRecord(createRelationshipGroup(i, i));
}
relationshipGroupStore.updateRecord(createRelationshipGroup(recordsInChain, NO_NEXT_RELATIONSHIP.intValue()));
}
}
use of org.neo4j.kernel.impl.store.RelationshipStore in project neo4j by neo4j.
the class StoreNodeRelationshipCursorTest method unUseRecord.
private void unUseRecord(long recordId) {
RelationshipStore relationshipStore = neoStores.getRelationshipStore();
RelationshipRecord relationshipRecord = relationshipStore.getRecord(recordId, new RelationshipRecord(-1), RecordLoad.FORCE);
relationshipRecord.setInUse(false);
relationshipStore.updateRecord(relationshipRecord);
}
Aggregations