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

Examples of org.rhq.enterprise.communications.command.impl.identify.IdentifyCommandResponse


        assert agent1.getConfiguration().getClientSenderSecuritySocketProtocol().equals("SSL");
        assert agent2.getConfiguration().getClientSenderSecuritySocketProtocol().equals("SSL");

        IdentifyCommand command = new IdentifyCommand();
        CommandResponse cmdresponse;
        IdentifyCommandResponse response;

        cmdresponse = agent1.getClientCommandSender().sendSynch(command);
        assert cmdresponse.isSuccessful() : "Failed to send command from agent1 to agent2: " + cmdresponse;
        response = (IdentifyCommandResponse) cmdresponse;
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent2
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identify of agent2 - what remoting server did we just communicate with??";

        cmdresponse = agent2.getClientCommandSender().sendSynch(command);
        assert cmdresponse.isSuccessful() : "Failed to send command from agent2 to agent1: " + cmdresponse;
        response = (IdentifyCommandResponse) cmdresponse;
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent1
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identity of agent1 - what remoting server did we just communicate with??";

        return;
    }
View Full Code Here


        assert agent1.getConfiguration().getClientSenderSecuritySocketProtocol().equals("TLS");
        assert agent2.getConfiguration().getClientSenderSecuritySocketProtocol().equals("SSL");

        IdentifyCommand command = new IdentifyCommand();
        CommandResponse cmdresponse;
        IdentifyCommandResponse response;

        cmdresponse = agent1.getClientCommandSender().sendSynch(command);
        assert cmdresponse.isSuccessful() : "Failed to send command from agent1 to agent2: " + cmdresponse;
        response = (IdentifyCommandResponse) cmdresponse;
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent2
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identify of agent2 - what remoting server did we just communicate with??";

        cmdresponse = agent2.getClientCommandSender().sendSynch(command);
        assert cmdresponse.isSuccessful() : "Failed to send command from agent2 to agent1: " + cmdresponse;
        response = (IdentifyCommandResponse) cmdresponse;
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent1
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identity of agent1 - what remoting server did we just communicate with??";

        return;
    }
View Full Code Here

    public void testSendMessage() throws Exception {
        AgentMain agent1 = m_agent1Test.createAgent(true);
        AgentMain agent2 = m_agent2Test.createAgent(true);

        IdentifyCommand command = new IdentifyCommand();
        IdentifyCommandResponse response;

        response = (IdentifyCommandResponse) agent1.getClientCommandSender().sendSynch(command);
        assert response.isSuccessful() : "Failed to send command from agent1 to agent2";
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent2
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identify of agent2 - what remoting server did we just communicate with??";

        response = (IdentifyCommandResponse) agent2.getClientCommandSender().sendSynch(command);
        assert response.isSuccessful() : "Failed to send command from agent2 to agent1";
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent1
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identity of agent1 - what remoting server did we just communicate with??";

        return;
    }
View Full Code Here

        assert server_metrics2.getNumberFailedCommandsReceived() == 0;
        assert server_metrics2.getNumberTotalCommandsReceived() == 0;
        assert server_metrics2.getAverageExecutionTimeReceived() == 0;

        IdentifyCommand command = new IdentifyCommand();
        IdentifyCommandResponse response;

        response = (IdentifyCommandResponse) agent1.getClientCommandSender().sendSynch(command);
        assert response.isSuccessful() : "Failed to send command from agent1 to agent2";
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent2
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identify of agent2 - what remoting server did we just communicate with??";

        assert client_metrics1.getNumberSuccessfulCommandsSent() == 1;
        assert client_metrics1.getNumberFailedCommandsSent() == 0;
        assert client_metrics2.getNumberSuccessfulCommandsSent() == 0;
        assert client_metrics2.getNumberFailedCommandsSent() == 0;
        assert server_metrics1.getNumberSuccessfulCommandsReceived() == 0;
        assert server_metrics1.getNumberFailedCommandsReceived() == 0;
        assert server_metrics1.getNumberTotalCommandsReceived() == 0;
        assert server_metrics2.getNumberSuccessfulCommandsReceived() == 1;
        assert server_metrics2.getNumberFailedCommandsReceived() == 0;
        assert server_metrics2.getNumberTotalCommandsReceived() == 1;

        response = (IdentifyCommandResponse) agent1.getClientCommandSender().sendSynch(command);
        assert response.isSuccessful() : "Failed to send command from agent1 to agent2";

        assert client_metrics1.getNumberSuccessfulCommandsSent() == 2;
        assert client_metrics1.getNumberFailedCommandsSent() == 0;
        assert client_metrics2.getNumberSuccessfulCommandsSent() == 0;
        assert client_metrics2.getNumberFailedCommandsSent() == 0;
        assert server_metrics1.getNumberSuccessfulCommandsReceived() == 0;
        assert server_metrics1.getNumberFailedCommandsReceived() == 0;
        assert server_metrics1.getNumberTotalCommandsReceived() == 0;
        assert server_metrics2.getNumberSuccessfulCommandsReceived() == 2;
        assert server_metrics2.getNumberFailedCommandsReceived() == 0;
        assert server_metrics2.getNumberTotalCommandsReceived() == 2;

        response = (IdentifyCommandResponse) agent2.getClientCommandSender().sendSynch(command);
        assert response.isSuccessful() : "Failed to send command from agent2 to agent1";
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent1
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identity of agent1 - what remoting server did we just communicate with??";

        assert client_metrics1.getNumberSuccessfulCommandsSent() == 2;
        assert client_metrics1.getNumberFailedCommandsSent() == 0;
        assert client_metrics2.getNumberSuccessfulCommandsSent() == 1;
        assert client_metrics2.getNumberFailedCommandsSent() == 0;
        assert server_metrics1.getNumberSuccessfulCommandsReceived() == 1;
        assert server_metrics1.getNumberFailedCommandsReceived() == 0;
        assert server_metrics1.getNumberTotalCommandsReceived() == 1;
        assert server_metrics2.getNumberSuccessfulCommandsReceived() == 2;
        assert server_metrics2.getNumberFailedCommandsReceived() == 0;
        assert server_metrics2.getNumberTotalCommandsReceived() == 2;

        response = (IdentifyCommandResponse) agent2.getClientCommandSender().sendSynch(command);
        assert response.isSuccessful() : "Failed to send command from agent2 to agent1";

        assert client_metrics1.getNumberSuccessfulCommandsSent() == 2;
        assert client_metrics1.getNumberFailedCommandsSent() == 0;
        assert client_metrics2.getNumberSuccessfulCommandsSent() == 2;
        assert client_metrics2.getNumberFailedCommandsSent() == 0;
