Search in sources :

Example 1 with Stage

use of org.neo4j.unsafe.impl.batchimport.staging.Stage in project neo4j by neo4j.

the class ReadGroupsFromCacheStepTest method shouldProduceCompleteBatchesPerOwner.

@Test
public void shouldProduceCompleteBatchesPerOwner() throws Exception {
    // GIVEN
    Configuration config = Configuration.withBatchSize(DEFAULT, 10);
    Iterator<RelationshipGroupRecord> groups = groups(new Group(1, 3), new Group(2, 3), // ^^^ perfect batch size
    new Group(3, 4), new Group(4, 2), // ^^^ slightly bigger than batch size
    new Group(5, 10), // ^^^ much bigger than batch size
    new Group(6, 35), new Group(7, 2)).iterator();
    final AtomicInteger processCounter = new AtomicInteger();
    Stage stage = new Stage(getClass().getSimpleName(), config) {

        {
            add(new ReadGroupsFromCacheStep(control(), config, groups, 1));
            add(new VerifierStep(control(), config, processCounter));
        }
    };
    // WHEN processing the data
    superviseDynamicExecution(stage);
    // THEN
    assertEquals(4, processCounter.get());
}
Also used : RelationshipGroupRecord(org.neo4j.kernel.impl.store.record.RelationshipGroupRecord) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Stage(org.neo4j.unsafe.impl.batchimport.staging.Stage) Test(org.junit.Test)

Aggregations

AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Test (org.junit.Test)1 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)1 Stage (org.neo4j.unsafe.impl.batchimport.staging.Stage)1