Package org.apache.qpid.disttest.message

Examples of org.apache.qpid.disttest.message.Command


        }
    }

    public void sendRegistrationMessage()
    {
        Command command;
        try
        {
            command = new RegisterClientCommand(_clientName, _instructionQueue.getQueueName());
        }
        catch (final JMSException e)
View Full Code Here


                    try
                    {
                        String jmsMessageID = message.getJMSMessageID();
                        LOGGER.debug("Received message " + jmsMessageID);

                        final Command command = JmsMessageAdaptor.messageToCommand(message);
                        LOGGER.debug("Converted message " + jmsMessageID + " into command: " + command);

                        processCommandWithFirstSupportingListener(command);
                        LOGGER.debug("Finished processing command for message " + jmsMessageID);
                    }
View Full Code Here

    {
        Collection<String> registeredClients = _clientRegistry.getClients();

        LOGGER.info("Stopping all clients");
        _stopClientsResponseLatch = new CountDownLatch(registeredClients.size());
        Command command = new StopClientCommand();
        for (final String clientName : registeredClients)
        {
            _jmsDelegate.sendCommandToClient(clientName, command);
        }
View Full Code Here

        for (CommandForClient commandForClient : commandsForAllClients)
        {
            String configuredClientName = commandForClient.getClientName();
            String registeredClientName = _participatingClients.getRegisteredNameFromConfiguredName(configuredClientName);

            Command command = commandForClient.getCommand();

            LOGGER.debug("Sending command : {} ", command);

            sendCommandInternal(registeredClientName, command);
        }
View Full Code Here

            @Override
            public void onMessage(Message message)
            {
                try
                {
                    Command command = JmsMessageAdaptor.messageToCommand(message);
                    LOGGER.debug("Test client received " + command);
                    commandList.add(command);
                    producer.send(JmsMessageAdaptor.commandToMessage(_session, new Response(CLIENT1, command.getType())));
                }
                catch(Exception e)
                {
                    listenerException.set(e);
                }
            }
        });

        _controller.runAllTests();
        assertCommandType(CommandType.CREATE_CONNECTION, commandList);
        assertCommandType(CommandType.START_TEST, commandList);
        assertCommandType(CommandType.TEAR_DOWN_TEST, commandList);

        _controller.stopAllRegisteredClients();
        assertCommandType(CommandType.STOP_CLIENT, commandList);
        assertNull("Unexpected exception occured", listenerException.get());
        Command command = commandList.poll(1l, TimeUnit.SECONDS);
        assertNull("Unexpected command is received", command);
    }
View Full Code Here

        assertNull("Unexpected command is received", command);
    }

    private void assertCommandType(CommandType expectedType, BlockingQueue<Command> commandList) throws InterruptedException
    {
        Command command = commandList.poll(1l, TimeUnit.SECONDS);
        assertNotNull("Command of type " + expectedType + " is not received", command);
        assertEquals("Unexpected command type", expectedType, command.getType());
    }
View Full Code Here

    private void sendRegistration(final String clientId) throws JMSException
    {
        final MessageProducer registrationProducer = _session.createProducer(_controllerQueue);

        final Command command = new RegisterClientCommand(clientId, _clientQueue.getQueueName());
        final Message registrationMessage = JmsMessageAdaptor.commandToMessage(_session, command);
        registrationProducer.send(registrationMessage);
        LOGGER.debug("sent registrationMessage: " + registrationMessage);
    }
View Full Code Here

        assertEquals("Expected client to be in STARTED state", ClientState.READY, _client.getState());

        final RegisterClientCommand registrationCommand = _controllerQueue.getNext();
        createClientQueueProducer(registrationCommand);

        final Command stopClientCommand = new StopClientCommand();
        sendCommandToClient(stopClientCommand);

        _client.waitUntilStopped(1000);

        Response response = _controllerQueue.getNext();
View Full Code Here

        return (T) JmsMessageAdaptor.messageToCommand(message);
    }

    public void addNextResponse(Map<CommandType, Command> responses) throws JMSException
    {
        Command nextResponse = getNext();
        responses.put(nextResponse.getType(), nextResponse);
    }
View Full Code Here

    public void testProcessInstructionVisitsCommandAndResponds() throws Exception
    {
        // has to be declared to be of supertype Command otherwise Mockito verify()
        // refers to wrong method
        final Command command = new StopClientCommand();
        _client.processInstruction(command);

        verify(_visitor).visit(command);
        verify(_delegate).sendResponseMessage(isA(Response.class));
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.disttest.message.Command

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.