Search in sources :

Example 1 with TestBolt

use of com.alibaba.jstorm.flux.test.TestBolt in project jstorm by alibaba.

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"));
}
Also used : TestBolt(com.alibaba.jstorm.flux.test.TestBolt) TopologyDef(com.alibaba.jstorm.flux.model.TopologyDef) ExecutionContext(com.alibaba.jstorm.flux.model.ExecutionContext) Config(backtype.storm.Config) StormTopology(backtype.storm.generated.StormTopology) Test(org.junit.Test)

Aggregations

Config (backtype.storm.Config)1 StormTopology (backtype.storm.generated.StormTopology)1 ExecutionContext (com.alibaba.jstorm.flux.model.ExecutionContext)1 TopologyDef (com.alibaba.jstorm.flux.model.TopologyDef)1 TestBolt (com.alibaba.jstorm.flux.test.TestBolt)1 Test (org.junit.Test)1