Package org.mule

Examples of org.mule.DefaultMuleMessage$SerializedDataHandler


    @Test
    public void ifNotDefinedPayloadThenDoNotCopy()
    {

        DefaultMuleMessage originalMessage = new DefaultMuleMessage(NotDefinedPayload.getInstance(), muleContext);
        DefaultMuleMessage copyToMessage = new DefaultMuleMessage(A_PAYLOAD, muleContext);
        MunitUtils.copyMessage(originalMessage, copyToMessage);

        assertEquals(A_PAYLOAD, copyToMessage.getPayload());
    }
View Full Code Here


    protected MuleEvent muleEvent()
    {
        try
        {
            return new DefaultMuleEvent(new DefaultMuleMessage(null, muleContext), MessageExchangePattern.REQUEST_RESPONSE, MuleTestUtils.getTestFlow(muleContext));
        }
        catch (Exception e)
        {
            return null;
        }
View Full Code Here

    private MuleEvent muleEvent()
    {
        try
        {
            return new DefaultMuleEvent(new DefaultMuleMessage("", muleContext), MessageExchangePattern.REQUEST_RESPONSE, MuleTestUtils.getTestFlow(muleContext));
        }
        catch (Exception e)
        {
            return null;
        }
View Full Code Here

    protected MuleEvent muleEvent()
    {
        try
        {
            return new DefaultMuleEvent(new DefaultMuleMessage(null, muleContext), MessageExchangePattern.REQUEST_RESPONSE, MuleTestUtils.getTestFlow(muleContext));

        }
        catch (Exception e)
        {
            return null;
View Full Code Here

        Apple apple = new Apple();
        apple.wash();
        Banana banana = new Banana();
        banana.bite();
        FruitBowl payload = new FruitBowl(apple, banana);
        DefaultMuleMessage msg = new DefaultMuleMessage(payload, muleContext);
        OgnlExpressionEvaluator e = new OgnlExpressionEvaluator();
        Object value = e.evaluate("apple.washed", msg);
        assertNotNull(value);
        assertTrue(value instanceof Boolean);
        assertTrue(((Boolean) value).booleanValue());
View Full Code Here

    {
        AndFilter filter = new AndFilter();
        assertEquals(0, filter.getFilters().size());

        // both null
        assertFalse(filter.accept(new DefaultMuleMessage("foo", muleContext)));

        // only one filter set
        filter.getFilters().add(new EqualsFilter("foo"));
        assertTrue(filter.accept(new DefaultMuleMessage("foo", muleContext)));

        // another one set too, but does not accept
        filter.getFilters().add(new EqualsFilter("foo"));
        assertFalse(filter.accept(new DefaultMuleMessage("bar", muleContext)));

        // both accept
        assertTrue(filter.accept(new DefaultMuleMessage("foo", muleContext)));

        WildcardFilter left = new WildcardFilter("blah.blah.*");
        WildcardFilter right = new WildcardFilter("blah.*");
        filter = new AndFilter(left, right);
        assertEquals(2,filter.getFilters().size());

        assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
        assertTrue(right.accept(new DefaultMuleMessage("blah.blah", muleContext)));
        assertTrue(!left.accept(new DefaultMuleMessage("blah.blah", muleContext)));
        assertTrue(!filter.accept(new DefaultMuleMessage("blah.blah", muleContext)));

        filter = new AndFilter();
        filter.getFilters().add(left);
        filter.getFilters().add(right);

        assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
        assertTrue(!filter.accept(new DefaultMuleMessage("blah.blah", muleContext)));
    }
View Full Code Here

    public void testOrFilter()
    {
        OrFilter filter = new OrFilter();
        assertEquals(0, filter.getFilters().size());
        assertFalse(filter.accept(new DefaultMuleMessage("foo", muleContext)));

        WildcardFilter left = new WildcardFilter("blah.blah.*");
        WildcardFilter right = new WildcardFilter("blah.b*");
        filter = new OrFilter(left, right);
        assertEquals(2, filter.getFilters().size());

        assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
        assertTrue(right.accept(new DefaultMuleMessage("blah.blah", muleContext)));
        assertTrue(!left.accept(new DefaultMuleMessage("blah.blah", muleContext)));
        assertTrue(filter.accept(new DefaultMuleMessage("blah.blah", muleContext)));
        assertTrue(!filter.accept(new DefaultMuleMessage("blah.x.blah", muleContext)));

        filter = new OrFilter();
        LinkedList filters = new LinkedList();
        filters.addLast(left);
        filters.addLast(right);
        filter.setFilters(filters);

        assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
        assertTrue(filter.accept(new DefaultMuleMessage("blah.blah", muleContext)));
        assertTrue(!filter.accept(new DefaultMuleMessage("blah.x.blah", muleContext)));
    }
View Full Code Here

    public void testNotFilter()
    {
        NotFilter notFilter = new NotFilter();
        assertNull(notFilter.getFilter());
        assertFalse(notFilter.accept(new DefaultMuleMessage("foo", muleContext)));
        assertFalse(notFilter.accept(new DefaultMuleMessage(null, muleContext)));

        WildcardFilter filter = new WildcardFilter("blah.blah.*");
        notFilter = new NotFilter(filter);
        assertNotNull(notFilter.getFilter());

        assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
        assertTrue(!notFilter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));

        notFilter = new NotFilter();
        notFilter.setFilter(filter);
        assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
        assertTrue(!notFilter.accept(new DefaultMuleMessage("blah.blah.blah", muleContext)));
    }
View Full Code Here

        props.put("key1", "value1");
       
        Apple apple = new Apple();
        apple.wash();
       
        MuleMessage message = new DefaultMuleMessage(apple, props, muleContext);
        RemoteDispatcherNotification notification = new RemoteDispatcherNotification(message,
            RemoteDispatcherNotification.ACTION_SEND, "vm://foo");
        notification.setProperty("foo", "bar");
        return notification;
    }
View Full Code Here

    public void testExceptionTypeFilter()
    {
        ExceptionTypeFilter filter = new ExceptionTypeFilter();
        assertNull(filter.getExpectedType());
        MuleMessage m = new DefaultMuleMessage("test", muleContext);
        assertTrue(!filter.accept(m));
        m.setExceptionPayload(new DefaultExceptionPayload(new IllegalArgumentException("test")));
        assertTrue(filter.accept(m));

        filter = new ExceptionTypeFilter(IOException.class);
        assertTrue(!filter.accept(m));
        m.setExceptionPayload(new DefaultExceptionPayload(new IOException("test")));
        assertTrue(filter.accept(m));
    }
View Full Code Here

TOP

Related Classes of org.mule.DefaultMuleMessage$SerializedDataHandler

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.