Examples of CmdLineOption


Examples of org.apache.oodt.cas.cli.option.CmdLineOption

      assertEquals(actionOptionInst, CmdLineUtils.getOptionInstanceByName(
            actionOptionInst.getOption().getLongOption(), optionInsts));
   }

   public void testIsSubOption() {
      CmdLineOption subOption = createSimpleOption("test", false);
      GroupCmdLineOption groupOption = createGroupOption("group", false);
      assertFalse(CmdLineUtils.isSubOption(groupOption, subOption));

      groupOption.addSubOption(new GroupSubOption(subOption, false));
      assertTrue(CmdLineUtils.isSubOption(groupOption, subOption));
View Full Code Here

Examples of org.apache.oodt.cas.cli.option.CmdLineOption

      assertTrue(CmdLineUtils.isPerformAndQuitOption(performAndQuitOption));
      assertFalse(CmdLineUtils.isPerformAndQuitOption(otherOption));
   }

   public void testFindSpecifiedOption() {
      CmdLineOption findOption = createSimpleOption("test", false);
      Set<CmdLineOptionInstance> options = Sets.newHashSet(
            createOptionInstance(createSimpleOption("test1", false)),
            createOptionInstance(createSimpleOption("test2", false)));

      assertNull(CmdLineUtils.findSpecifiedOption(findOption, options));
View Full Code Here

Examples of org.apache.oodt.cas.cli.option.CmdLineOption

      assertEquals(createOptionInstance(findOption),
            CmdLineUtils.findSpecifiedOption(findOption, options));
   }

   public void testFindAllOfSpecifiedOption() {
      CmdLineOption findOption = createSimpleOption("test", false);
      Set<CmdLineOptionInstance> options = Sets.newHashSet(
            createOptionInstance(createSimpleOption("test1", false)),
            createOptionInstance(createSimpleOption("test2", false)));

      assertTrue(CmdLineUtils.findAllOfSpecifiedOption(findOption, options)
View Full Code Here

Examples of org.apache.oodt.cas.cli.option.CmdLineOption

      assertTrue(CmdLineUtils
            .isPrintSupportedActionsOption(new PrintSupportedActionsCmdLineOption()));
   }

   public void testFindPrintSupportedActionsOption() {
      CmdLineOption psaAction = new PrintSupportedActionsCmdLineOption();
      Set<CmdLineOption> options = Sets.newHashSet(
            (CmdLineOption) createSimpleOption("test", false),
            createSimpleOption("test2", false));

      assertNull(CmdLineUtils.findPrintSupportedActionsOption(options));
View Full Code Here

Examples of org.apache.oodt.commons.option.CmdLineOption

                    curArg = curArg.substring(2);
                else
                    curArg = curArg.substring(1);

                // check if option is a valid one
                CmdLineOption curOption = CmdLineOptionUtils.getOptionByName(
                        curArg, validOptions);
                if (curOption == null)
                    throw new IOException("Invalid option '" + curArg + "'");

                // check if option has arguments
                List<String> values = new LinkedList<String>();
                if (curOption.hasArgs()) {
                    while (j + 1 < args.length && !args[j + 1].startsWith("-"))
                        values.add(args[++j]);
                    if (values.size() < 1)
                        throw new IOException("Option " + curArg
                                + " should have at least one argument");
                }

                //check if is a perform and quit option
                if (curOption.isPerformAndQuit()) {
                  curOption.getHandler().handleOption(curOption, values);
                  System.exit(0);
                }
               
                // add to list of option instances
                optionInstances
View Full Code Here

Examples of org.apache.oodt.commons.option.CmdLineOption

        applyBeans.add(info);

        CmdLineOptionBeanHandler handler = new CmdLineOptionBeanHandler();
        handler.setApplyToBeans(applyBeans);

        CmdLineOption option = new CmdLineOption();
        option.setHandler(handler);
        option.setHasArgs(false);
        option.setId("foo");
        option.setDescription("bar");
        option.setLongOption("foobar");
        option.setShortOption("f");
        option.setRequired(false);
        handler.handleOption(option, Collections.EMPTY_LIST);

        assertTrue(myTestBean.isFlag());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.