use of com.twitter.heron.api.Config in project incubator-heron by apache.
the class TopologyUtilsTest method testGetComponentDiskMapDefaultValue.
@Test
public void testGetComponentDiskMapDefaultValue() {
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 disk map
Map<String, ByteAmount> diskMap = new TreeMap<>(TopologyUtils.getComponentDiskMapConfig(TopologyTests.createTopology("test", topologyConfig, spouts, bolts)));
// Component disk map is not set, the diskMap size should be 0
Assert.assertEquals(0, diskMap.size());
}
use of com.twitter.heron.api.Config in project incubator-heron by apache.
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 com.twitter.heron.api.Config in project incubator-heron by apache.
the class TopologyUtilsTest method testGetComponentDiskMapSomeDiskSpecified.
@Test
public void testGetComponentDiskMapSomeDiskSpecified() {
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);
ByteAmount spoutDisk = ByteAmount.fromGigabytes(2);
topologyConfig.setComponentDisk("spout", spoutDisk);
// sort the component disk map
Map<String, ByteAmount> diskMap = new TreeMap<>(TopologyUtils.getComponentDiskMapConfig(TopologyTests.createTopology("test", topologyConfig, spouts, bolts)));
// Component disk map sets only spout's disk
Assert.assertArrayEquals(new String[] { "spout" }, diskMap.keySet().toArray());
Assert.assertArrayEquals(new ByteAmount[] { spoutDisk }, diskMap.values().toArray());
}
use of com.twitter.heron.api.Config in project incubator-heron by apache.
the class TopologyUtilsTest method testGetComponentCpuMapAllCpuSpecified.
@Test
public void testGetComponentCpuMapAllCpuSpecified() {
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);
double boltCpu = 1.0;
double spoutCpu = 2.0;
topologyConfig.setComponentCpu("spout", spoutCpu);
topologyConfig.setComponentCpu("bolt", boltCpu);
// sort the component cpu map
Map<String, Double> cpuMap = new TreeMap<>(TopologyUtils.getComponentCpuMapConfig(TopologyTests.createTopology("test", topologyConfig, spouts, bolts)));
Assert.assertArrayEquals(new String[] { "bolt", "spout" }, cpuMap.keySet().toArray());
Assert.assertArrayEquals(new Double[] { boltCpu, spoutCpu }, cpuMap.values().toArray());
}
use of com.twitter.heron.api.Config in project incubator-heron by apache.
the class AbstractTestTopology method submit.
public final void submit(Config userConf) throws AlreadyAliveException, InvalidTopologyException {
TestTopologyBuilder builder = new TestTopologyBuilder(httpServerResultsUrl, httpServerStateUrl, stateUpdateToken, spoutWrapperType);
Config conf = buildConfig(new BasicConfig());
if (userConf != null) {
conf.putAll(userConf);
}
HeronSubmitter.submitTopology(topologyName, conf, buildTopology(builder).createTopology());
}
Aggregations