Package org.impalaframework.command.framework

Examples of org.impalaframework.command.framework.CommandInfo


    foundClasses = handler.foundFiles;
    return true;
  }

  public CommandDefinition getCommandDefinition() {
    CommandInfo commandInfo = new CommandInfo("class", "Type (class or interface)", "Please specify class search text",
        null, null, true, false, false, false) {

      @Override
      public String validate(String input) {
        String superValidate = super.validate(input);
View Full Code Here


  public CommandDefinition getCommandDefinition() {

    // note that globalOverrides is true, so that the user will not be
    // prompted for the module name if it already there
    CommandInfo info = new CommandInfo(DIRECTORY_NAME, "Directory name",
        "Please enter directory to use as current working directory.", null, null, false, false, true, false);

    CommandDefinition definition = new CommandDefinition("Changes working directory");
    definition.add(info);
    return definition;
View Full Code Here

  public void addTestListener(TestCommandListener listener) {
    this.listeners.add(listener);
  }
 
  public CommandDefinition getCommandDefinition() {
    CommandInfo commandInfo = new CommandInfo("commandText", "Command text", "Please enter your command text",
        null, null, false, false, false, false);

    CommandDefinition commandDefinititon = new CommandDefinition();
    commandDefinititon.add(commandInfo);
    return commandDefinititon; 
View Full Code Here

        for (int i = 0; i < extraLines.length; i++) {
            extraLines[i] = (i + 1) + " " + alternatives[i];
        }

        CommandInfo ci1 = new CommandInfo("selection", "Selected value", "More than one alternative was found.\nPlease choose option by entering digit corresponding with selection",
                null,
                extraLines, true, false, false, false) {
            @Override
            public String validate(String input) {
                int selection = -1;
View Full Code Here

        foundClasses = handler.foundFiles;
        return true;
    }

    public CommandDefinition getCommandDefinition() {
        CommandInfo commandInfo = new CommandInfo("class", "Type (class or interface)", "Please specify class search text",
                null, null, true, false, false, false) {

            @Override
            public String validate(String input) {
                String superValidate = super.validate(input);
View Full Code Here

  public CommandDefinition getCommandDefinition() {

    // note that globalOverrides is true, so that the user will not be
    // prompted for the module name if it already there
    CommandInfo info = new CommandInfo(DIRECTORY_NAME, "Directory name",
        "Please enter directory to use as current working directory.", null, null, false, false, true, false);

    CommandDefinition definition = new CommandDefinition("Changes working directory");
    definition.add(info);
    return definition;
View Full Code Here

    foundClasses = handler.foundFiles;
    return true;
  }

  public CommandDefinition getCommandDefinition() {
    CommandInfo commandInfo = new CommandInfo("class", "Type (class or interface)", "Please specify class search text",
        null, null, true, false, false, false) {

      @Override
      public String validate(String input) {
        String superValidate = super.validate(input);
View Full Code Here

    public void testCommandDefinition()
    {
        AlternativeInputCommand command = new AlternativeInputCommand(new String[] { "one", "two" });
        CommandDefinition commandDefinition = command.getCommandDefinition();
        assertEquals(1, commandDefinition.getCommandInfos().size());
        CommandInfo ci = commandDefinition.getCommandInfos().get(0);
       
        String numberErrorMessage = "Invalid Selection. Selected number does not correspond with one of the values.\nPlease select a number between 1 and 2";
        assertEquals(numberErrorMessage, ci.validate("-1"));
        assertEquals(numberErrorMessage, ci.validate("3"));
       
        String alphaErrorMessage = "Invalid Selection. Please select a number corresponding with one of the alternative choices";
        assertEquals(alphaErrorMessage , ci.validate("a value"));
        assertEquals(null, ci.validate("2"));
    }
View Full Code Here

    public void testCommandDefinition() {
        ClassFindCommand command = new ClassFindCommand();
        CommandDefinition commandDefinition = command.getCommandDefinition();
        assertEquals(1, commandDefinition.getCommandInfos().size());
        CommandInfo ci = commandDefinition.getCommandInfos().get(0);

        String nullOrEmptyText = "Please enter type (class or interface) to find";
        try {
            assertEquals(nullOrEmptyText, ci.validate(null));
            fail();
        }
        catch (IllegalArgumentException e) {
        }
        assertEquals("Search text should be at least 3 characters long", ci.validate("a"));

    }
View Full Code Here

    }

    protected CommandDefinition newCommandDefinition() {

        // name is shared
        CommandInfo ci1 = new CommandInfo("name", "Name", "Please give your name", null, null, true, false, false, false);

        // date of birth is optional here
        CommandInfo ci2 = new CommandInfo("dateOfBirth", "Date of birth", "Please give your date of birth", null,
                null, false, true, false, false);

        // residence is supplied via global
        CommandInfo ci3 = new CommandInfo("residence", "Residence", "Where do you live", null, null, false, true, false,
                false);

        // house name is supplied via default
        CommandInfo ci4 = new CommandInfo("housename", "House name", "Name of your house?", "IvyD", null, false, true,
                false, false);

        CommandDefinition commandDefinition = new CommandDefinition();
        commandDefinition.add(ci1);
        commandDefinition.add(ci2);
View Full Code Here

TOP

Related Classes of org.impalaframework.command.framework.CommandInfo

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.