Package org.apache.geronimo.twiddle.config

Examples of org.apache.geronimo.twiddle.config.CommandConfig


        world = new ClassWorld();
        world.newRealm(Command.DEFAULT_CLASS_REALM);
       
        commandContainer = new CommandContainer();

        CommandConfig config = new CommandConfig();
        config.setName("Uno");
        config.setDescription("First Command");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");
        commandInfoOne = new CommandInfo(config, world);

        config = new CommandConfig();
        config.setName("Due");
        config.setDescription("Second Command");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");
        commandInfoTwo = new CommandInfo(config, world);

        super.setUp();
    }
View Full Code Here


    //                               Tests                                 //
    /////////////////////////////////////////////////////////////////////////

    public void testCreateCommand() throws Exception
    {
        CommandConfig config = new CommandConfig();
        String name = "mytest";
        String desc = "my test description";
        String type = "org.apache.geronimo.twiddle.command.TestCommand";
        config.setName(name);
        config.setDescription(desc);
        config.setCode(type);

        CommandInfo protoInfo = new CommandInfo(config, world);
        assertEquals(config,protoInfo.getConfig());
        assertTrue(protoInfo.hasDescription());
        Command command = protoInfo.getPrototype();
View Full Code Here

        command.execute(new String[0]);
    }

    public void testCreateCommandWithAttribute() throws Exception
    {
        CommandConfig config = new CommandConfig();
        config.setName("mytest");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");

        Attribute attr = new Attribute();
        String text = "this is the value for the text attribute";
        attr.setName("text");
        attr.setContent(text);
        config.addAttribute(attr);

        CommandInfo protoInfo = new CommandInfo(config, world);
        Command command = protoInfo.getPrototype();

        // Verify that the text attribute was set correctly
View Full Code Here

            new CommandFactory(null, null);
            fail("Expected NullArgumentException");
        } catch (NullArgumentException ignore) {
        }

        CommandConfig config = new CommandConfig();
        String name = "mytest";
        String desc = "my test description";
        String type = "org.apache.geronimo.twiddle.command.TestCommand";
        config.setName(name);
        config.setDescription(desc);
        config.setCode(type);

        commandFactory = new CommandFactory(config, world);
        assertEquals(config,commandFactory.getConfig());
        try {
            commandFactory.create();
        } catch (CommandException e) {
            fail("Unexpected CommandException: " + e);
        }

        try {
            new CommandFactory(new CommandConfig(), world).create();
            fail("Expected CommandException");
        } catch (CommandException ignore) {
        }
    }
View Full Code Here

        world = new ClassWorld();
        world.newRealm(Command.DEFAULT_CLASS_REALM);
       
        commandContainer = new CommandContainer();

        CommandConfig config = new CommandConfig();
        config.setName("Uno");
        config.setDescription("First Command");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");
        commandInfoOne = new CommandInfo(config, world);

        config = new CommandConfig();
        config.setName("Due");
        config.setDescription("Second Command");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");
        commandInfoTwo = new CommandInfo(config, world);

        super.setUp();
    }
View Full Code Here

    //                               Tests                                 //
    /////////////////////////////////////////////////////////////////////////

    public void testCreateCommand() throws Exception
    {
        CommandConfig config = new CommandConfig();
        String name = "mytest";
        String desc = "my test description";
        String type = "org.apache.geronimo.twiddle.command.TestCommand";
        config.setName(name);
        config.setDescription(desc);
        config.setCode(type);

        CommandInfo protoInfo = new CommandInfo(config, world);
        assertEquals(config,protoInfo.getConfig());
        assertTrue(protoInfo.hasDescription());
        Command command = protoInfo.getPrototype();
View Full Code Here

        command.execute(new String[0]);
    }

    public void testCreateCommandWithAttribute() throws Exception
    {
        CommandConfig config = new CommandConfig();
        config.setName("mytest");
        config.setCode("org.apache.geronimo.twiddle.command.TestCommand");

        Attribute attr = new Attribute();
        String text = "this is the value for the text attribute";
        attr.setName("text");
        attr.setContent(text);
        config.addAttribute(attr);

        CommandInfo protoInfo = new CommandInfo(config, world);
        Command command = protoInfo.getPrototype();

        // Verify that the text attribute was set correctly
View Full Code Here

            new CommandFactory(null, null);
            fail("Expected NullArgumentException");
        } catch (NullArgumentException ignore) {
        }

        CommandConfig config = new CommandConfig();
        String name = "mytest";
        String desc = "my test description";
        String type = "org.apache.geronimo.twiddle.command.TestCommand";
        config.setName(name);
        config.setDescription(desc);
        config.setCode(type);

        commandFactory = new CommandFactory(config, world);
        assertEquals(config,commandFactory.getConfig());
        try {
            commandFactory.create();
        } catch (CommandException e) {
            fail("Unexpected CommandException: " + e);
        }

        try {
            new CommandFactory(new CommandConfig(), world).create();
            fail("Expected CommandException");
        } catch (CommandException ignore) {
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.twiddle.config.CommandConfig

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.