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


    }

    @Test
    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

    }

    @Test
    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

    @Test
    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

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.