use of org.neo4j.internal.recordstorage.FlatRelationshipModifications in project neo4j by neo4j.
the class DegreesRebuildFromStoreTest method generateData.
private void generateData(RecordStorageEngine storageEngine, int denseThreshold, int[] relationshipTypes) throws Exception {
int numNodes = 100;
long[] nodes = new long[numNodes];
applyLogicalChanges(storageEngine, (state, tx) -> {
NodeStore nodeStore = storageEngine.testAccessNeoStores().getNodeStore();
for (int i = 0; i < numNodes; i++) {
nodes[i] = nodeStore.nextId(NULL);
tx.visitCreatedNode(nodes[i]);
}
});
RelationshipStore relationshipStore = storageEngine.testAccessNeoStores().getRelationshipStore();
List<RelationshipData> relationships = new ArrayList<>();
int numRelationships = numNodes * denseThreshold;
for (int i = 0; i < numRelationships; i++) {
relationships.add(new RelationshipData(relationshipStore.nextId(NULL), random.among(relationshipTypes), random.among(nodes), random.among(nodes)));
}
applyLogicalChanges(storageEngine, (state, tx) -> {
NodeState nodeState = mock(NodeState.class);
when(nodeState.labelDiffSets()).thenReturn(LongDiffSets.EMPTY);
when(state.getNodeState(anyLong())).thenReturn(nodeState);
tx.visitRelationshipModifications(new FlatRelationshipModifications(relationships.toArray(new RelationshipData[0])));
});
}
Aggregations