Search in sources :

Example 1 with SimplePropertyValue

use of org.apache.qpid.disttest.client.property.SimplePropertyValue in project qpid-broker-j by apache.

the class ClientConfigTest method createClientConfigWithMessageProviderConfigReturningCommands.

private ClientConfig createClientConfigWithMessageProviderConfigReturningCommands() {
    Map<String, PropertyValue> messageProperties = new HashMap<String, PropertyValue>();
    messageProperties.put("test", new SimplePropertyValue("testValue"));
    MessageProviderConfig config = new MessageProviderConfig("test", messageProperties);
    List<MessageProviderConfig> providerConfigs = new ArrayList<MessageProviderConfig>();
    providerConfigs.add(config);
    return new ClientConfig(CLIENT1, new ArrayList<ConnectionConfig>(), providerConfigs);
}
Also used : SimplePropertyValue(org.apache.qpid.disttest.client.property.SimplePropertyValue) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) PropertyValue(org.apache.qpid.disttest.client.property.PropertyValue) SimplePropertyValue(org.apache.qpid.disttest.client.property.SimplePropertyValue)

Example 2 with SimplePropertyValue

use of org.apache.qpid.disttest.client.property.SimplePropertyValue in project qpid-broker-j by apache.

the class MessageProviderConfigTest method testCreateCommandsForMessageProvider.

@Test
public void testCreateCommandsForMessageProvider() {
    Map<String, PropertyValue> messageProperties = new HashMap<String, PropertyValue>();
    messageProperties.put("test", new SimplePropertyValue("testValue"));
    MessageProviderConfig config = new MessageProviderConfig("test", messageProperties);
    CreateMessageProviderCommand command = config.createCommand();
    assertNotNull("Command should not be null", command);
    assertNotNull("Unexpected name", command.getProviderName());
    assertEquals("Unexpected properties", messageProperties, command.getMessageProperties());
}
Also used : SimplePropertyValue(org.apache.qpid.disttest.client.property.SimplePropertyValue) HashMap(java.util.HashMap) PropertyValue(org.apache.qpid.disttest.client.property.PropertyValue) SimplePropertyValue(org.apache.qpid.disttest.client.property.SimplePropertyValue) CreateMessageProviderCommand(org.apache.qpid.disttest.message.CreateMessageProviderCommand) Test(org.junit.Test)

Example 3 with SimplePropertyValue

use of org.apache.qpid.disttest.client.property.SimplePropertyValue 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);
}
Also used : SimplePropertyValue(org.apache.qpid.disttest.client.property.SimplePropertyValue) Message(javax.jms.Message) TextMessage(javax.jms.TextMessage) HashMap(java.util.HashMap) CreateProducerCommand(org.apache.qpid.disttest.message.CreateProducerCommand) ArrayList(java.util.ArrayList) PropertyValue(org.apache.qpid.disttest.client.property.PropertyValue) SimplePropertyValue(org.apache.qpid.disttest.client.property.SimplePropertyValue) ListPropertyValue(org.apache.qpid.disttest.client.property.ListPropertyValue) ListPropertyValue(org.apache.qpid.disttest.client.property.ListPropertyValue) Test(org.junit.Test)

Example 4 with SimplePropertyValue

use of org.apache.qpid.disttest.client.property.SimplePropertyValue in project qpid-broker-j by apache.

the class MessageProviderConfigTest method testMessageProviderConfig.

@Test
public void testMessageProviderConfig() {
    Map<String, PropertyValue> messageProperties = new HashMap<String, PropertyValue>();
    messageProperties.put("test", new SimplePropertyValue("testValue"));
    MessageProviderConfig config = new MessageProviderConfig("test", messageProperties);
    assertEquals("Unexpected name", "test", config.getName());
    assertEquals("Unexpected properties", messageProperties, config.getMessageProperties());
}
Also used : SimplePropertyValue(org.apache.qpid.disttest.client.property.SimplePropertyValue) HashMap(java.util.HashMap) PropertyValue(org.apache.qpid.disttest.client.property.PropertyValue) SimplePropertyValue(org.apache.qpid.disttest.client.property.SimplePropertyValue) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)4 PropertyValue (org.apache.qpid.disttest.client.property.PropertyValue)4 SimplePropertyValue (org.apache.qpid.disttest.client.property.SimplePropertyValue)4 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 Message (javax.jms.Message)1 TextMessage (javax.jms.TextMessage)1 ListPropertyValue (org.apache.qpid.disttest.client.property.ListPropertyValue)1 CreateMessageProviderCommand (org.apache.qpid.disttest.message.CreateMessageProviderCommand)1 CreateProducerCommand (org.apache.qpid.disttest.message.CreateProducerCommand)1