Search in sources :

Example 1 with ShuffleStreamGrouping

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);
}
Also used : ShuffleStreamGrouping(org.apache.heron.api.grouping.ShuffleStreamGrouping) SupplierStreamlet(org.apache.heron.streamlet.impl.streamlets.SupplierStreamlet) CustomStreamlet(org.apache.heron.streamlet.impl.streamlets.CustomStreamlet) Test(org.junit.Test)

Aggregations

ShuffleStreamGrouping (org.apache.heron.api.grouping.ShuffleStreamGrouping)1 CustomStreamlet (org.apache.heron.streamlet.impl.streamlets.CustomStreamlet)1 SupplierStreamlet (org.apache.heron.streamlet.impl.streamlets.SupplierStreamlet)1 Test (org.junit.Test)1