Search in sources :

Example 11 with ExecutionContext

use of org.apache.storm.flux.model.ExecutionContext in project metron by apache.

the class FluxTopologyComponent method startTopology.

private void startTopology(String topologyName, File topologyLoc, File templateFile, Properties properties) throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException, TException, NoSuchFieldException {
    TopologyDef topologyDef = loadYaml(topologyName, topologyLoc, templateFile, properties);
    Config conf = FluxBuilder.buildConfig(topologyDef);
    ExecutionContext context = new ExecutionContext(topologyDef, conf);
    StormTopology topology = FluxBuilder.buildTopology(context);
    Assert.assertNotNull(topology);
    topology.validate();
    try {
        stormCluster.submitTopology(topologyName, conf, topology);
    } catch (Exception nne) {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
        }
        stormCluster.submitTopology(topologyName, conf, topology);
    }
}
Also used : 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) UnableToStartException(org.apache.metron.integration.UnableToStartException) IOException(java.io.IOException) TException(org.apache.storm.thrift.TException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 12 with ExecutionContext

use of org.apache.storm.flux.model.ExecutionContext in project storm by apache.

the class TCKTest method testBadShellComponents.

@Test(expected = IllegalArgumentException.class)
public void testBadShellComponents() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/bad_shell_test.yaml", false, true, null, false);
    Config conf = FluxBuilder.buildConfig(topologyDef);
    ExecutionContext context = new ExecutionContext(topologyDef, conf);
    StormTopology topology = FluxBuilder.buildTopology(context);
    assertNotNull(topology);
    topology.validate();
}
Also used : 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)

Example 13 with ExecutionContext

use of org.apache.storm.flux.model.ExecutionContext in project storm by apache.

the class TCKTest method testTopologySource.

@Test
public void testTopologySource() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/existing-topology.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();
}
Also used : 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)

Example 14 with ExecutionContext

use of org.apache.storm.flux.model.ExecutionContext in project storm by apache.

the class TCKTest method testIncludes.

@Test
public void testIncludes() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/include_test.yaml", false, true, null, false);
    Config conf = FluxBuilder.buildConfig(topologyDef);
    ExecutionContext context = new ExecutionContext(topologyDef, conf);
    StormTopology topology = FluxBuilder.buildTopology(context);
    assertNotNull(topology);
    assertTrue(topologyDef.getName().equals("include-topology"));
    assertTrue(topologyDef.getBolts().size() > 0);
    assertTrue(topologyDef.getSpouts().size() > 0);
    topology.validate();
}
Also used : 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)

Example 15 with ExecutionContext

use of org.apache.storm.flux.model.ExecutionContext in project storm by apache.

the class TCKTest method testDiamondTopology.

@Test
public void testDiamondTopology() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/diamond-topology.yaml", false, true, null, false);
    Config conf = FluxBuilder.buildConfig(topologyDef);
    ExecutionContext context = new ExecutionContext(topologyDef, conf);
    StormTopology topology = FluxBuilder.buildTopology(context);
    assertNotNull(topology);
    topology.validate();
}
Also used : 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)20 ExecutionContext (org.apache.storm.flux.model.ExecutionContext)20 TopologyDef (org.apache.storm.flux.model.TopologyDef)20 StormTopology (org.apache.storm.generated.StormTopology)20 Test (org.junit.Test)19 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 UnableToStartException (org.apache.metron.integration.UnableToStartException)1 TestBolt (org.apache.storm.flux.test.TestBolt)1 TException (org.apache.storm.thrift.TException)1