Search in sources :

Example 1 with TopoWrap

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");
    }
}
Also used : TopoWrap(org.apache.storm.st.wrapper.TopoWrap) TopologyInfo(org.apache.storm.generated.TopologyInfo) Test(org.testng.annotations.Test) AbstractTest(org.apache.storm.st.helper.AbstractTest)

Example 2 with TopoWrap

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);
}
Also used : TopoWrap(org.apache.storm.st.wrapper.TopoWrap) SlidingTimeCorrectness(org.apache.storm.st.topology.window.SlidingTimeCorrectness) Test(org.testng.annotations.Test) AbstractTest(org.apache.storm.st.helper.AbstractTest)

Example 3 with TopoWrap

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);
}
Also used : TumblingWindowCorrectness(org.apache.storm.st.topology.window.TumblingWindowCorrectness) TopoWrap(org.apache.storm.st.wrapper.TopoWrap) Test(org.testng.annotations.Test) AbstractTest(org.apache.storm.st.helper.AbstractTest)

Example 4 with TopoWrap

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);
}
Also used : SlidingWindowCorrectness(org.apache.storm.st.topology.window.SlidingWindowCorrectness) TopoWrap(org.apache.storm.st.wrapper.TopoWrap) Test(org.testng.annotations.Test) AbstractTest(org.apache.storm.st.helper.AbstractTest)

Example 5 with TopoWrap

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);
}
Also used : TumblingTimeCorrectness(org.apache.storm.st.topology.window.TumblingTimeCorrectness) TopoWrap(org.apache.storm.st.wrapper.TopoWrap) Test(org.testng.annotations.Test) AbstractTest(org.apache.storm.st.helper.AbstractTest)

Aggregations

AbstractTest (org.apache.storm.st.helper.AbstractTest)5 TopoWrap (org.apache.storm.st.wrapper.TopoWrap)5 Test (org.testng.annotations.Test)5 TopologyInfo (org.apache.storm.generated.TopologyInfo)1 SlidingTimeCorrectness (org.apache.storm.st.topology.window.SlidingTimeCorrectness)1 SlidingWindowCorrectness (org.apache.storm.st.topology.window.SlidingWindowCorrectness)1 TumblingTimeCorrectness (org.apache.storm.st.topology.window.TumblingTimeCorrectness)1 TumblingWindowCorrectness (org.apache.storm.st.topology.window.TumblingWindowCorrectness)1