Examples of GenericCommand


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

        assert agent1.isStarted() : "agent1 should have been started";
        assert agent2.isStarted() : "agent2 should have been started";

        InputStream in = new FileInputStream(createVeryLargeFile()); // creates a large file in tmp directory
        GenericCommand test_command = new GenericCommand(SimpleTestStreamService.COMMAND_TYPE, null);
        CommandResponse results = null;
        Long stream_id = null;

        try {
            test_command.setParameterValue(SimpleTestStreamService.RETURN_COUNT_ONLY_PARAM, "");
            test_command.setParameterValue(SimpleTestStreamService.INPUT_STREAM_PARAM, new RemoteInputStream(in, agent1
                .getServiceContainer()));

            results = agent1.getClientCommandSender().sendSynch(test_command);
        } catch (Throwable t) {
            throw new Exception(ThrowableUtil.getAllMessages(t), t);
View Full Code Here

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

     *
     * @throws Exception
     */
    public void testSendGuaranteedThatTimesOutThenStopSending() throws Exception {
        DummyRemoteCommunicator comm = new DummyRemoteCommunicator();
        GenericCommand command = createGenericCommand();
        ClientCommandSenderConfiguration config = createConfig();

        config.retryInterval = 50L; // retry really fast
        config.defaultTimeoutMillis = 500L; // default will be less than the time the comm.send will return
        comm.setSleepPeriod(1000L); // simulate the server taking 1sec to process the request
View Full Code Here

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

     *
     * @throws Exception
     */
    public void testSendGuaranteedThatTimesOut() throws Exception {
        DummyRemoteCommunicator comm = new DummyRemoteCommunicator();
        GenericCommand command = createGenericCommand();
        ClientCommandSenderConfiguration config = createConfig();

        config.retryInterval = 50L; // retry really fast
        config.defaultTimeoutMillis = 1000L; // default will be less than the time the comm.send will return
        comm.setSleepPeriod(1500L);
View Full Code Here

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

     *
     * @throws Exception
     */
    public void testSendGuaranteedThatTimesOutWithLongRetryInterval() throws Exception {
        DummyRemoteCommunicator comm = new DummyRemoteCommunicator();
        GenericCommand command = createGenericCommand();
        ClientCommandSenderConfiguration config = createConfig();

        config.retryInterval = 5000L;
        config.defaultTimeoutMillis = 750L; // default will be less than the time the comm.send will return
        comm.setSleepPeriod(1250L);
View Full Code Here

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

     *
     * @throws Exception
     */
    public void testSendGuaranteedWhileNotSending() throws Exception {
        DummyRemoteCommunicator comm = new DummyRemoteCommunicator();
        GenericCommand command = createGenericCommand();
        ClientCommandSenderConfiguration config = createConfig();
        File cmd_spool_file = getPersistentFifoFile(true);
        ClientCommandSender sender = new ClientCommandSender(comm, config);

        try {
View Full Code Here

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

     *
     * @throws Exception
     */
    public void testSendGuaranteedWhileNotSendingWithNonSerializableCallback() throws Exception {
        DummyRemoteCommunicator comm = new DummyRemoteCommunicator();
        GenericCommand command = createGenericCommand();
        ClientCommandSenderConfiguration config = createConfig();
        File cmd_spool_file = getPersistentFifoFile(true);
        ClientCommandSender sender = new ClientCommandSender(comm, config);

        try {
View Full Code Here

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

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

     * 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

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

     * 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

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

    /**
     * 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
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.