use of org.apache.qpid.disttest.message.CreateProducerCommand in project qpid-broker-j by apache.
the class MessageProviderTest method testNextMessage.
@Test
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));
}
use of org.apache.qpid.disttest.message.CreateProducerCommand in project qpid-broker-j by apache.
the class MessageProviderTest method testNextMessageWithProperties.
@Test
public void testNextMessageWithProperties() throws Exception {
Map<String, PropertyValue> properties = new HashMap<String, PropertyValue>();
properties.put("test1", new SimplePropertyValue("testValue1"));
properties.put("test2", new SimplePropertyValue(Integer.valueOf(1)));
properties.put("priority", new SimplePropertyValue(Integer.valueOf(2)));
List<PropertyValue> listItems = new ArrayList<PropertyValue>();
listItems.add(new SimplePropertyValue(Double.valueOf(2.0)));
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");
verify(_message, atLeastOnce()).setIntProperty("test2", 1);
verify(_message, atLeastOnce()).setDoubleProperty("test3", 2.0);
}
use of org.apache.qpid.disttest.message.CreateProducerCommand in project qpid-broker-j by apache.
the class ParticipantResultFactoryTest method testCreateForProducer.
@Test
public void testCreateForProducer() {
CreateProducerCommand command = new CreateProducerCommand();
setCommonCommandFields(command);
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;
ProducerParticipantResult result = _participantResultFactory.createForProducer(PARTICIPANT_NAME, REGISTERED_CLIENT_NAME, command, acknowledgeMode, NUMBER_OF_MESSAGES_PROCESSED, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED, START, END, PROVIDER_VERSION, PROTOCOL_VERSION);
assertCommonResultProperties(result);
assertEquals((long) deliveryMode, (long) result.getDeliveryMode());
assertEquals((long) acknowledgeMode, (long) result.getAcknowledgeMode());
assertEquals((long) priority, (long) result.getPriority());
assertEquals(producerInterval, result.getInterval());
assertEquals(timeToLive, result.getTimeToLive());
assertEquals((long) totalNumberOfConsumers, (long) result.getTotalNumberOfConsumers());
}
use of org.apache.qpid.disttest.message.CreateProducerCommand in project qpid-broker-j by apache.
the class ProducerConfigTest method testMessageSizeDefault.
@Test
public void testMessageSizeDefault() {
CreateProducerCommand producer = new ProducerConfig().createCommand("session1");
assertEquals("Unexpected default message size", (long) 1024, (long) producer.getMessageSize());
}
use of org.apache.qpid.disttest.message.CreateProducerCommand in project qpid-broker-j by apache.
the class ProducerConfigTest method testConfigProvidesJmsDefaults.
@Test
public void testConfigProvidesJmsDefaults() {
CreateProducerCommand p = new ProducerConfig().createCommand("session1");
assertEquals((long) Message.DEFAULT_DELIVERY_MODE, (long) p.getDeliveryMode());
assertEquals((long) Message.DEFAULT_PRIORITY, (long) p.getPriority());
assertEquals(Message.DEFAULT_TIME_TO_LIVE, p.getTimeToLive());
}
Aggregations