Package org.apache.qpid.disttest.message

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


        _messageProviderName = messageProviderName;
    }

    public CreateProducerCommand createCommand(String sessionName)
    {
        CreateProducerCommand command = new CreateProducerCommand();

        setParticipantProperties(command);

        command.setSessionName(sessionName);
        command.setDeliveryMode(_deliveryMode);
        command.setMessageSize(_messageSize);
        command.setPriority(_priority);
        command.setTimeToLive(_timeToLive);
        command.setInterval(_interval);
        command.setStartDelay(_startDelay);
        command.setMessageProviderName(_messageProviderName);

        return command;
    }
View Full Code Here


        createTestSession(connectionName, sessionName, true);
    }

    private void createTestProducer(String sessionName, String producerName, String destinationName, boolean shouldSucceed) throws Exception
    {
        final CreateProducerCommand createProducerCommand = new CreateProducerCommand();
        createProducerCommand.setParticipantName(producerName);
        createProducerCommand.setSessionName(sessionName);
        createProducerCommand.setDestinationName(destinationName);
        createProducerCommand.setNumberOfMessages(100);

        sendCommandAndValidateResponse(createProducerCommand, shouldSucceed);
    }
View Full Code Here

        runSizeTest(512);
    }

    public void runSizeTest(int size) throws Exception
    {
        CreateProducerCommand command = new CreateProducerCommand();
        command.setMessageSize(size);
        MessageProvider messageProvider = new MessageProvider(null);
        Message message = messageProvider.nextMessage(_session, command);
        assertNotNull("Message is not generated", message);
        assertTrue("Wrong message type", message instanceof TextMessage);
        TextMessage textMessage = (TextMessage)message;
View Full Code Here

        messageProperties.put("test", new SimplePropertyValue("testValue"));
        messageProperties.put("priority", new SimplePropertyValue(new Integer(9)));
        messageProviderCommand.setMessageProperties(messageProperties);
        _delegate.createMessageProvider(messageProviderCommand);

        final CreateProducerCommand producerCommand = new CreateProducerCommand();
        producerCommand.setNumberOfMessages(1);
        producerCommand.setDeliveryMode(DeliveryMode.PERSISTENT);
        producerCommand.setPriority(6);
        producerCommand.setParticipantName("test");
        producerCommand.setMessageSize(10);
        producerCommand.setSessionName("testSession");
        producerCommand.setDestinationName(getTestQueueName());
        producerCommand.setMessageProviderName(messageProviderCommand.getProviderName());

        Session session = _connection.createSession(true, Session.SESSION_TRANSACTED);
        _delegate.addConnection("name-does-not-matter", _connection);
        _delegate.addSession(producerCommand.getSessionName(), session);
        _delegate.createProducer(producerCommand);

        Message message = _delegate.sendNextMessage(producerCommand);
        session.commit();
        assertMessage(message);
View Full Code Here

        runTest(Session.AUTO_ACKNOWLEDGE, 100, 10, 0, 0);
    }

    protected void runTest(int acknowledgeMode, int messageSize, int numberOfMessages, int batchSize, long publishInterval) throws Exception
    {
        final CreateProducerCommand command = new CreateProducerCommand();
        command.setNumberOfMessages(numberOfMessages);
        command.setDeliveryMode(DeliveryMode.PERSISTENT);
        command.setParticipantName("test");
        command.setMessageSize(messageSize);
        command.setBatchSize(batchSize);
        command.setInterval(publishInterval);
        command.setSessionName("testSession");
        command.setDestinationName(getTestQueueName());

        Session session = _connection.createSession(Session.SESSION_TRANSACTED == acknowledgeMode, acknowledgeMode);

        _delegate.addConnection("name-does-not-matter", _connection);
        _delegate.addSession(command.getSessionName(), session);
        _delegate.createProducer(command);

        final ProducerParticipant producer = new ProducerParticipant(_delegate, command);

        new ParticipantExecutor(producer).start(_client);
View Full Code Here

        _participantResultFactory = new ParticipantResultFactory();
    }

    public void testCreateForProducer()
    {
        CreateProducerCommand command = new CreateProducerCommand();
        setCommonCommandFields(command);

        long producerStartDelay = 30;
        command.setStartDelay(producerStartDelay);

        int deliveryMode = DeliveryMode.PERSISTENT;
        command.setDeliveryMode(deliveryMode);

        int priority = 5;
        command.setPriority(priority);

        long producerInterval = 50;
        command.setInterval(producerInterval);

        long timeToLive = 60;
        command.setTimeToLive(timeToLive);

        int totalNumberOfConsumers = 0;
        int totalNumberOfProducers = 1;

        int acknowledgeMode = 1;
View Full Code Here

        verify(_delegate).createSession(command);
    }

    public void testCreateProducer() throws Exception
    {
        final CreateProducerCommand command = new CreateProducerCommand();
        _visitor.visit(command);
        verify(_delegate).createProducer(command);
    }
View Full Code Here

            public String getMessagePayload(CreateProducerCommand command)
            {
                return super.getMessagePayload(command);
            }
        };
        CreateProducerCommand command = new CreateProducerCommand();
        command.setMessageSize(100);
        String payloadValue = messageProvider.getMessagePayload(command);
        assertNotNull("Mesage payload should not be null", payloadValue);
        assertEquals("Unexpected payload size", 100, payloadValue.length());
    }
View Full Code Here

    }

    public void testNextMessage() throws Exception
    {
        MessageProvider messageProvider = new MessageProvider(null);
        CreateProducerCommand command = new CreateProducerCommand();
        command.setMessageSize(100);
        Message message = messageProvider.nextMessage(_session, command);
        assertNotNull("Mesage should be returned", message);
        verify(_message, atLeastOnce()).setText(isA(String.class));
    }
View Full Code Here

        ListPropertyValue list = new ListPropertyValue();
        list.setItems(listItems);
        properties.put("test3", list);

        MessageProvider messageProvider = new MessageProvider(properties);
        CreateProducerCommand command = new CreateProducerCommand();
        command.setMessageSize(100);
        Message message = messageProvider.nextMessage(_session, command);
        assertNotNull("Mesage should be returned", message);
        verify(_message, atLeastOnce()).setText(isA(String.class));
        verify(_message, atLeastOnce()).setJMSPriority(2);
        verify(_message, atLeastOnce()).setStringProperty("test1", "testValue1");
View Full Code Here

TOP

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

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.