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

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";

        String stream_data = "Stream this string...";
        InputStream in = new ByteArrayInputStream(stream_data.getBytes());
        GenericCommand test_command = new GenericCommand(SimpleTestStreamService.COMMAND_TYPE, null);
        CommandResponse results = null;
        Long stream_id = null;

        try {
            stream_id = agent1.getServiceContainer().addRemoteInputStream(in);
            test_command.setParameterValue(SimpleTestStreamService.INPUT_STREAM_PARAM, new RemoteInputStream(stream_id,
                agent1.getServiceContainer()));

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


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

        String stream_data = "Streaming this string should fail";
        InputStream in = new ByteArrayInputStream(stream_data.getBytes());
        GenericCommand test_command = new GenericCommand(SimpleTestStreamService.COMMAND_TYPE, null);
        CommandResponse results = null;

        try {
            test_command.setParameterValue(SimpleTestStreamService.INPUT_STREAM_PARAM, new RemoteInputStream(in, agent1
                .getServiceContainer()));
            Thread.sleep(5500L); // the timer only runs the task every 5 secs even though our timeout is 1 sec
            results = agent1.getClientCommandSender().sendSynch(test_command);
        } catch (Throwable t) {
            throw new Exception(t);
View Full Code Here

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

        String stream_data = "Stream this string...";
        InputStream in = new ByteArrayInputStream(stream_data.getBytes());
        GenericCommand test_command = new GenericCommand(SimpleTestStreamService.COMMAND_TYPE, null);
        CommandResponse results = null;
        Long stream_id = null;

        try {
            stream_id = agent1.getServiceContainer().addRemoteInputStream(in);
            test_command.setParameterValue(SimpleTestStreamService.INPUT_STREAM_PARAM, new RemoteInputStream(stream_id,
                agent1.getServiceContainer()));

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

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

        InputStream in = new ByteArrayInputStream(LARGE_STRING_BYTES);
        GenericCommand test_command = new GenericCommand(SimpleTestStreamService.COMMAND_TYPE, null);
        CommandResponse results = null;
        Long stream_id = null;

        try {
            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

        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

     *
     * @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

     *
     * @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

     *
     * @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

     *
     * @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

     *
     * @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

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.