Package com.beust.jcommander

Examples of com.beust.jcommander.JCommander


public class QuerySubmitter {

  public static void main(String args[]) throws Exception {
    QuerySubmitter submitter = new QuerySubmitter();
    Options o = new Options();
    JCommander jc = null;
    try {
      jc = new JCommander(o, args);
      jc.setProgramName("./submit_plan");
    } catch (ParameterException e) {
      System.out.println(e.getMessage());
      String[] valid = {"-f", "file", "-t", "physical"};
      new JCommander(o, valid).usage();
      System.exit(-1);
    }
    if (o.help) {
      jc.usage();
      System.exit(0);
    }

    System.exit(submitter.submitQuery(o.location, o.queryString, o.planType, o.zk, o.local, o.bits, o.format, o.width));
  }
View Full Code Here


    private static final int DEFAULT_FORKS = 1;


    public static void main(String[] args) {

        final JCommander jCommander = new JCommander();

        try {
            final InputOptions options = parseOptions(jCommander, args);

            final List<Integer> Ks = options.numSourceSymbolsList();
View Full Code Here

    public static void main(final String[] args)
            throws Exception
    {
        final LoadGeneratorCommandLineConfig config = new LoadGeneratorCommandLineConfig();
        JCommander jCommander = new JCommander(config, args);

        if (config.displayUsage) {
            jCommander.usage();
        } else {
            injector = Guice.createInjector(
                    Stage.PRODUCTION,
                    new ConfigurationModule(new ConfigurationFactory(buildConfigMap(config))),
                    new LifeCycleModule(),
View Full Code Here

 
  String quoted = "\" \"";

  @Test
  public void testMain() {
    JCommander jc = new JCommander(this);
    jc.parse(quoted);
    Assert.assertEquals(args.size(), 1);
    Assert.assertEquals(args.get(0), " ");
  }
View Full Code Here

@Test
public class DynamicParameterTest {

  @Test(expectedExceptions = ParameterException.class)
  public void nonMapShouldThrow() {
    new JCommander(new DSimpleBad()).parse("-D", "a=b", "-D", "c=d");
  }
View Full Code Here

  }

  @Test(expectedExceptions = ParameterException.class)
  public void wrongSeparatorShouldThrow() {
    DSimple ds = new DSimple();
    new JCommander(ds).parse("-D", "a:b", "-D", "c=d");
  }
View Full Code Here

    new JCommander(ds).parse("-D", "a:b", "-D", "c=d");
  }

  private void simple(String... parameters) {
    DSimple ds = new DSimple();
    new JCommander(ds).parse(parameters);
    Assert.assertEquals(ds.params, Maps.newHashMap("a", "b", "c", "d"));
  }
View Full Code Here

    simple("-Da=b", "-Dc=d");
  }

  public void usage() {
    DSimple ds = new DSimple();
    new JCommander(ds).usage(new StringBuilder());
  }
View Full Code Here

    new JCommander(ds).usage(new StringBuilder());
  }

  public void differentAssignment() {
    DSimple ds = new DSimple();
    new JCommander(ds).parse("-D", "a=b", "-A", "c@d");
    Assert.assertEquals(ds.params, Maps.newHashMap("a", "b"));
    Assert.assertEquals(ds.params2, Maps.newHashMap("c", "d"));
  }
View Full Code Here

  public List<ChoiceType> choices = new ArrayList<ChoiceType>();

  public static void main(String[] args1) {
    ArgsEnum args = new ArgsEnum();
    String[] argv = { "-choice", "ONE"};
    JCommander jc = new JCommander(args, argv);
    jc.usage();
    Assert.assertEquals(jc.getParameters().get(0).getDescription(),
        "Options: " + EnumSet.allOf((Class<? extends Enum>) ArgsEnum.ChoiceType.class));
  }
View Full Code Here

TOP

Related Classes of com.beust.jcommander.JCommander

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.