Search in sources :

Example 6 with CmdLineParser

use of org.kohsuke.args4j.CmdLineParser in project pinot by linkedin.

the class PerfBenchmarkRunner method main.

/**
   * Main method for the class.
   *
   * @param args arguments for the perf benchmark runner.
   * @throws Exception
   */
public static void main(String[] args) throws Exception {
    PerfBenchmarkRunner perfBenchmarkRunner = new PerfBenchmarkRunner();
    CmdLineParser parser = new CmdLineParser(perfBenchmarkRunner);
    parser.parseArgument(args);
    if (perfBenchmarkRunner._help) {
        perfBenchmarkRunner.printUsage();
    } else {
        perfBenchmarkRunner.execute();
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser)

Example 7 with CmdLineParser

use of org.kohsuke.args4j.CmdLineParser in project buck by facebook.

the class StringSetOptionHandlerTest method testOptionSpecifiedWithoutElements.

@Test(expected = IllegalArgumentException.class)
public void testOptionSpecifiedWithoutElements() throws CmdLineException {
    TestBean bean = new TestBean();
    CmdLineParser parser = new CmdLineParser(bean);
    parser.parseArgument("--option1", "a", "--option2", "c", "d", "--option1", "--option2", "f");
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) Test(org.junit.Test)

Example 8 with CmdLineParser

use of org.kohsuke.args4j.CmdLineParser in project buck by facebook.

the class StringSetOptionHandlerTest method testDefaultValues.

@Test
public void testDefaultValues() throws CmdLineException {
    TestBean bean = new TestBean();
    CmdLineParser parser = new CmdLineParser(bean);
    parser.parseArgument("--option2", "a", "b");
    assertEquals(ImmutableSet.of(), bean.getOption1());
    assertEquals(ImmutableSet.of("a", "b"), bean.getOption2());
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) Test(org.junit.Test)

Example 9 with CmdLineParser

use of org.kohsuke.args4j.CmdLineParser in project buck by facebook.

the class StringSetOptionHandlerTest method testEmptyOption.

@Test(expected = IllegalArgumentException.class)
public void testEmptyOption() throws CmdLineException {
    TestBean bean = new TestBean();
    CmdLineParser parser = new CmdLineParser(bean);
    parser.parseArgument("--option1", "--option2", "c", "d", "--option2", "f");
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) Test(org.junit.Test)

Example 10 with CmdLineParser

use of org.kohsuke.args4j.CmdLineParser in project buck by facebook.

the class TargetDeviceCommandLineOptionsTest method serialFlagOverridesEnvironment.

@Test
public void serialFlagOverridesEnvironment() {
    TargetDeviceCommandLineOptions options = new TargetDeviceCommandLineOptions("1234");
    TargetDevice device = options.getTargetDeviceOptional().get();
    assertEquals("1234", device.getIdentifier().get());
    try {
        new CmdLineParser(options).parseArgument("-s", "5678");
    } catch (CmdLineException e) {
        fail("Unable to parse arguments");
    }
    device = options.getTargetDeviceOptional().get();
    assertEquals("5678", device.getIdentifier().get());
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) CmdLineException(org.kohsuke.args4j.CmdLineException) TargetDevice(com.facebook.buck.step.TargetDevice) Test(org.junit.Test)

Aggregations

CmdLineParser (org.kohsuke.args4j.CmdLineParser)208 CmdLineException (org.kohsuke.args4j.CmdLineException)165 IOException (java.io.IOException)45 File (java.io.File)27 Test (org.junit.Test)14 KeeperException (org.apache.zookeeper.KeeperException)12 ArrayList (java.util.ArrayList)11 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)10 IHyracksClientConnection (org.apache.hyracks.api.client.IHyracksClientConnection)10 Directory (org.apache.lucene.store.Directory)10 FSDirectory (org.apache.lucene.store.FSDirectory)10 JobId (org.apache.hyracks.api.job.JobId)9 JobSpecification (org.apache.hyracks.api.job.JobSpecification)9 ClientException (com.ms.silverking.cloud.dht.client.ClientException)8 PutException (com.ms.silverking.cloud.dht.client.PutException)8 SKGridConfiguration (com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration)8 PrintStream (java.io.PrintStream)8 List (java.util.List)8 RetrievalException (com.ms.silverking.cloud.dht.client.RetrievalException)7 IndexArgs (io.anserini.index.IndexArgs)7