use of org.apache.heron.api.topology.TopologyBuilder in project heron by twitter.
the class AbstractTestTopology method submit.
public final void submit(Config userConf) throws AlreadyAliveException, InvalidTopologyException {
Config conf = buildConfig(new BasicConfig());
if (userConf != null) {
conf.putAll(userConf);
}
if (this.httpServerResultsUrl == null) {
TopologyBuilder builder = new TopologyBuilder();
HeronSubmitter.submitTopology(topologyName, conf, buildTopology(builder).createTopology());
} else {
TopologyTestTopologyBuilder builder = new TopologyTestTopologyBuilder(httpServerResultsUrl);
conf.setTopologyReliabilityMode(Config.TopologyReliabilityMode.EFFECTIVELY_ONCE);
conf.setTopologyStatefulCheckpointIntervalSecs(CHECKPOINT_INTERVAL);
HeronSubmitter.submitTopology(topologyName, conf, buildStatefulTopology(builder).createTopology());
}
}
use of org.apache.heron.api.topology.TopologyBuilder in project heron by twitter.
the class StreamletImplTest method testStreamletNameIfDuplicateNameIsSet.
@Test(expected = RuntimeException.class)
public void testStreamletNameIfDuplicateNameIsSet() {
// create SupplierStreamlet
Streamlet<String> baseStreamlet = builder.newSource(() -> "This is test content");
SupplierStreamlet<String> supplierStreamlet = (SupplierStreamlet<String>) baseStreamlet;
// set duplicate streamlet name and expect thrown exception
supplierStreamlet.map((content) -> content.toUpperCase()).setName("MyMapStreamlet").map((content) -> content + "_test_suffix").setName("MyMapStreamlet");
// build SupplierStreamlet
assertFalse(supplierStreamlet.isBuilt());
TopologyBuilder topologyBuilder = new TopologyBuilder();
Set<String> stageNames = new HashSet<>();
supplierStreamlet.build(topologyBuilder, stageNames);
}
use of org.apache.heron.api.topology.TopologyBuilder in project heron by twitter.
the class HeronSubmitterTest method createTopologyBuilderWithMinimumSetup.
private TopologyBuilder createTopologyBuilderWithMinimumSetup() {
TopologyBuilder builder = new TopologyBuilder();
int spouts = 2;
int bolts = 2;
builder.setSpout("word", new TestSpout2(), spouts);
builder.setBolt("exclaim1", new TestBolt(), bolts).shuffleGrouping("word");
return builder;
}
use of org.apache.heron.api.topology.TopologyBuilder in project heron by twitter.
the class HeronSubmitterTest method testTopologySubmissionWhenTmpDirectoryIsSetAsInvalidPath.
@Test(expected = TopologySubmissionException.class)
@PrepareForTest(HeronSubmitter.class)
public void testTopologySubmissionWhenTmpDirectoryIsSetAsInvalidPath() throws AlreadyAliveException, InvalidTopologyException {
TopologyBuilder builder = createTopologyBuilderWithMinimumSetup();
Config conf = new Config();
Map<String, String> map = new HashMap();
map.put("cmdline.topologydefn.tmpdirectory", "invalid_path");
PowerMockito.spy(HeronSubmitter.class);
Mockito.when(HeronSubmitter.getHeronCmdOptions()).thenReturn(map);
HeronSubmitter.submitTopology("test", conf, builder.createTopology());
}
use of org.apache.heron.api.topology.TopologyBuilder in project heron by twitter.
the class HeronSubmitterTest method testTopologySubmissionWhenTmpDirectoryIsNotSet.
@Test(expected = TopologySubmissionException.class)
public void testTopologySubmissionWhenTmpDirectoryIsNotSet() throws AlreadyAliveException, InvalidTopologyException {
TopologyBuilder builder = createTopologyBuilderWithMinimumSetup();
Config conf = new Config();
HeronSubmitter.submitTopology("test", conf, builder.createTopology());
}
Aggregations