Package org.mule.util

Examples of org.mule.util.StringDataSource


        }

        if (attachments==null)
        {
            attachments = new HashMap<String, DataHandler>();
            attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
            attachments.put("bar", new DataHandler(new StringDataSource("barValue")));
            attachments.put("baz", new DataHandler(new StringDataSource("bazValue")));
        }
        MuleMessage message = new DefaultMuleMessage("test", muleContext);
        for (Map.Entry<String, DataHandler> attachment : attachments.entrySet())
        {
            message.addOutboundAttachment(attachment.getKey(), attachment.getValue());
View Full Code Here


    @Test
    public void testMapAttachmentsOptional() throws Exception
    {
        //clear baz attachment
        Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
        attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
        attachments.put("bar", new DataHandler(new StringDataSource("barValue")));
        muleMessage = createMessage(null, attachments);

        MuleClient client = muleContext.getClient();
        MuleMessage message = client.send("vm://attachmentsOptional", muleMessage);
        assertNotNull("return message from MuleClient.send() should not be null", message);
View Full Code Here

    @Test
    public void testListAttachmentsWithOptional() throws Exception
    {
        //clear baz attachment
        Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
        attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
        attachments.put("bar", new DataHandler(new StringDataSource("barValue")));
        muleMessage = createMessage(null, attachments);

        MuleClient client = muleContext.getClient();
        MuleMessage message = client.send("vm://attachmentsListOptional", muleMessage);
        assertNotNull("return message from MuleClient.send() should not be null", message);
View Full Code Here

    @Test
    public void testListAttachmentsWithMissing() throws Exception
    {
        //clear bar attachment
        Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
        attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
        attachments.put("baz", new DataHandler(new StringDataSource("bazValue")));
        muleMessage = createMessage(null, attachments);

        MuleClient client = muleContext.getClient();
        MuleMessage result = client.send("vm://attachmentsListOptional", muleMessage);
        assertNotNull(result);
View Full Code Here

        muleMessage = new DefaultMuleMessage("test", props, muleContext);

        try
        {
            muleMessage.addOutboundAttachment("foo", new DataHandler(new StringDataSource("fooValue")));
            muleMessage.addOutboundAttachment("bar", new DataHandler(new StringDataSource("barValue")));
            muleMessage.addOutboundAttachment("baz", new DataHandler(new StringDataSource("bazValue")));
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

    public void testAttachments() throws Exception
    {
        String attachmentName = "the-attachment";

        MuleMessage message = new DefaultMuleMessage(TEST_MESSAGE, muleContext);
        DataHandler dataHandler = new DataHandler(new StringDataSource("attachment content"));
        message.addAttachment(attachmentName, dataHandler);

        MuleMessage deserializedMessage = serializationRoundtrip(message);

        assertEquals(1, deserializedMessage.getAttachmentNames().size());
View Full Code Here

        }

        if(attachments==null)
        {
            attachments = new HashMap<String, DataHandler>();
            attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
            attachments.put("bar", new DataHandler(new StringDataSource("barValue")));
            attachments.put("baz", new DataHandler(new StringDataSource("bazValue")));
        }
        DefaultMuleMessage message;
        if(inboundScope)
        {
            message = new DefaultMuleMessage("test", null, attachments, muleContext);
View Full Code Here

    public Map<String, DataHandler> processUnmodifiableAttachments(@InboundAttachments("foo, bar") Map<String, DataHandler> attachments)
    {
        //Should throw UnsupportedOperationException
        //TODO auto wrap method on Map
        attachments.put("car", new DataHandler(new StringDataSource("carValue")));
        return attachments;
    }
View Full Code Here

    }

    public List<Object> processUnmodifiableAttachmentsList(@InboundAttachments("foo, bar") List<DataHandler> attachments)
    {
        //Should throw UnsupportedOperationException
        attachments.add(new DataHandler(new StringDataSource("carValue")));
        return readToList(attachments);
    }
View Full Code Here

TOP

Related Classes of org.mule.util.StringDataSource

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.