use of org.apache.storm.st.wrapper.TopoWrap in project storm by apache.
the class DemoTest method testExclamationTopology.
@Test
public void testExclamationTopology() throws Exception {
topo = new TopoWrap(cluster, topologyName, ExclamationTopology.getStormTopology());
topo.submitSuccessfully();
final int minExclaim2Emits = 500;
final int minSpountEmits = 10000;
for (int i = 0; i < 10; ++i) {
TopologyInfo topologyInfo = topo.getInfo();
log.info(topologyInfo.toString());
long wordSpoutEmittedCount = topo.getAllTimeEmittedCount(ExclamationTopology.WORD);
long exclaim1EmittedCount = topo.getAllTimeEmittedCount(ExclamationTopology.EXCLAIM_1);
long exclaim2EmittedCount = topo.getAllTimeEmittedCount(ExclamationTopology.EXCLAIM_2);
log.info("wordSpoutEmittedCount for spout 'word' = " + wordSpoutEmittedCount);
log.info("exclaim1EmittedCount = " + exclaim1EmittedCount);
log.info("exclaim2EmittedCount = " + exclaim2EmittedCount);
if (exclaim2EmittedCount > minExclaim2Emits || wordSpoutEmittedCount > minSpountEmits) {
break;
}
TimeUtil.sleepSec(6);
}
List<TopoWrap.ExecutorURL> boltUrls = topo.getLogUrls(ExclamationTopology.WORD);
log.info(boltUrls.toString());
final String actualOutput = topo.getLogs(ExclamationTopology.EXCLAIM_2);
for (String oneExpectedOutput : exclaim2Oputput) {
Assert.assertTrue(actualOutput.contains(oneExpectedOutput), "Couldn't find " + oneExpectedOutput + " in urls");
}
}
use of org.apache.storm.st.wrapper.TopoWrap in project storm by apache.
the class SlidingWindowTest method testTimeWindow.
@Test(dataProvider = "generateTimeWindows")
public void testTimeWindow(int windowSec, int slideSec) throws Exception {
final SlidingTimeCorrectness testable = new SlidingTimeCorrectness(windowSec, slideSec);
final String topologyName = this.getClass().getSimpleName() + "w" + windowSec + "s" + slideSec;
if (windowSec <= 0 || slideSec <= 0) {
try {
testable.newTopology();
Assert.fail("Expected IllegalArgumentException was not thrown.");
} catch (IllegalArgumentException ignore) {
return;
}
}
topo = new TopoWrap(cluster, topologyName, testable.newTopology());
runAndVerifyTime(windowSec, slideSec, testable, topo);
}
use of org.apache.storm.st.wrapper.TopoWrap in project storm by apache.
the class TumblingWindowTest method testTumbleCount.
@Test(dataProvider = "generateWindows")
public void testTumbleCount(int tumbleSize) throws Exception {
final TumblingWindowCorrectness testable = new TumblingWindowCorrectness(tumbleSize);
final String topologyName = this.getClass().getSimpleName() + "t" + tumbleSize;
if (tumbleSize <= 0) {
try {
testable.newTopology();
Assert.fail("Expected IllegalArgumentException was not thrown.");
} catch (IllegalArgumentException ignore) {
return;
}
}
topo = new TopoWrap(cluster, topologyName, testable.newTopology());
SlidingWindowTest.runAndVerifyCount(tumbleSize, tumbleSize, testable, topo);
}
use of org.apache.storm.st.wrapper.TopoWrap in project storm by apache.
the class SlidingWindowTest method testWindowCount.
@Test(dataProvider = "generateCountWindows")
public void testWindowCount(int windowSize, int slideSize) throws Exception {
final SlidingWindowCorrectness testable = new SlidingWindowCorrectness(windowSize, slideSize);
final String topologyName = this.getClass().getSimpleName() + "w" + windowSize + "s" + slideSize;
if (windowSize <= 0 || slideSize <= 0) {
try {
testable.newTopology();
Assert.fail("Expected IllegalArgumentException was not thrown.");
} catch (IllegalArgumentException ignore) {
return;
}
}
topo = new TopoWrap(cluster, topologyName, testable.newTopology());
runAndVerifyCount(windowSize, slideSize, testable, topo);
}
use of org.apache.storm.st.wrapper.TopoWrap in project storm by apache.
the class TumblingWindowTest method testTumbleTime.
@Test(dataProvider = "generateTumbleTimes")
public void testTumbleTime(int tumbleSec) throws Exception {
final TumblingTimeCorrectness testable = new TumblingTimeCorrectness(tumbleSec);
final String topologyName = this.getClass().getSimpleName() + "t" + tumbleSec;
if (tumbleSec <= 0) {
try {
testable.newTopology();
Assert.fail("Expected IllegalArgumentException was not thrown.");
} catch (IllegalArgumentException ignore) {
return;
}
}
topo = new TopoWrap(cluster, topologyName, testable.newTopology());
SlidingWindowTest.runAndVerifyTime(tumbleSec, tumbleSec, testable, topo);
}
Aggregations