use of org.apache.heron.api.Config in project heron by twitter.
the class AbstractTupleRoutingTest method constructPhysicalPlan.
private PhysicalPlans.PhysicalPlan constructPhysicalPlan() {
PhysicalPlans.PhysicalPlan.Builder physicalPlanBuilder = PhysicalPlans.PhysicalPlan.newBuilder();
// Set topology protobuf
TopologyBuilder topologyBuilder = new TopologyBuilder();
initSpout(topologyBuilder, Component.SPOUT.getName());
initBoltA(topologyBuilder, Component.BOLT_A.getName(), Component.SPOUT.getName());
initBoltB(topologyBuilder, Component.BOLT_B.getName(), Component.BOLT_A.getName());
Config conf = new Config();
conf.setTeamEmail("some-team@company.com");
conf.setTeamName("some-team");
conf.setTopologyProjectName("heron-integration-test");
conf.setNumStmgrs(1);
conf.setMaxSpoutPending(100);
conf.setTopologyReliabilityMode(Config.TopologyReliabilityMode.ATMOST_ONCE);
TopologyAPI.Topology topology = topologyBuilder.createTopology().setName("topology-name").setConfig(conf).setState(TopologyAPI.TopologyState.RUNNING).getTopology();
physicalPlanBuilder.setTopology(topology);
// Set instances
int taskId = 0;
for (Component component : Component.values()) {
addComponent(physicalPlanBuilder, component, taskId++);
}
// Set stream mgr
PhysicalPlans.StMgr.Builder stmgr = PhysicalPlans.StMgr.newBuilder();
stmgr.setId("stream-manager-id");
stmgr.setHostName("127.0.0.1");
stmgr.setDataPort(8888);
stmgr.setLocalEndpoint("endpoint");
physicalPlanBuilder.addStmgrs(stmgr);
return physicalPlanBuilder.build();
}
use of org.apache.heron.api.Config in project heron by twitter.
the class TopologyUtilsTest method testGetComponentRamMapDefaultValue.
@Test
public void testGetComponentRamMapDefaultValue() {
int componentParallelism = 2;
Config topologyConfig = new Config();
Map<String, Integer> spouts = new HashMap<>();
spouts.put("spout", componentParallelism);
Map<String, Integer> bolts = new HashMap<>();
bolts.put("bolt", componentParallelism);
// sort the component RAM map
Map<String, ByteAmount> ramMap = new TreeMap<>(TopologyUtils.getComponentRamMapConfig(TopologyTests.createTopology("test", topologyConfig, spouts, bolts)));
// Component RAM map is not set, the ramMap size should be 0
Assert.assertEquals(0, ramMap.size());
}
use of org.apache.heron.api.Config in project heron by twitter.
the class TopologyUtilsTest method testValidTopology.
@Test
public void testValidTopology() {
int componentParallelism = 2;
Map<String, Integer> spouts = new HashMap<>();
spouts.put("spout", componentParallelism);
Map<String, Integer> bolts = new HashMap<>();
bolts.put("bolt", componentParallelism);
Map<String, String> connections = new HashMap<>();
connections.put("bolt", "spout");
Assert.assertTrue(TopologyUtils.verifyTopology(TopologyTests.createTopologyWithConnection("testTopology", /* Bad topology name */
new Config(), spouts, bolts, connections)));
}
use of org.apache.heron.api.Config in project heron by twitter.
the class HeronEcoBuilderTest method testBuild_EmptyConfigMap_ReturnsDefaultConfigs.
@Test
public void testBuild_EmptyConfigMap_ReturnsDefaultConfigs() throws Exception {
Config config = new Config();
when(mockConfigBuilder.buildConfig(eq(ecoTopologyDefinition))).thenReturn(config);
Config returnedConfig = subject.buildConfig(ecoTopologyDefinition);
verify(mockConfigBuilder).buildConfig(same(ecoTopologyDefinition));
assertThat(returnedConfig.get(Config.TOPOLOGY_DEBUG), is(nullValue()));
assertThat(config, sameInstance(returnedConfig));
}
use of org.apache.heron.api.Config in project heron by twitter.
the class EcoSubmitterTest method submitStormTopology_AllGood_BehavesAsExpected.
@Test
public void submitStormTopology_AllGood_BehavesAsExpected() throws Exception {
Config config = new Config();
StormTopology topology = new StormTopology();
PowerMockito.spy(StormSubmitter.class);
PowerMockito.doNothing().when(StormSubmitter.class, "submitTopology", any(String.class), any(Config.class), any(StormTopology.class));
subject.submitStormTopology("name", config, topology);
PowerMockito.verifyStatic(times(1));
StormSubmitter.submitTopology(anyString(), any(Config.class), any(StormTopology.class));
}
Aggregations