use of com.datatorrent.stram.StramLocalCluster in project apex-malhar by apache.
the class StreamingWordExtractTest method StreamingWordExtractTest.
@Test
public void StreamingWordExtractTest() throws Exception {
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
setConfig(conf);
StreamingWordExtract app = new StreamingWordExtract();
lma.prepareDAG(app, conf);
LocalMode.Controller lc = lma.getController();
((StramLocalCluster) lc).setExitCondition(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return getNumOfEventsInStore() == 36;
}
});
lc.run(10000);
Assert.assertEquals(app.getWordCount(), getNumOfEventsInStore());
Assert.assertEquals(app.getEntriesMapped(), getNumOfEventsInStore());
}
use of com.datatorrent.stram.StramLocalCluster in project apex-malhar by apache.
the class MaxPerKeyExamplesTest method MaxPerKeyExampleTest.
@Test
public void MaxPerKeyExampleTest() throws Exception {
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
setConfig(conf);
MaxPerKeyExamples app = new MaxPerKeyExamples();
lma.prepareDAG(app, conf);
LocalMode.Controller lc = lma.getController();
((StramLocalCluster) lc).setExitCondition(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return getNumEntries() == 2;
}
});
lc.run(5000);
double[] result = new double[2];
result[0] = getMaxMeanTemp().get(6);
result[1] = getMaxMeanTemp().get(7);
Assert.assertArrayEquals(MEANTEMPS, result, 0.0);
}
Aggregations