use of org.apache.commons.cli.PosixParser in project metron by apache.
the class LoadOptionsTest method testThreadsByCores.
@Test
public void testThreadsByCores() throws Exception {
CommandLine cli = LoadOptions.parse(new PosixParser(), new String[] { "-p", "2C" });
EnumMap<LoadOptions, Optional<Object>> results = LoadOptions.createConfig(cli);
Assert.assertEquals(2 * Runtime.getRuntime().availableProcessors(), results.get(LoadOptions.NUM_THREADS).get());
}
use of org.apache.commons.cli.PosixParser in project metron by apache.
the class LoadOptionsTest method testThreadsByNum.
@Test
public void testThreadsByNum() throws Exception {
CommandLine cli = LoadOptions.parse(new PosixParser(), new String[] { "-p", "5" });
EnumMap<LoadOptions, Optional<Object>> results = LoadOptions.createConfig(cli);
Assert.assertEquals(5, results.get(LoadOptions.NUM_THREADS).get());
}
use of org.apache.commons.cli.PosixParser in project metron by apache.
the class LoadOptionsTest method testHappyPath.
@Test
public void testHappyPath() throws Exception {
CommandLine cli = LoadOptions.parse(new PosixParser(), new String[] { "-eps", "1000", "-ot", "foo" });
EnumMap<LoadOptions, Optional<Object>> results = LoadOptions.createConfig(cli);
Assert.assertEquals(1000L, results.get(LoadOptions.EPS).get());
Assert.assertEquals("foo", results.get(LoadOptions.OUTPUT_TOPIC).get());
Assert.assertEquals(LoadGenerator.CONSUMER_GROUP, results.get(LoadOptions.CONSUMER_GROUP).get());
Assert.assertEquals(Runtime.getRuntime().availableProcessors(), results.get(LoadOptions.NUM_THREADS).get());
Assert.assertFalse(results.get(LoadOptions.BIASED_SAMPLE).isPresent());
Assert.assertFalse(results.get(LoadOptions.CSV).isPresent());
}
use of org.apache.commons.cli.PosixParser in project metron by apache.
the class ConfigurationManager method main.
public static void main(String... argv) throws Exception {
CommandLineParser parser = new PosixParser();
CommandLine cli = ConfigurationOptions.parse(parser, argv);
ConfigurationManager manager = new ConfigurationManager();
manager.run(cli);
}
use of org.apache.commons.cli.PosixParser in project metron by apache.
the class ConfigurationFunctionsTest method pushConfigs.
private static void pushConfigs(String inputPath) throws Exception {
String[] args = new String[] { "-z", zookeeperUrl, "--mode", "PUSH", "--input_dir", inputPath };
ConfigurationManager manager = new ConfigurationManager();
manager.run(ConfigurationManager.ConfigurationOptions.parse(new PosixParser(), args));
}
Aggregations