Package org.apache.qpid.disttest.client.property

Examples of org.apache.qpid.disttest.client.property.SimplePropertyValue


    public void testCreateMessageProviderAndSendMessage() throws Exception
    {
        final CreateMessageProviderCommand messageProviderCommand = new CreateMessageProviderCommand();
        messageProviderCommand.setProviderName("test1");
        Map<String, PropertyValue> messageProperties = new HashMap<String, PropertyValue>();
        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);
View Full Code Here


    }

    public void testNextMessageWithProperties() throws Exception
    {
        Map<String, PropertyValue> properties = new HashMap<String, PropertyValue>();
        properties.put("test1", new SimplePropertyValue("testValue1"));
        properties.put("test2", new SimplePropertyValue(new Integer(1)));
        properties.put("priority", new SimplePropertyValue(new Integer(2)));
        List<PropertyValue> listItems = new ArrayList<PropertyValue>();
        listItems.add(new SimplePropertyValue(new Double(2.0)));
        ListPropertyValue list = new ListPropertyValue();
        list.setItems(listItems);
        properties.put("test3", list);

        MessageProvider messageProvider = new MessageProvider(properties);
View Full Code Here

            }
            else
            {
                throw new JsonParseException("Unsupported primitive value " + primitive);
            }
            return new SimplePropertyValue(result);
        }
        else if (json.isJsonArray())
        {
            JsonArray array = json.getAsJsonArray();
            List<Object> result = new ArrayList<Object>(array.size());
            for (JsonElement element : array)
            {
                result.add(context.deserialize(element, Object.class));
            }
            return new SimplePropertyValue(result);
        }
        else if (json.isJsonObject())
        {
            JsonObject object = json.getAsJsonObject();
            JsonElement defElement = object.getAsJsonPrimitive(DEF_FIELD);
            Class<?> classInstance = null;
            if (defElement != null)
            {
                try
                {
                    classInstance = _factory.getPropertyValueClass(defElement.getAsString());
                }
                catch (ClassNotFoundException e)
                {
                    // ignore
                }
            }
            if (classInstance == null)
            {
                Map<String, Object> result = new HashMap<String, Object>();
                for (Map.Entry<String, JsonElement> entry : object.entrySet())
                {
                    Object value = context.deserialize(entry.getValue(), Object.class);
                    result.put(entry.getKey(), value);
                }
                return new SimplePropertyValue(result);
            }
            else
            {
                return context.deserialize(json, classInstance);
            }
View Full Code Here

public class MessageProviderConfigTest extends QpidTestCase
{
    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());
View Full Code Here

    }

    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());
    }
View Full Code Here

    }

    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);
View Full Code Here

    public void setUp() throws Exception
    {
        super.setUp();
        _generator = new ListPropertyValue();
        _items = new ArrayList<PropertyValue>();
        _items.add(new SimplePropertyValue(new Integer(1)));
        _items.add(new SimplePropertyValue(new Double(2.1)));
        _items.add(new SimplePropertyValue(new Boolean(true)));
        ListPropertyValue innerList = new ListPropertyValue();
        List<PropertyValue> innerListItems = new ArrayList<PropertyValue>();
        innerListItems.add(new SimplePropertyValue("test"));
        innerListItems.add(new SimplePropertyValue(new Integer(2)));
        innerList.setItems(innerListItems);
        _items.add(innerList);
        _generator.setItems(_items);
    }
View Full Code Here

    }

    public void testNextMessageWithProperties() throws Exception
    {
        Map<String, PropertyValue> properties = new HashMap<String, PropertyValue>();
        properties.put("test1", new SimplePropertyValue("testValue1"));
        properties.put("test2", new SimplePropertyValue(new Integer(1)));
        properties.put("priority", new SimplePropertyValue(new Integer(2)));
        List<PropertyValue> listItems = new ArrayList<PropertyValue>();
        listItems.add(new SimplePropertyValue(new Double(2.0)));
        ListPropertyValue list = new ListPropertyValue();
        list.setItems(listItems);
        properties.put("test3", list);

        MessageProvider messageProvider = new MessageProvider(properties);
View Full Code Here

public class MessageProviderConfigTest extends TestCase
{
    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());
View Full Code Here

    }

    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());
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.disttest.client.property.SimplePropertyValue

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.