Package org.apache.felix.gogo.commands.basic

Examples of org.apache.felix.gogo.commands.basic.SimpleCommand


    }

    public void testCommand() throws Exception {
        Context c = new Context();
        c.addCommand("capture", this);
        c.addCommand("my-action", new SimpleCommand(MyAction.class));

        // Test help
        Object help = c.execute("my-action --help | capture");
        assertTrue(help instanceof String);
        assertTrue(((String) help).indexOf("My Action") >= 0);
View Full Code Here


        assertEquals(Arrays.asList(4), c.execute("my-action --increment 3"));
    }

    public void testCommandTwoArguments() throws Exception {
        Context c = new Context();
        c.addCommand("my-action-two-arguments", new SimpleCommand(MyActionTwoArguments.class));

        // test required argument
        try {
            c.execute("my-action-two-arguments");
            fail("Action should have thrown an exception because of a missing argument");
View Full Code Here

    }

    public void testCommand() throws Exception {
        Context c = new Context();
        c.addCommand("capture", this);
        c.addCommand("my-action", new SimpleCommand(MyAction.class));

        // Test help
        Object help = c.execute("my-action --help | capture");
        assertTrue(help instanceof String);
        assertTrue(((String) help).indexOf("My Action") >= 0);
View Full Code Here

        assertEquals(Arrays.asList(4), c.execute("my-action --increment 3"));
    }

    public void testCommandTwoArguments() throws Exception {
        Context c = new Context();
        c.addCommand("my-action-two-arguments", new SimpleCommand(MyActionTwoArguments.class));

        try {
            c.execute("my-action-two-arguments");
            fail("Action should have thrown an exception because of a missing argument");
        } catch (CommandException e) {
View Full Code Here

    }

    public void testCommand() throws Exception {
        Context c= new Context();
        c.addCommand("capture", this);
        c.addCommand("my-action", new SimpleCommand(MyAction.class));

        // Test help
        Object help = c.execute("my-action --help | capture");
        assertTrue(help instanceof String);
        assertTrue(((String) help).indexOf("My Action") >= 0);
View Full Code Here

public class BooleanCompleterTest extends CompleterTestSupport {

    @Test
    public void testCompleteArgumnets() throws Exception {
        CommandSession session = new DummyCommandSession();
        Completer comp = new ArgumentCompleter(session, new SimpleCommand(MyAction.class), "my:action");

        // arg 0
        assertEquals(Arrays.asList("true "), complete(comp, "action t"));
        assertEquals(Arrays.asList("false "), complete(comp, "action f"));
View Full Code Here

public class FileCompleterTest extends CompleterTestSupport {

    @Test
    public void testCompleteArgumnets() throws Exception {
        CommandSession session = new DummyCommandSession();
        Completer comp = new ArgumentCompleter(session, new SimpleCommand(MyAction.class), "my:action");

        // arg 0
        assertEquals(Arrays.asList("src"+File.separator), complete(comp, "action s"));
        assertEquals(Arrays.asList("main"+File.separator), complete(comp, "action src/m"));
        assertEquals(Arrays.asList("java"+File.separator), complete(comp, "action src/main/j"));
View Full Code Here

public class CompleterValuesTest extends CompleterTestSupport {

    @Test
    public void testCompleteArgumnets() throws Exception {
        CommandSession session = new DummyCommandSession();
        Completer comp = new ArgumentCompleter(session, new SimpleCommand(MyAction.class), "my:action");

        // arg 0
        assertEquals(Arrays.asList("a1", "a2", "a3"), complete(comp, "action a"));
        assertEquals(Arrays.asList("b4", "b5"), complete(comp, "action b"));
View Full Code Here

    }

    public void testCommand() throws Exception {
        Context c= new Context();
        c.addCommand("capture", this);
        c.addCommand("my-action", new SimpleCommand(MyAction.class));

        // Test help
        Object help = c.execute("my-action --help | capture");
        assertTrue(help instanceof String);
        assertTrue(((String) help).indexOf("My Action") >= 0);
View Full Code Here

    }

    public void testCommand() throws Exception {
        Context c= new Context();
        c.addCommand("capture", this);
        c.addCommand("my-action", new SimpleCommand(MyAction.class));

        // Test help
        Object help = c.execute("my-action --help | capture");
        assertTrue(help instanceof String);
        assertTrue(((String) help).indexOf("My Action") >= 0);
View Full Code Here

TOP

Related Classes of org.apache.felix.gogo.commands.basic.SimpleCommand

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.