Package org.apache.oodt.cas.cli.option

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


      groupOption.addSubOption(new GroupSubOption(subOption, false));
      assertTrue(CmdLineUtils.isSubOption(groupOption, subOption));
   }

   public void testFindPerformAndQuitOptions() {
      AdvancedCmdLineOption performAndQuitOption = createAdvancedOption("help",
            null);
      performAndQuitOption.setPerformAndQuit(true);
      AdvancedCmdLineOption otherOption = createAdvancedOption("help", null);
      otherOption.setPerformAndQuit(false);

      CmdLineOptionInstance performAndQuitOptionInstance = new CmdLineOptionInstance(
            performAndQuitOption, new ArrayList<String>());
      CmdLineOptionInstance otherInstance = new CmdLineOptionInstance(
            otherOption, new ArrayList<String>());
View Full Code Here


            CmdLineUtils.findPerformAndQuitOptions(Sets.newHashSet(
                  performAndQuitOptionInstance, otherInstance)));
   }

   public void testIsPerformAndQuitOption() {
      AdvancedCmdLineOption performAndQuitOption = createAdvancedOption("help",
            null);
      performAndQuitOption.setPerformAndQuit(true);
      AdvancedCmdLineOption otherOption = createAdvancedOption("help", null);
      otherOption.setPerformAndQuit(false);

      assertTrue(CmdLineUtils.isPerformAndQuitOption(performAndQuitOption));
      assertFalse(CmdLineUtils.isPerformAndQuitOption(otherOption));
   }
View Full Code Here

         fail("Should have thrown IllegalArgumentException");
      } catch (IllegalArgumentException ignore) { /* expect throw */ }
   }

   public void testValidate() {
      AdvancedCmdLineOption option = new AdvancedCmdLineOption("t", "test", "",
            true);
      AllowedArgsCmdLineOptionValidator validator = new AllowedArgsCmdLineOptionValidator();
      validator.setAllowedArgs(Lists.newArrayList("value"));
      option.setValidators(Lists
            .newArrayList((CmdLineOptionValidator) validator));

      // Test case fail.
      assertFalse(determineFailedValidation(validate(createOptionInstance(option, "value1"))).isEmpty());
      // Test case pass.
View Full Code Here

   }

   public void testHandle() {
      CmdLineAction action = createAction("testAction");
      action.setDescription("test description");
      AdvancedCmdLineOption option = new AdvancedCmdLineOption("t", "test", "",
            true);
      // Insure runs with no errors when action doesn't have a handler.
      CmdLineUtils.handle(action, createOptionInstance(option));

      // Test case when option has a handler.
      option.setHandler(new CmdLineOptionHandler() {
         @Override
         public void initialize(CmdLineOption option) {}

         @Override
         public void handleOption(CmdLineAction selectedAction,
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.cli.option.AdvancedCmdLineOption

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.