Examples of StringDataSource


Examples of org.mule.util.StringDataSource

   
    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

Examples of org.mule.util.StringDataSource

    }

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

Examples of org.mule.util.StringDataSource

*/
public class OutboundAttachmentsAnnotationComponent
{
    public Map<?, ?> processAttachments(@OutboundAttachments Map<String, DataHandler> attachments)
    {
        attachments.put("bar", new DataHandler(new StringDataSource("barValue")));
        //Verify that we receive any outbound attachments already set on the message
        if (attachments.containsKey("foo"))
        {
            //Overwrite the existing attachment to signal that we received it
            attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
        }
        return attachments;
    }
View Full Code Here

Examples of org.mule.util.StringDataSource

    @Test
    public void testMapAttachmentsOptional() throws Exception
    {
        //restrict attachments
        Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
        attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
        attachments.put("bar", new DataHandler(new StringDataSource("barValue")));
        eventContext = createEventContext(null, attachments);

        eventContext.getMessage().removeOutboundAttachment("baz");

        InvocationResult response = invokeResolver("processAttachmentsOptional", eventContext);
View Full Code Here

Examples of org.mule.util.StringDataSource

    @Test
    public void testListAttachmentsWithOptional() throws Exception
    {
        Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
        attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
        attachments.put("bar", new DataHandler(new StringDataSource("barValue")));
        eventContext = createEventContext(null, attachments);

        InvocationResult response = invokeResolver("processAttachmentsListOptional", eventContext);
        assertTrue("Message payload should be a List", response.getResult() instanceof List);
        List<DataHandler> result = (List<DataHandler>) response.getResult();
View Full Code Here

Examples of org.mule.util.StringDataSource

    @Test
    public void testListAttachmentsWithMissing() throws Exception
    {
        Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
        attachments.put("foo", new DataHandler(new StringDataSource("fooValue")));
        attachments.put("bar", new DataHandler(new StringDataSource("barValue")));
        eventContext = createEventContext(null, attachments);
        try
        {
            invokeResolver("processAttachmentsList", eventContext);
            fail("Required attachment value is missing");
View Full Code Here

Examples of org.mule.util.StringDataSource

    protected MuleMessage createMessageWithAttachments()
    {
        try
        {
            Map<String, DataHandler> attachments = new HashMap<String, DataHandler>();
            attachments.put("foo", new DataHandler(new StringDataSource("moo")));
            attachments.put("bar", new DataHandler(new StringDataSource("mar")));
            attachments.put("baz", new DataHandler(new StringDataSource("maz")));
            return new DefaultMuleMessage("test", null, attachments, muleContext);
        }
        catch (Exception e)
        {
            fail(e.getMessage());
View Full Code Here

Examples of org.mule.util.StringDataSource

            }
        });

        LocalMuleClient client = muleContext.getClient();
        MuleMessage msg = new DefaultMuleMessage("test",  muleContext);
        msg.addOutboundAttachment("attach1", new DataHandler(new StringDataSource("foo", "attach1")));

        MuleMessage result = client.send("endpoint1", msg);
        assertEquals("We should have no attachments coming back", 0, result.getInboundAttachmentNames().size());
    }
View Full Code Here

Examples of org.mule.util.StringDataSource

    }

    protected Map<String, DataHandler> createAttachmentsMap()
    {
        Map<String, DataHandler> 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")));
        return attachments;
    }
View Full Code Here

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
TOP
Copyright © 2018 www.massapi.com. 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.