use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.
the class ParserTopologyCLITest method testParserParallelism.
@Test
public void testParserParallelism() throws Exception {
testConfigOption(ParserTopologyCLI.ParserOptions.PARSER_PARALLELISM, "10", input -> input.getParserParallelism().equals(10), () -> {
SensorParserConfig config = getBaseConfig();
config.setParserParallelism(20);
return Collections.singletonList(config);
}, input -> input.getParserParallelism().equals(20));
}
use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.
the class ParserTopologyCLITest method testTopologyConfig.
@Test
public void testTopologyConfig() throws Exception {
File extraConfig = File.createTempFile("topologyConfig", "json");
extraConfig.deleteOnExit();
writeMap(extraConfig, new HashMap<String, Object>() {
{
put(Config.TOPOLOGY_DEBUG, true);
}
});
testConfigOption(new EnumMap<ParserTopologyCLI.ParserOptions, String>(ParserTopologyCLI.ParserOptions.class) {
{
put(ParserTopologyCLI.ParserOptions.NUM_WORKERS, "10");
put(ParserTopologyCLI.ParserOptions.NUM_ACKERS, "20");
put(ParserTopologyCLI.ParserOptions.EXTRA_OPTIONS, extraConfig.getAbsolutePath());
}
}, input -> {
Config c = input.getStormConf();
return (int) c.get(Config.TOPOLOGY_WORKERS) == 10 && (int) c.get(Config.TOPOLOGY_ACKER_EXECUTORS) == 20 && (boolean) c.get(Config.TOPOLOGY_DEBUG);
}, () -> {
SensorParserConfig config = getBaseConfig();
config.setStormConfig(new HashMap<String, Object>() {
{
put(Config.TOPOLOGY_WORKERS, 100);
put(Config.TOPOLOGY_ACKER_EXECUTORS, 200);
}
});
return Collections.singletonList(config);
}, input -> {
Config c = input.getStormConf();
return (int) c.get(Config.TOPOLOGY_WORKERS) == 100 && (int) c.get(Config.TOPOLOGY_ACKER_EXECUTORS) == 200 && !c.containsKey(Config.TOPOLOGY_DEBUG);
});
}
use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.
the class ParserTopologyCLITest method testParserNumTasksMultiple.
@Test
public void testParserNumTasksMultiple() throws Exception {
testConfigOption(ParserTopologyCLI.ParserOptions.PARSER_NUM_TASKS, "10", input -> input.getParserNumTasks().equals(10), () -> {
SensorParserConfig config = getBaseConfig();
config.setParserNumTasks(20);
return Collections.singletonList(config);
}, input -> input.getParserNumTasks().equals(20));
}
use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.
the class ParserTopologyCLITest method testTopologyConfig_fromConfigExplicitly.
@Test
public void testTopologyConfig_fromConfigExplicitly() throws Exception {
testConfigOption(new EnumMap<ParserTopologyCLI.ParserOptions, String>(ParserTopologyCLI.ParserOptions.class) {
{
put(ParserTopologyCLI.ParserOptions.NUM_WORKERS, "10");
put(ParserTopologyCLI.ParserOptions.NUM_ACKERS, "20");
}
}, input -> {
Config c = input.getStormConf();
return (int) c.get(Config.TOPOLOGY_WORKERS) == 10 && (int) c.get(Config.TOPOLOGY_ACKER_EXECUTORS) == 20;
}, () -> {
SensorParserConfig config = getBaseConfig();
config.setNumWorkers(100);
config.setNumAckers(200);
return Collections.singletonList(config);
}, input -> {
Config c = input.getStormConf();
return (int) c.get(Config.TOPOLOGY_WORKERS) == 100 && (int) c.get(Config.TOPOLOGY_ACKER_EXECUTORS) == 200;
});
}
use of org.apache.metron.common.configuration.SensorParserConfig in project metron by apache.
the class ParserTopologyCLITest method testSpoutNumTasksMultiple.
@Test
public void testSpoutNumTasksMultiple() throws Exception {
// Return one per spout.
List<Integer> numTasksCli = new ArrayList<>();
numTasksCli.add(10);
numTasksCli.add(12);
List<Integer> numTasksConfig = new ArrayList<>();
numTasksConfig.add(20);
numTasksConfig.add(30);
testConfigOption(ParserTopologyCLI.ParserOptions.SPOUT_NUM_TASKS, "10,12", input -> input.getSpoutNumTasks().equals(numTasksCli), () -> {
SensorParserConfig config = getBaseConfig();
config.setSpoutNumTasks(20);
SensorParserConfig config2 = getBaseConfig();
config2.setSpoutNumTasks(30);
List<SensorParserConfig> configs = new ArrayList<>();
configs.add(config);
configs.add(config2);
return configs;
}, input -> input.getSpoutNumTasks().equals(numTasksConfig));
}
Aggregations