use of org.apache.storm.flux.model.ExecutionContext 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();
}
use of org.apache.storm.flux.model.ExecutionContext 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();
}
use of org.apache.storm.flux.model.ExecutionContext 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();
}
use of org.apache.storm.flux.model.ExecutionContext in project storm by apache.
the class TCKTest method testVariableSubstitution.
@Test
public void testVariableSubstitution() throws Exception {
Properties properties = FluxParser.parseProperties("/configs/test.properties", true);
TopologyDef topologyDef = FluxParser.parseResource("/configs/substitution-test.yaml", false, true, 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"));
// Test substitution where the target type is List
assertThat("List property is not replaced by the expected value", Collections.singletonList("A string list"), is(context.getTopologyDef().getConfig().get("list.property.target")));
// Test substitution where the target type is a List element
assertThat("List element property is not replaced by the expected value", "A string list", is(context.getTopologyDef().getConfig().get("list.element.property.target")));
}
use of org.apache.storm.flux.model.ExecutionContext in project storm by apache.
the class TCKTest method testTopologyWithInvalidStaticFactoryArgument.
@Test
public void testTopologyWithInvalidStaticFactoryArgument() throws Exception {
// STORM-3087.
TopologyDef topologyDef = FluxParser.parseResource("/configs/bad_static_factory_test.yaml", false, true, null, false);
Config conf = FluxBuilder.buildConfig(topologyDef);
ExecutionContext context = new ExecutionContext(topologyDef, conf);
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Couldn't find a suitable static method");
FluxBuilder.buildTopology(context);
}
Aggregations