Search in sources :

Example 1 with TestBolt

use of org.apache.storm.flux.test.TestBolt in project storm by apache.

the class TCKTest method testTopologySourceWithConfigMethods.

@Test
public void testTopologySourceWithConfigMethods() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/config-methods-test.yaml", false, true, null, false);
    assertTrue(topologyDef.validate());
    Config conf = FluxBuilder.buildConfig(topologyDef);
    ExecutionContext context = new ExecutionContext(topologyDef, conf);
    StormTopology topology = FluxBuilder.buildTopology(context);
    assertNotNull(topology);
    topology.validate();
    // make sure the property was actually set
    TestBolt bolt = (TestBolt) context.getBolt("bolt-1");
    assertTrue(bolt.getFoo().equals("foo"));
    assertTrue(bolt.getBar().equals("bar"));
    assertTrue(bolt.getFooBar().equals("foobar"));
    assertArrayEquals(new TestBolt.TestClass[] { new TestBolt.TestClass("foo"), new TestBolt.TestClass("bar"), new TestBolt.TestClass("baz") }, bolt.getClasses());
}
Also used : TestBolt(org.apache.storm.flux.test.TestBolt) TopologyDef(org.apache.storm.flux.model.TopologyDef) ExecutionContext(org.apache.storm.flux.model.ExecutionContext) Config(org.apache.storm.Config) StormTopology(org.apache.storm.generated.StormTopology) Test(org.junit.Test)

Aggregations

Config (org.apache.storm.Config)1 ExecutionContext (org.apache.storm.flux.model.ExecutionContext)1 TopologyDef (org.apache.storm.flux.model.TopologyDef)1 TestBolt (org.apache.storm.flux.test.TestBolt)1 StormTopology (org.apache.storm.generated.StormTopology)1 Test (org.junit.Test)1