use of storm.trident.TridentTopology in project jstorm by alibaba.
the class TridentMinMaxOfDevicesTest method testTridentMinMaxOfDevices.
@Test
public void testTridentMinMaxOfDevices() {
Fields fields = new Fields("device-id", "count");
List<Values> content = new ArrayList<Values>();
for (int i = 0; i < SPOUT_BATCH_SIZE; i++) content.add(new Values(i + 1));
ShuffleValuesBatchSpout spout = new ShuffleValuesBatchSpout(fields, content, content);
TridentTopology tridentTopology = new TridentTopology();
Stream stream = tridentTopology.newStream("device-gen-spout", spout).each(fields, new Debug("#### devices"));
stream.minBy("device-id").each(fields, new AssertMinDebug());
stream.maxBy("count").each(fields, new AssertMaxDebug());
Map config = new HashMap();
config.put(Config.TOPOLOGY_NAME, "TridentMinMaxOfDevicesTest");
// the test can pass if the 2 AssertDebug pass throughout the test
JStormUnitTestRunner.submitTopology(tridentTopology.build(), config, 120, null);
}
Aggregations