use of org.apache.heron.api.grouping.ShuffleStreamGrouping in project heron by twitter.
the class StreamletImplTest method testCustomStreamletWithGrouperFromBolt.
@Test
@SuppressWarnings("unchecked")
public void testCustomStreamletWithGrouperFromBolt() throws Exception {
Streamlet<Double> baseStreamlet = builder.newSource(() -> Math.random());
Streamlet<Double> streamlet = baseStreamlet.setNumPartitions(20).applyOperator(new MyBoltOperator(), new ShuffleStreamGrouping());
assertTrue(streamlet instanceof CustomStreamlet);
CustomStreamlet<Double, Double> mStreamlet = (CustomStreamlet<Double, Double>) streamlet;
assertEquals(20, mStreamlet.getNumPartitions());
SupplierStreamlet<Double> supplierStreamlet = (SupplierStreamlet<Double>) baseStreamlet;
assertEquals(supplierStreamlet.getChildren().size(), 1);
assertEquals(supplierStreamlet.getChildren().get(0), streamlet);
}
Aggregations