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());
}
Aggregations