Search in sources :

Example 1 with RelationshipNodesQueueDistributor

use of org.neo4j.consistency.checking.full.QueueDistribution.RelationshipNodesQueueDistributor in project neo4j by neo4j.

the class RecordDistributorTest method shouldDistributeRelationshipRecordsByNodeId.

@Test
public void shouldDistributeRelationshipRecordsByNodeId() throws Exception {
    // GIVEN
    QueueDistributor<RelationshipRecord> distributor = new RelationshipNodesQueueDistributor(5, 100);
    RecordConsumer<RelationshipRecord> consumer = mock(RecordConsumer.class);
    // WHEN/THEN
    RelationshipRecord relationship = relationship(0, 0, 1);
    distributor.distribute(relationship, consumer);
    verify(consumer, times(1)).accept(relationship, 0);
    relationship = relationship(1, 0, 7);
    distributor.distribute(relationship, consumer);
    verify(consumer, times(1)).accept(relationship, 0);
    verify(consumer, times(1)).accept(relationship, 1);
    relationship = relationship(3, 26, 11);
    distributor.distribute(relationship, consumer);
    verify(consumer, times(1)).accept(relationship, 5);
    verify(consumer, times(1)).accept(relationship, 2);
}
Also used : RelationshipNodesQueueDistributor(org.neo4j.consistency.checking.full.QueueDistribution.RelationshipNodesQueueDistributor) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 RelationshipNodesQueueDistributor (org.neo4j.consistency.checking.full.QueueDistribution.RelationshipNodesQueueDistributor)1 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)1