Search in sources :

Example 16 with TopologyDef

use of org.apache.storm.flux.model.TopologyDef 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 17 with TopologyDef

use of org.apache.storm.flux.model.TopologyDef 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 18 with TopologyDef

use of org.apache.storm.flux.model.TopologyDef 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 19 with TopologyDef

use of org.apache.storm.flux.model.TopologyDef 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)

Example 20 with TopologyDef

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

the class TCKTest method testInvalidTopologySource.

@Test(expected = IllegalArgumentException.class)
public void testInvalidTopologySource() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/invalid-existing-topology.yaml", false, true, null, false);
    assertFalse("Topology config is invalid.", topologyDef.validate());
    Config conf = FluxBuilder.buildConfig(topologyDef);
    ExecutionContext context = new ExecutionContext(topologyDef, conf);
    StormTopology topology = FluxBuilder.buildTopology(context);
}
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

TopologyDef (org.apache.storm.flux.model.TopologyDef)24 Config (org.apache.storm.Config)19 ExecutionContext (org.apache.storm.flux.model.ExecutionContext)19 StormTopology (org.apache.storm.generated.StormTopology)19 Test (org.junit.Test)19 FileInputStream (java.io.FileInputStream)3 InputStream (java.io.InputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Properties (java.util.Properties)1 IncludeDef (org.apache.storm.flux.model.IncludeDef)1 TestBolt (org.apache.storm.flux.test.TestBolt)1 Yaml (org.yaml.snakeyaml.Yaml)1