Search in sources :

Example 1 with TopologyDef

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

the class FluxParser method parseInputStream.

public static TopologyDef parseInputStream(InputStream inputStream, boolean dumpYaml, boolean processIncludes, String propertiesFile, boolean envSub) throws IOException {
    Yaml yaml = yaml();
    if (inputStream == null) {
        LOG.error("Unable to load input stream");
        System.exit(1);
    }
    TopologyDef topology = loadYaml(yaml, inputStream, propertiesFile, envSub);
    if (dumpYaml) {
        dumpYaml(topology, yaml);
    }
    if (processIncludes) {
        return processIncludes(yaml, topology, propertiesFile, envSub);
    } else {
        return topology;
    }
}
Also used : TopologyDef(org.apache.storm.flux.model.TopologyDef) Yaml(org.yaml.snakeyaml.Yaml)

Example 2 with TopologyDef

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

the class TCKTest method testTopologySourceWithGetMethodName.

@Test
public void testTopologySourceWithGetMethodName() 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 3 with TopologyDef

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

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

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

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