use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class CalculateDenseNodesStepTest method shouldCollectBadRelationships.
@Test
public void shouldCollectBadRelationships() throws Exception {
// GIVEN
NodeRelationshipCache cache = mock(NodeRelationshipCache.class);
Collector collector = mock(Collector.class);
try (CalculateDenseNodesStep step = new CalculateDenseNodesStep(mock(StageControl.class), DEFAULT, cache, collector)) {
step.processors(4);
step.start(0);
// WHEN
Batch<InputRelationship, RelationshipRecord> batch = batch(relationship(1, 5), relationship(3, 10), // <-- bad relationship with missing start node
relationship("a", 2, -1, 2), // <-- bad relationship with missing end node
relationship(2, "b", 2, -1), // <-- bad relationship with missing start and end node
relationship("c", "d", -1, -1));
step.receive(0, batch);
step.endOfUpstream();
while (!step.isCompleted()) {
//wait
}
// THEN
verify(collector, times(1)).collectBadRelationship(any(InputRelationship.class), eq("a"));
verify(collector, times(1)).collectBadRelationship(any(InputRelationship.class), eq("b"));
verify(collector, times(1)).collectBadRelationship(any(InputRelationship.class), eq("c"));
verify(collector, times(1)).collectBadRelationship(any(InputRelationship.class), eq("d"));
}
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class CalculateDenseNodesStepTest method shouldNotProcessLoopsTwice.
@Test
public void shouldNotProcessLoopsTwice() throws Exception {
// GIVEN
NodeRelationshipCache cache = mock(NodeRelationshipCache.class);
try (CalculateDenseNodesStep step = new CalculateDenseNodesStep(mock(StageControl.class), DEFAULT, cache, mock(Collector.class))) {
step.processors(4);
step.start(0);
// WHEN
Batch<InputRelationship, RelationshipRecord> batch = batch(relationship(1, 5), relationship(3, 10), // <-- the loop
relationship(2, 2), relationship(4, 1));
step.receive(0, batch);
step.endOfUpstream();
while (!step.isCompleted()) {
// wait
}
// THEN
verify(cache, times(2)).incrementCount(eq(1L));
verify(cache, times(1)).incrementCount(eq(2L));
verify(cache, times(1)).incrementCount(eq(3L));
verify(cache, times(1)).incrementCount(eq(4L));
verify(cache, times(1)).incrementCount(eq(5L));
verify(cache, times(1)).incrementCount(eq(10L));
}
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class RelationshipRecordFormatTest method useFixedRecordFormatWhenAtLeastOneOfTheReferencesIsMissing.
@Test
public void useFixedRecordFormatWhenAtLeastOneOfTheReferencesIsMissing() throws IOException {
RelationshipRecord source = new RelationshipRecord(1);
RelationshipRecord target = new RelationshipRecord(1);
verifyRecordsWithPoisonedReference(source, target, NULL, randomShortType());
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class RelationshipRecordFormatTest method useFixedReferenceFormatWhenTypeIsSmallEnough.
@Test
public void useFixedReferenceFormatWhenTypeIsSmallEnough() throws IOException {
RelationshipRecord source = new RelationshipRecord(1);
RelationshipRecord target = new RelationshipRecord(1);
source.initialize(true, randomFixedReference(), randomFixedReference(), randomFixedReference(), (1 << 16) - 1, randomFixedReference(), randomFixedReference(), randomFixedReference(), randomFixedReference(), true, true);
writeReadRecord(source, target);
assertTrue("Record should use fixed reference format.", target.isUseFixedReferences());
verifySameReferences(source, target);
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class RelationshipRecordFormatTest method useVariableLengthFormatWhenAtLeastOneOfTheReferencesIsTooBig.
@Test
public void useVariableLengthFormatWhenAtLeastOneOfTheReferencesIsTooBig() throws IOException {
RelationshipRecord source = new RelationshipRecord(1);
RelationshipRecord target = new RelationshipRecord(1);
verifyRecordsWithPoisonedReference(source, target, 1L << Integer.SIZE + 5, randomType());
}
Aggregations