Package org.mule.routing.filters

Examples of org.mule.routing.filters.ExpressionFilter


    {
        if (null != property)
        {
            ExpressionConfig config = new ExpressionConfig();
            config.parse(property);
            ExpressionFilter filter = new ExpressionFilter(config.getExpression(), config.getEvaluator(), config.getCustomEvaluator());
            filter.setMuleContext(context);
            return filter;
        }
        else
        {
            return null;
View Full Code Here


        InboundEndpoint ep = eb.buildInboundEndpoint();

        assertNotNull(ep.getFilter());
        assertTrue(ep.getFilter() instanceof ExpressionFilter);
        ExpressionFilter filter = (ExpressionFilter) ep.getFilter();
        assertEquals("payload-type", filter.getEvaluator());
        assertEquals("java.lang.String", filter.getExpression());
        assertNull(filter.getCustomEvaluator());
        assertFalse(filter.isNullReturnsTrue());
    }
View Full Code Here

        InboundEndpoint ep = eb.buildInboundEndpoint();

        assertNotNull(ep.getFilter());
        assertTrue(ep.getFilter() instanceof ExpressionFilter);
        ExpressionFilter filter = (ExpressionFilter) ep.getFilter();
        assertEquals("header", filter.getEvaluator());
        assertEquals("foo=bar", filter.getExpression());
        assertNull(filter.getCustomEvaluator());
        assertTrue(filter.isNullReturnsTrue());
    }
View Full Code Here

        InboundEndpoint ep = eb.buildInboundEndpoint();

        assertNotNull(ep.getFilter());
        assertTrue(ep.getFilter() instanceof ExpressionFilter);
        ExpressionFilter filter = (ExpressionFilter) ep.getFilter();
        assertEquals("custom", filter.getEvaluator());
        assertEquals("a.b.c", filter.getExpression());
        assertEquals("something", filter.getCustomEvaluator());
        assertFalse(filter.isNullReturnsTrue());
    }
View Full Code Here

        }
    }

    public void testExpressionFilter() throws Exception
    {
        ExpressionFilter filter = new ExpressionFilter("#[json:[0]/text]");
        filter.setMuleContext(muleContext);
        assertTrue(filter.accept(message));

        filter.setExpression("[0]/favorited");
        assertFalse(filter.accept(message));

        filter.setExpression("[0]/truncated");
        assertTrue(filter.accept(message));

        filter.setExpression("[0]/source");
        assertTrue(filter.accept(message));

        filter.setExpression("[0]/xxx");
        assertFalse(filter.accept(message));
    }
View Full Code Here

        assertFalse(filter.accept(message));
    }

    public void testExpressionFilterWithBooleanLogic() throws Exception
    {
        ExpressionFilter filter = new ExpressionFilter("#[json:[0]/text]");
        filter.setMuleContext(muleContext);
        assertTrue(filter.accept(message));

        filter.setExpression("[0]/favorited=false");
        assertTrue(filter.accept(message));

        filter.setExpression("[0]/truncated != true");
        assertFalse(filter.accept(message));

        filter.setExpression("[0]/source=null");
        assertFalse(filter.accept(message));

        filter.setExpression("[0]/source!= null");
        assertTrue(filter.accept(message));

    }
View Full Code Here

    public void testExpressionFilterWithBooleanLogicWhereElementDoesNotExist() throws Exception
    {
        // Checks against elements that do not exist

        ExpressionFilter filter = new ExpressionFilter("#[json:[0]/xyz = null]");
        filter.setMuleContext(muleContext);
        assertTrue(filter.accept(message));

        filter.setExpression("[0]/xyz!= null");
        assertFalse(filter.accept(message));
    }
View Full Code Here

            }
        }

        if (failureExpression != null)
        {
            failureExpressionFilter = new ExpressionFilter(failureExpression);
        }
        else
        {
            failureExpressionFilter = new ExpressionFilter("exception-type:");
        }
        failureExpressionFilter.setMuleContext(muleContext);

        if ((ackExpression != null) && (!muleContext.getExpressionManager().isExpression(ackExpression)))
        {
View Full Code Here

    public void initialise() throws InitialisationException
    {
        super.initialise();
        if (failureExpression != null)
        {
            failureExpressionFilter = new ExpressionFilter(failureExpression);
        }
        else
        {
            failureExpressionFilter = new ExpressionFilter("exception-type:");
        }
        failureExpressionFilter.setMuleContext(muleContext);
    }
View Full Code Here

        }

        if (errorFilter == null)
        {
            // We'll set a default filter that checks the return code
            errorFilter = new ExpressionFilter("#[header:INBOUND:http.status!=200]");
            logger.info("Setting default error filter to ExpressionFilter('#[header:INBOUND:http.status!=200]')");
        }
    }
View Full Code Here

TOP

Related Classes of org.mule.routing.filters.ExpressionFilter

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.