Package org.mule.api.routing.filter

Examples of org.mule.api.routing.filter.Filter


        assertEquals(ObjectToHttpClientMethodRequest.class, transformer4.getClass());
    }

    public void testFiltersOnEndpoints() throws Exception
    {
        Filter filter = lookupInboundEndpoint("ep5").getFilter();
        assertNotNull(filter);
        assertEquals(HttpRequestWildcardFilter.class, filter.getClass());
        HttpRequestWildcardFilter requestWildcardFilter = (HttpRequestWildcardFilter) filter;
        assertEquals("foo*", requestWildcardFilter.getPattern());
    }
View Full Code Here


    public FileMessageRequester(InboundEndpoint endpoint) throws MuleException
    {
        super(endpoint);
        this.connector = (FileConnector) endpoint.getConnector();
       
        Filter filter = endpoint.getFilter();
        if (filter instanceof FilenameFilter)
        {
            filenameFilter = (FilenameFilter) filter;
        }
        else if (filter instanceof FileFilter)
View Full Code Here

        assertNotNull(service);
        List endpoints = ((ServiceCompositeMessageSource) service.getMessageSource()).getEndpoints();
        assertEquals(1, endpoints.size());

        InboundEndpoint endpoint = (InboundEndpoint) endpoints.get(0);
        Filter filter = endpoint.getFilter();
        assertNotNull(filter);

        assertTrue(filter instanceof FilenameRegexFilter);
        final FilenameRegexFilter f = (FilenameRegexFilter) filter;
        assertEquals(false, f.isCaseSensitive());
View Full Code Here

        ImmutableEndpoint ep = (ImmutableEndpoint) route1.getRoutes().get(0);
       
        assertNotNull(ep.getTransformers());
        assertTrue(TransformerUtils.firstOrNull(ep.getTransformers()) instanceof TestCompressionTransformer);

        Filter filter = ((FilteringOutboundRouter) route1).getFilter();
        assertNotNull(filter);
        assertTrue(filter instanceof PayloadTypeFilter);
        assertEquals(String.class, ((PayloadTypeFilter) filter).getExpectedType());

        // check second Router
        OutboundRouter route2 = (OutboundRouter) router.getRoutes().get(1);
        assertTrue(route2 instanceof FilteringOutboundRouter);

        Filter filter2 = ((FilteringOutboundRouter) route2).getFilter();
        assertNotNull(filter2);
        assertTrue(filter2 instanceof AndFilter);
        assertEquals(2((AndFilter) filter2).getFilters().size());
        Filter left = ((AndFilter) filter2).getFilters().get(0);
        Filter right = ((AndFilter) filter2).getFilters().get(1);
        assertNotNull(left);
        assertTrue(left instanceof RegExFilter);
        assertEquals("the quick brown (.*)", ((RegExFilter) left).getPattern());
        assertNotNull(right);
        assertTrue(right instanceof RegExFilter);
View Full Code Here

        MessageProcessor router = messageRouter.getMessageProcessors().get(0);
        assertTrue(router instanceof MessageFilter);
        MessageFilter sc = (MessageFilter) router;

        assertNotNull(sc.getFilter());
        Filter filter = sc.getFilter();
        // check first Router
        assertTrue(filter instanceof PayloadTypeFilter);
        assertEquals(String.class, ((PayloadTypeFilter) filter).getExpectedType());

        MessageProcessor router2 = messageRouter.getMessageProcessors().get(1);
View Full Code Here

{
    @Test
    public void testSimpleFilters() throws Exception
    {
        ExpressionFilterParser parser = new ExpressionFilterParser();
        Filter f = parser.parseFilterString("#[regex:foo bar]");
        assertNotNull(f);
        assertTrue(f instanceof ExpressionFilter);

        MuleMessage message = new DefaultMuleMessage("foo bar baz", muleContext);
        assertTrue(f.accept(message));


        f = parser.parseFilterString("#[regex:.* bar] AND #[wildcard:foo*]");
        assertNotNull(f);
        assertTrue(f instanceof AndFilter);
        assertEquals(2, ((AndFilter)f).getFilters().size());
        assertTrue(((AndFilter)f).getFilters().get(0) instanceof ExpressionFilter);
        assertEquals("regex", ((ExpressionFilter)((AndFilter)f).getFilters().get(0)).getEvaluator());
        assertTrue(((AndFilter)f).getFilters().get(1) instanceof ExpressionFilter);
        assertEquals("wildcard", ((ExpressionFilter)((AndFilter)f).getFilters().get(1)).getEvaluator());

        message = new DefaultMuleMessage("foo bar", muleContext);
        assertTrue(f.accept(message));

        message = new DefaultMuleMessage("foo car", muleContext);
        assertFalse(f.accept(message));

        f = parser.parseFilterString("#[regex:.* bar] OR #[wildcard:foo*]");
        assertNotNull(f);

        message = new DefaultMuleMessage("foo bar", muleContext);
        assertTrue(f.accept(message));

        message = new DefaultMuleMessage("foo car", muleContext);
        assertTrue(f.accept(message));
    }
View Full Code Here

    {
        ImmutableEndpoint endpoint1 = muleContext.getRegistry()
            .lookupEndpointBuilder("endpoint1")
            .buildInboundEndpoint();
        assertNotNull(endpoint1);
        Filter filter1 = endpoint1.getFilter();
        assertNotNull(filter1);
        assertTrue(filter1 instanceof JmsSelectorFilter);
        assertEquals(1, endpoint1.getProperties().size());
        assertEquals("true", endpoint1.getProperty(JmsConstants.DISABLE_TEMP_DESTINATIONS_PROPERTY));

        ImmutableEndpoint endpoint2 = muleContext.getRegistry()
            .lookupEndpointBuilder("endpoint2")
            .buildOutboundEndpoint();
        assertNotNull(endpoint2);
        Filter filter2 = endpoint2.getFilter();
        assertNotNull(filter2);
        assertTrue(filter2 instanceof NotFilter);
        Filter filter3 = ((NotFilter) filter2).getFilter();
        assertNotNull(filter3);
        assertTrue(filter3 instanceof JmsPropertyFilter);

        InboundEndpoint inboundEndpoint;
View Full Code Here

    }

    @Test
    public void testFiltersOnEndpoints() throws Exception
    {
        Filter filter = lookupInboundEndpoint("ep5").getFilter();
        assertNotNull(filter);
        assertEquals(HttpRequestWildcardFilter.class, filter.getClass());
        HttpRequestWildcardFilter requestWildcardFilter = (HttpRequestWildcardFilter) filter;
        assertEquals("foo*", requestWildcardFilter.getPattern());
    }
View Full Code Here

        }
        splitter.setBatchSize(batchSize);
        splitter.setCounterVariableName(counterVariableName);
        splitter.setMuleContext(muleContext);
        messageProcessors.add(0, splitter);
        messageProcessors.add(new MessageFilter(new Filter()
        {

            @Override
            public boolean accept(MuleMessage message)
            {
View Full Code Here

    }

    @Test
    public void testWireTapFilterAccepted() throws Exception
    {
        wireTap.setFilter(new Filter()
        {
            public boolean accept(MuleMessage message)
            {
                return true;
            }
View Full Code Here

TOP

Related Classes of org.mule.api.routing.filter.Filter

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.