View Full Code Here

        assert agent2.getServiceContainer().getConfiguration().getConnectorSecurityClientAuthMode().equals(
            SSLSocketBuilder.CLIENT_AUTH_MODE_NEED);

        IdentifyCommand command = new IdentifyCommand();
        CommandResponse cmdresponse;
        IdentifyCommandResponse response;

        cmdresponse = agent1.getClientCommandSender().sendSynch(command);
        assert cmdresponse.isSuccessful() : "Failed to send command from agent1 to agent2: " + cmdresponse;
        response = (IdentifyCommandResponse) cmdresponse;
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent2
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identify of agent2 - what remoting server did we just communicate with??";

        // JBoss Remoting 2 doesn't seem to like me doing bi-directional messaging within the same VM
        //      cmdresponse = agent2.getClientCommandSender().sendSynch( command );
        //      assert cmdresponse.isSuccessful() : "Failed to send command from agent2 to agent1: " + cmdresponse;
View Full Code Here

        m_agent2Test.setConfigurationOverrides(props2);

        AgentMain agent1 = m_agent1Test.createAgent(true);
        AgentMain agent2 = m_agent2Test.createAgent(true);

        IdentifyCommandResponse response;

        response = (IdentifyCommandResponse) agent1.getClientCommandSender().sendSynch(new IdentifyCommand());
        assert response.isSuccessful() : "Failed to send command from agent1 to agent2";
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent2
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identify of agent2 - what remoting server did we just communicate with??";

        CommandResponse generic_response;
        generic_response = agent2.getClientCommandSender().sendSynch(new IdentifyCommand());
        assert !generic_response.isSuccessful() : "Should have failed to send command from agent2 to agent1 since it didn't preprocess the command";
View Full Code Here

        assert agent2.getServiceContainer().getConfiguration().getConnectorSecurityClientAuthMode().equals(
            SSLSocketBuilder.CLIENT_AUTH_MODE_WANT);

        IdentifyCommand command = new IdentifyCommand();
        CommandResponse cmdresponse;
        IdentifyCommandResponse response;

        cmdresponse = agent1.getClientCommandSender().sendSynch(command);
        assert cmdresponse.isSuccessful() : "Failed to send command from agent1 to agent2: " + cmdresponse;
        response = (IdentifyCommandResponse) cmdresponse;
        assert new InvokerLocator(response.getIdentification().getInvokerLocator()).getPort() == agent2
            .getServiceContainer().getConfiguration().getConnectorBindPort() : "Didn't get the identify of agent2 - what remoting server did we just communicate with??";

        // JBoss Remoting 2.2.SP4 doesn't seem to like me doing bi-directional messaging within the same VM
        //      cmdresponse = agent2.getClientCommandSender().sendSynch( command );
        //      assert cmdresponse.isSuccessful() : "Failed to send command from agent2 to agent1: " + cmdresponse;
View Full Code Here

     */
    private InvokerLocator attemptToIdentifyServer() {
        try {
            GenericCommandClient client = new GenericCommandClient(m_remoteCommunicator);
            CommandResponse genericResponse = client.invoke(new IdentifyCommand());
            IdentifyCommandResponse identifyResponse = new IdentifyCommandResponse(genericResponse);

            if (identifyResponse.getException() != null) {
                throw identifyResponse.getException();
            }

            return new InvokerLocator(identifyResponse.getIdentification().getInvokerLocator());
        } catch (Throwable ignore) {
            // This probably just means that the server isn't online yet; we can ignore - we'll be called later for another attempt.
            // However, we want to log a warning at least once in case this is a configuration error (in which case
            // the connection will never succeed - without this log message, it will be hard to debug the misconfiguration).

View Full Code Here

            ConnectorMBean connector = getConnector();
            locator = connector.getLocator();
            Map locator_params = locator.getParameters();
            our_type = (String) locator_params.get(ServiceContainerConfigurationConstants.CONNECTOR_RHQTYPE);
        } catch (Exception e) {
            return new IdentifyCommandResponse(identifyCommand, e);
        }

        if (our_type.equals(Identification.TYPE_AGENT)) {
            our_ident = new AgentIdentification(our_type, locator.getLocatorURI());
        } else if (our_type.equals(Identification.TYPE_SERVER)) {
            our_ident = new ServerIdentification(our_type, locator.getLocatorURI());
        } else {
            return new IdentifyCommandResponse(identifyCommand, new Exception(LOG
                .getMsgString(CommI18NResourceKeys.IDENTIFY_COMMAND_SERVICE_UNKNOWN_ENDPOINT)));
        }

        return new IdentifyCommandResponse(identifyCommand, our_ident);
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.communications.command.impl.identify.IdentifyCommandResponse

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.