Examples of CmdLineArgs


Examples of org.apache.oodt.cas.cli.CmdLineArgs

* @author bfoster (Brian Foster)
*/
public class TestCmdLineUtility extends TestCase {

   public void testCheck() {
      CmdLineArgs args = getArgs();

      // Expect pass.
      assertEquals(0, CmdLineUtility.check(args).size());

      // Expect fail.
      args.getSupportedOptions().add(
            TestUtils.createSimpleOption("ReqTestAction", true));
      assertEquals(1, CmdLineUtility.check(args).size());
   }
View Full Code Here

Examples of org.apache.oodt.cas.cli.CmdLineArgs

            TestUtils.createSimpleOption("ReqTestAction", true));
      assertEquals(1, CmdLineUtility.check(args).size());
   }

   public void testValidate() {
      CmdLineArgs args = getArgs();

      // Expect pass.
      assertEquals(1, CmdLineUtility.validate(args).size());
      assertEquals(Result.Grade.PASS, CmdLineUtility.validate(args).get(0)
            .getGrade());

      // Add validator which will cause fail.
      AdvancedCmdLineOption option = (AdvancedCmdLineOption) getOptionByName("message", args.getSupportedOptions());
      ArgRegExpCmdLineOptionValidator validator = new ArgRegExpCmdLineOptionValidator();
      validator.setAllowedArgs(Lists.newArrayList("\\d{1,2}"));
      option.addValidator(validator);

      // Expect fail.
View Full Code Here

Examples of org.apache.oodt.cas.cli.CmdLineArgs

      // Expect fail.
      assertFalse(determineFailedValidation(validate(args)).isEmpty());
   }

   public void testHandle() {
      CmdLineArgs args = getArgs();

      // Verify handling works.
      PrintMessageAction action = (PrintMessageAction) args
            .getSpecifiedAction();
      assertNull(action.getMessage());
      CmdLineUtility.handle(args);
      assertEquals("Test Message", action.getMessage());
   }
View Full Code Here

Examples of org.apache.oodt.cas.cli.CmdLineArgs

      specifiedOptions.add(createOptionInstance(option, "Test Message"));
      specifiedOptions.add(createOptionInstance(createActionOption("action"),
            "TestAction"));

      // Setup CmdLineArgs.
      return new CmdLineArgs(actions, options, specifiedOptions);
   }
View Full Code Here

Examples of org.apache.oodt.cas.cli.CmdLineArgs

   public void testBaseCase() {
      CmdLineOptionInstance specifiedAction = createOptionInstance(
            ACTION_OPTION, TEST_ACTION_1.getName());
      Set<CmdLineOptionInstance> specifiedOptions = newHashSet(specifiedAction);
      CmdLineArgs args = new CmdLineArgs(SUPPORTED_ACTIONS, SUPPORTED_OPTIONS,
            specifiedOptions);
      assertEquals(TEST_ACTION_1, args.getSpecifiedAction());
      assertEquals(args.getActionOptionInst(), specifiedAction);
      assertEquals(ACTION_OPTION, args.getActionOptionInst().getOption());
      assertNull(args.getHelpOptionInst());
      assertNull(args.getPrintSupportedActionsOptionInst());
   }
View Full Code Here

Examples of org.apache.oodt.cas.cli.CmdLineArgs

   public void testCaseActionNotSupported() {
      CmdLineOptionInstance specifiedAction = createOptionInstance(
            ACTION_OPTION, "NotSupportedActionName");
      Set<CmdLineOptionInstance> specifiedOptions = newHashSet(specifiedAction);
      CmdLineArgs args = new CmdLineArgs(SUPPORTED_ACTIONS, SUPPORTED_OPTIONS,
            specifiedOptions);

      // Verify that CmdLineAction is null since it was not able to be located
      // in set of supported actions.
      assertNull(args.getSpecifiedAction());
      // Verify that if did find the action option.
      assertEquals(specifiedAction.getOption(), args.getActionOptionInst()
            .getOption());
      // Verify that if found the specified action even though it is not
      // supported.
      assertEquals(newArrayList("NotSupportedActionName"), args
            .getActionOptionInst().getValues());
   }
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.