Package org.rhq.enterprise.communications.command.impl.generic

Examples of org.rhq.enterprise.communications.command.impl.generic.GenericCommand


     * Creates a simple test command.
     *
     * @return test command
     */
    private GenericCommand createGenericCommand() {
        GenericCommand cmd = new GenericCommand();
        cmd.setCommandType(new CommandType("test", 1));
        return cmd;
    }
View Full Code Here


     * Tests serializing commands.
     *
     * @throws Exception
     */
    public void testSerializeCommands() throws Exception {
        GenericCommand gc = new GenericCommand();
        ParameterDefinition def = new ParameterDefinition("hello", String.class.getName(),
            new ParameterRenderingInformation("a", "b"));

        gc.setCommandType(new CommandType("foo", 3));
        gc.setParameterDefinitions(new ParameterDefinition[] { def });
        gc.setParameterValue("hello", "world");
        gc.getConfiguration().put("config1", "config1value");
        gc.getConfiguration().put("config2", "config2value");
        gc = (GenericCommand) serializeDeserialize(gc);

        assert gc.getCommandType().equals(new CommandType("foo", 3));
        assert gc.getParameterDefinition("hello").getType().equals(String.class.getName());
        assert gc.getParameterDefinition("hello").getRenderingInfo().getLabelKey().equals("a");
        assert gc.getParameterDefinition("hello").getRenderingInfo().getDescriptionKey().equals("b");
        assert gc.getParameterValue("hello").equals("world");
        assert gc.getConfiguration().getProperty("config1").equals("config1value");
        assert gc.getConfiguration().getProperty("config2").equals("config2value");

        return;
    }
View Full Code Here

     * Tests serializing commands.
     *
     * @throws Exception
     */
    public void testSerializeCommandsWithNoConfig() throws Exception {
        GenericCommand gc = new GenericCommand();
        ParameterDefinition def = new ParameterDefinition("hello", String.class.getName(),
            new ParameterRenderingInformation("a", "b"));

        gc.setCommandType(new CommandType("foo", 3));
        gc.setParameterDefinitions(new ParameterDefinition[] { def });
        gc.setParameterValue("hello", "world");
        gc = (GenericCommand) serializeDeserialize(gc);

        assert gc.getCommandType().equals(new CommandType("foo", 3));
        assert gc.getParameterDefinition("hello").getType().equals(String.class.getName());
        assert gc.getParameterDefinition("hello").getRenderingInfo().getLabelKey().equals("a");
        assert gc.getParameterDefinition("hello").getRenderingInfo().getDescriptionKey().equals("b");
        assert gc.getParameterValue("hello").equals("world");

        return;
    }
View Full Code Here

    /**
     * Tests serializing commands and callbacks.
     */
    public void testSerializeCommandAndCallback() {
        GenericCommand gc = new GenericCommand();
        CommandAndCallback cnc = new CommandAndCallback(gc, new DummyCommandResponseCallback());

        cnc = (CommandAndCallback) serializeDeserialize(cnc);
        assert cnc.getCommand() != null;
        assert cnc.getCallback() != null;
View Full Code Here

        Preferences preferencesNode = topNode.node("concurrencytest");
        return preferencesNode;
    }

    private Command createNewCommand(Object obj) {
        GenericCommand cmd = new GenericCommand();
        cmd.setCommandType(EchoCommand.COMMAND_TYPE);
        cmd.setParameterValue(EchoCommand.PARAM_MESSAGE.getName(), obj);
        cmd.setCommandInResponse(true); // need this for our callback to test the retry count in cmd config
        return cmd;
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.communications.command.impl.generic.GenericCommand

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.