Search in sources :

Example 6 with StormTopology

use of org.apache.storm.generated.StormTopology in project storm by apache.

the class TCKTest method testTopologySourceWithMethodName.

@Test
public void testTopologySourceWithMethodName() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/existing-topology-method-override.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 7 with StormTopology

use of org.apache.storm.generated.StormTopology in project storm by apache.

the class TCKTest method testTopologySourceWithReflection.

@Test
public void testTopologySourceWithReflection() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/existing-topology-reflection.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 8 with StormTopology

use of org.apache.storm.generated.StormTopology in project storm by apache.

the class TCKTest method testTCK.

@Test
public void testTCK() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/tck.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 9 with StormTopology

use of org.apache.storm.generated.StormTopology in project storm by apache.

the class TCKTest method testVariableSubstitution.

@Test
public void testVariableSubstitution() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/substitution-test.yaml", false, true, "src/test/resources/configs/test.properties", true);
    assertTrue(topologyDef.validate());
    Config conf = FluxBuilder.buildConfig(topologyDef);
    ExecutionContext context = new ExecutionContext(topologyDef, conf);
    StormTopology topology = FluxBuilder.buildTopology(context);
    assertNotNull(topology);
    topology.validate();
    // test basic substitution
    assertEquals("Property not replaced.", "substitution-topology", context.getTopologyDef().getName());
    // test environment variable substitution
    // $PATH should be defined on most systems
    String envPath = System.getenv().get("PATH");
    assertEquals("ENV variable not replaced.", envPath, context.getTopologyDef().getConfig().get("test.env.value"));
}
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 10 with StormTopology

use of org.apache.storm.generated.StormTopology in project storm by apache.

the class TCKTest method testKafkaSpoutConfig.

@Test
public void testKafkaSpoutConfig() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/kafka_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)

Aggregations

StormTopology (org.apache.storm.generated.StormTopology)75 Test (org.junit.Test)45 Config (org.apache.storm.Config)37 HashMap (java.util.HashMap)31 ExecutionContext (org.apache.storm.flux.model.ExecutionContext)19 TopologyDef (org.apache.storm.flux.model.TopologyDef)19 Map (java.util.Map)17 ArrayList (java.util.ArrayList)14 Bolt (org.apache.storm.generated.Bolt)13 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)13 List (java.util.List)11 GlobalStreamId (org.apache.storm.generated.GlobalStreamId)11 Grouping (org.apache.storm.generated.Grouping)10 SpoutSpec (org.apache.storm.generated.SpoutSpec)10 TopologyDetails (org.apache.storm.scheduler.TopologyDetails)10 NullStruct (org.apache.storm.generated.NullStruct)9 INimbus (org.apache.storm.scheduler.INimbus)9 IRichBolt (org.apache.storm.topology.IRichBolt)9 Cluster (org.apache.storm.scheduler.Cluster)8 ExecutorDetails (org.apache.storm.scheduler.ExecutorDetails)8