Java Code Examples for backtype.storm.generated.StormTopology#validate()

The following examples show how to use backtype.storm.generated.StormTopology#validate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TCKTest.java    From jstorm with Apache License 2.0 6 votes vote down vote up
@Test
public void testTopologySourceWithConfigMethods() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/config-methods-test.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();

    // make sure the property was actually set
    TestBolt bolt = (TestBolt)context.getBolt("bolt-1");
    assertTrue(bolt.getFoo().equals("foo"));
    assertTrue(bolt.getBar().equals("bar"));
    assertTrue(bolt.getFooBar().equals("foobar"));
}
 
Example 2
Source File: TCKTest.java    From flux with Apache License 2.0 6 votes vote down vote up
@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"));

}
 
Example 3
Source File: TCKTest.java    From flux with Apache License 2.0 6 votes vote down vote up
@Test
public void testTopologySourceWithConfigMethods() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/config-methods-test.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();

    // make sure the property was actually set
    TestBolt bolt = (TestBolt)context.getBolt("bolt-1");
    assertTrue(bolt.getFoo().equals("foo"));
    assertTrue(bolt.getBar().equals("bar"));
    assertTrue(bolt.getFooBar().equals("foobar"));
}
 
Example 4
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 5
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 6
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@Test
public void testTridentTopologySource() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/existing-topology-trident.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();
}
 
Example 7
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 8
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@Test
public void testTopologySourceWithConfigParam() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/existing-topology-reflection-config.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();
}
 
Example 9
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 10
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 11
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 12
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 13
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@Test
public void testHbase() throws Exception {
    TopologyDef topologyDef = FluxParser.parseResource("/configs/simple_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();
}
 
Example 14
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 15
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@Test
public void testLoadFromResource() 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();
}
 
Example 16
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 17
Source File: TCKTest.java    From flux with Apache License 2.0 5 votes vote down vote up
@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();
}