Package org.mule.api.endpoint

Examples of org.mule.api.endpoint.OutboundEndpoint


       
        DefaultOutboundRouterCollection messageRouter = createObject(DefaultOutboundRouterCollection.class);
        messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy());
        assertNotNull(messageRouter.getCatchAllStrategy());

        OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider",
            "test://Test1Provider?exchangePattern=one-way");
        assertNotNull(endpoint1);

        OutboundEndpoint endpoint2 = getTestOutboundEndpoint("Test2Provider");
        assertNotNull(endpoint2);

        Mock mockendpoint1 = RouterTestUtils.getMockEndpoint(endpoint1);
        Mock mockendpoint2 = RouterTestUtils.getMockEndpoint(endpoint2);
View Full Code Here


    public void testCorrelation() throws Exception
    {
        FilteringOutboundRouter filterRouter = new FilteringOutboundRouter();
        MuleSession session = getTestSession(getTestService(), muleContext);
        MuleMessage message = new DefaultMuleMessage(new StringBuffer(), muleContext);
        OutboundEndpoint endpoint = getTestOutboundEndpoint("test");
        filterRouter.setMessageProperties(session.getFlowConstruct(), message, endpoint);
        assertNotNull(message.getCorrelationId());
    }
View Full Code Here

    }

    public void testSend() throws Exception
    {
        //muleContext.getRegistry().registerConnector(createConnector(false));
        OutboundEndpoint endpoint = muleContext.getEndpointFactory().getOutboundEndpoint(
            getTestEndpointURI());
       
        Service service = getTestService(uniqueName("testComponent"), FunctionalTestComponent.class);
        // TODO Simplify this API for adding an outbound endpoint.
        OutboundPassThroughRouter passThroughRouter = new OutboundPassThroughRouter();
        passThroughRouter.addRoute(endpoint);
        ((OutboundRouterCollection) service.getOutboundMessageProcessor()).addRoute(passThroughRouter);
        //muleContext.getRegistry().registerComponent(service);

        MuleMessage message = new DefaultMuleMessage(MESSAGE, muleContext);
        message.setOutboundProperty(MailProperties.TO_ADDRESSES_PROPERTY, EMAIL);
        MuleSession session = getTestSession(getTestService("apple", Apple.class), muleContext);
        DefaultMuleEvent event = new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, session,
            new ResponseOutputStream(System.out));
        endpoint.process(event);

        getServers().waitForIncomingEmail(AbstractEmailFunctionalTestCase.DELIVERY_DELAY_MS, 1);
        MimeMessage[] messages = getServers().getReceivedMessages();
        assertNotNull("did not receive any messages", messages);
        assertEquals("did not receive 1 mail", 1, messages.length);
View Full Code Here

        assertTrue(c.isStarted());
    }

    public void testNullUsernameAndPassword() throws Exception
    {
        OutboundEndpoint endpoint = muleContext.getEndpointFactory().getOutboundEndpoint("smtp://localhost:23");
        URLName name = ((AbstractMailConnector)getConnector()).urlFromEndpoint(endpoint);
        assertNull(name.getUsername());
        assertNull(name.getPassword());

        endpoint = muleContext.getEndpointFactory().getOutboundEndpoint("smtp://george@localhost:23");
View Full Code Here

                // the correlationId will be set by the AbstractOutboundRouter
                message.setCorrelationGroupSize(recipients.size());
            }
        }

        OutboundEndpoint endpoint = null;
        for (Object recipient : recipients)
        {
            // Make a copy of the message. Question is do we do a proper clone? in
            // which case there would potentially be multiple messages with the same id...
            MuleMessage request = new DefaultMuleMessage(message.getPayload(), message, muleContext);
            try
            {
                endpoint = getRecipientEndpoint(request, recipient);
   
                boolean sync =
                    (this.synchronous == null ? endpoint.getExchangePattern().hasResponse() : this.synchronous.booleanValue());
               
                if (sync)
                {
                    results.add(sendRequest(event, request, endpoint, true));
                }
View Full Code Here

        return resultsHandler.aggregateResults(results, event, muleContext);
    }

    protected OutboundEndpoint getRecipientEndpoint(MuleMessage message, Object recipient) throws MuleException
    {
        OutboundEndpoint endpoint = null;
        if (recipient instanceof OutboundEndpoint)
        {
            endpoint = (OutboundEndpoint) recipient;
        }
        else if (recipient instanceof EndpointURI)
        {
            endpoint = getRecipientEndpointFromUri((EndpointURI) recipient);
        }
        else if (recipient instanceof String)
        {
            endpoint = getRecipientEndpointFromString(message, (String) recipient);
        }
        if (null == endpoint)
        {
            throw new RegistrationException(MessageFactory.createStaticMessage("Failed to create endpoint for: " + recipient));
        }

        OutboundEndpoint existingEndpoint = recipientCache.putIfAbsent(recipient, endpoint);
        if (existingEndpoint != null)
        {
            endpoint = existingEndpoint;
        }
        return endpoint;
View Full Code Here

    }

    protected OutboundEndpoint getRecipientEndpointFromUri(EndpointURI uri)
            throws MuleException
    {
        OutboundEndpoint endpoint = null;
        if (null != getMuleContext() && null != getMuleContext().getRegistry())
        {
            endpoint = getMuleContext().getEndpointFactory().getOutboundEndpoint(uri.getAddress());
        }
        if (null != endpoint)
View Full Code Here

    }

    protected OutboundEndpoint getRecipientEndpointFromString(MuleMessage message, String recipient)
            throws MuleException
    {
        OutboundEndpoint endpoint = recipientCache.get(recipient);
        if (null == endpoint && null != getMuleContext() && null != getMuleContext().getRegistry())
        {
            endpoint = getMuleContext().getEndpointFactory().getOutboundEndpoint(recipient);
        }
        return endpoint;
View Full Code Here

    public void testFilteringOutboundRouterAsync() throws Exception
    {
        Mock session = MuleTestUtils.getMockSession();
        session.matchAndReturn("getFlowConstruct", getTestService());
       
        OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider",
            "test://Test1Provider?exchangePattern=request-response");
        assertNotNull(endpoint1);

        Mock mockEndpoint = RouterTestUtils.getMockEndpoint(endpoint1);
        FilteringOutboundRouter router = new FilteringOutboundRouter();
View Full Code Here

    public void testFilteringOutboundRouterSync() throws Exception
    {
        Mock session = MuleTestUtils.getMockSession();
        session.matchAndReturn("getFlowConstruct", getTestService());

        OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider",
            "test://Test1Provider?exchangePattern=request-response");
        assertNotNull(endpoint1);
        Mock mockEndpoint = RouterTestUtils.getMockEndpoint(endpoint1);
        FilteringOutboundRouter router = new FilteringOutboundRouter();
        PayloadTypeFilter filter = new PayloadTypeFilter(String.class);
View Full Code Here

TOP

Related Classes of org.mule.api.endpoint.OutboundEndpoint

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.