Search in sources :

Example 6 with TopologyDef

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

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

Example 8 with TopologyDef

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

the class TCKTest method testShellComponents.

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

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

the class TCKTest method testHdfs.

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

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

the class TCKTest method testBadHbase.

@Test(expected = IllegalArgumentException.class)
public void testBadHbase() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/bad_hbase.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

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