Package org.mule.api.endpoint

Examples of org.mule.api.endpoint.OutboundEndpoint


        Header locationHeader = method.getResponseHeader(HttpConstants.HEADER_LOCATION);
        if (locationHeader == null)
        {
            throw new HttpResponseException(method.getStatusText(), method.getStatusCode());
        }
        OutboundEndpoint out = new EndpointURIEndpointBuilder(locationHeader.getValue(),
            connector.getMuleContext()).buildOutboundEndpoint();
        MuleEvent result = out.process(event);
        if (result != null)
        {
            return result.getMessage();
        }
        else
View Full Code Here


    }

    protected MuleMessage dispatchAction(RemoteDispatcherNotification action, boolean synchronous, int timeout)
        throws MuleException
    {
        OutboundEndpoint serverEndpoint;
        if (synchronous)
        {
            serverEndpoint = syncServerEndpoint;
        }
        else
        {
            serverEndpoint = asyncServerEndpoint;
        }
        MuleMessage serializeMessage = new DefaultMuleMessage(action, muleContext);

        updateContext(serializeMessage, serverEndpoint, synchronous);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        wireFormat.write(out, serializeMessage, serverEndpoint.getEncoding());
        byte[] payload = out.toByteArray();

        MuleMessage message = action.getMessage();

        if (message == null)
        {
            message = new DefaultMuleMessage(payload, muleContext);
        }
        else
        {
            message = new DefaultMuleMessage(payload, message, muleContext);
        }

        message.addProperties(action.getProperties());
        MuleSession session = new DefaultMuleSession(muleContext);

        MuleEvent event = new DefaultMuleEvent(message, serverEndpoint.getExchangePattern(), session);
        event.setTimeout(timeout);
        if (logger.isDebugEnabled())
        {
            logger.debug("MuleClient sending remote call to: " + action.getResourceIdentifier() + ". At "
                         + serverEndpoint.toString() + " . Event is: " + event);
        }


        MuleMessage result = null;

        try
        {
            MuleEvent resultEvent = serverEndpoint.process(event);
            if (resultEvent != null)
            {
                result = resultEvent.getMessage();
            }
View Full Code Here

    {
        Mock session = MuleTestUtils.getMockSession();
        session.matchAndReturn("getFlowConstruct", getTestService());
        RegExFilter filter = new RegExFilter("(.*) Message");

        OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider", "test://test1", null, filter, null);
        assertNotNull(endpoint1);

        OutboundEndpoint endpoint2 = getTestOutboundEndpoint("Test2Provider", "test://test2", null, filter, null);
        assertNotNull(endpoint2);
        Mock mockendpoint1 = RouterTestUtils.getMockEndpoint(endpoint1);
        Mock mockendpoint2 = RouterTestUtils.getMockEndpoint(endpoint2);

        MulticastingRouter router = createObject(MulticastingRouter.class);
View Full Code Here

    {
        Mock session = MuleTestUtils.getMockSession();
        session.matchAndReturn("getFlowConstruct", getTestService());
        session.matchAndReturn("setFlowConstruct", RouterTestUtils.getArgListCheckerFlowConstruct(), null);

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

        OutboundEndpoint endpoint2 = getTestOutboundEndpoint("Test2Provider",
            "test://Test2Provider?exchangePattern=request-response");
        assertNotNull(endpoint2);
        Mock mockendpoint1 = RouterTestUtils.getMockEndpoint(endpoint1);
        Mock mockendpoint2 = RouterTestUtils.getMockEndpoint(endpoint2);
View Full Code Here

    {
        Mock session = MuleTestUtils.getMockSession();
        session.matchAndReturn("getFlowConstruct", getTestService());
        session.matchAndReturn("setFlowConstruct", RouterTestUtils.getArgListCheckerFlowConstruct(), null);

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

        OutboundEndpoint endpoint2 = getTestOutboundEndpoint("Test2Provider",
            "test://Test2Provider?exchangePattern=request-response");
        assertNotNull(endpoint2);

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

    }

    public void testDispatchersLifecycle() throws Exception
    {
        //using sync endpoint so that any calls to 'process()' will be blocking and avoid timing issues
        OutboundEndpoint out = getTestOutboundEndpoint("out",
            "test://out?exchangePattern=request-response", null, null, null, connector);

        // attempts to send/dispatch/request are made on a stopped/stopping connector
        // This should fail because the connector is not started!
        try
        {
            out.process(getTestEvent("data"));
            fail("cannot send on a connector that is not started");
        }
        catch (LifecycleException e)
        {
            // expected
        }

        assertEquals(0, connector.dispatchers.getNumIdle());

        // Dispatcher is not started or connected
        assertDispatcherStartedConnected(out, false, false);

        connector.start();
        //This causes the first instance out dispatcher to be created
        assertDispatcherStartedConnected(out, true, true);

        OutboundEndpoint out2 = getTestOutboundEndpoint("out2",
            "test://out2?exchangePattern=request-response", null, null, null, connector);
        //This causes the first instance out2 dispatcher to be created
        out2.process(getTestEvent("data"));

        //At this point there should be two idle, but the build server reports one, I suspect its a timing issues
        assertEquals(2, connector.dispatchers.getNumIdle());
        assertDispatcherStartedConnected(out, true, true);
        assertDispatcherStartedConnected(out2, true, true);
View Full Code Here

    }

    public void testDispatcherFullLifecycle() throws Exception
    {
        OutboundEndpoint out = getTestOutboundEndpoint("out", "test://out", null, null, null, connector);

        MessageDispatcher dispatcher = connector.getDispatcherFactory().create(out);
        dispatcher.initialise();
       
        assertTrue(dispatcher.getLifecycleState().isInitialised());
View Full Code Here

    public void testCorrelationGroupSizePropertySet() throws Exception
    {
        Service testService = getTestService("test", Apple.class);
        MuleSession session = getTestSession(testService, muleContext);

        OutboundEndpoint endpoint = getTestOutboundEndpoint("Test1Endpoint",
            "test://endpoint?exchangePattern=request-response");
        ListMessageSplitter router = new ListMessageSplitter();
        router.setFilter(null);
        router.addRoute(endpoint);
        router.setMuleContext(muleContext);
View Full Code Here

    {
        Mock session = MuleTestUtils.getMockSession();
        session.matchAndReturn("getFlowConstruct", getTestService());
        session.matchAndReturn("setFlowConstruct", RouterTestUtils.getArgListCheckerFlowConstruct(), null);

        OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1endpoint", "test://endpointUri.1", null, new PayloadTypeFilter(Apple.class), null);
        OutboundEndpoint endpoint2 = getTestOutboundEndpoint("Test2Endpoint", "test://endpointUri.2", null, new PayloadTypeFilter(Orange.class), null);
        OutboundEndpoint endpoint3 = getTestOutboundEndpoint("Test3Endpoint", "test://endpointUri.3");
        Mock mockendpoint1 = RouterTestUtils.getMockEndpoint(endpoint1);
        Mock mockendpoint2 = RouterTestUtils.getMockEndpoint(endpoint2);
        Mock mockendpoint3 = RouterTestUtils.getMockEndpoint(endpoint3);

        OutboundEndpoint endpoint4 = getTestOutboundEndpoint("Test4endpoint",
            "test://endpointUri.4?exchangePattern=request-response", null,
            new PayloadTypeFilter(Apple.class), null);
        OutboundEndpoint endpoint5 = getTestOutboundEndpoint("Test5Endpoint",
            "test://endpointUri.5?exchangePattern=request-response", null,
            new PayloadTypeFilter(Orange.class), null);
        OutboundEndpoint endpoint6 = getTestOutboundEndpoint("Test6Endpoint",
            "test://endpointUri.6?exchangePattern=request-response");
        Mock mockendpoint4 = RouterTestUtils.getMockEndpoint(endpoint4);
        Mock mockendpoint5 = RouterTestUtils.getMockEndpoint(endpoint5);
        Mock mockendpoint6 = RouterTestUtils.getMockEndpoint(endpoint6);
View Full Code Here

    }

    public void testOutboundEndpointCache() throws MuleException
    {
        MuleClient muleClient = new MuleClient(muleContext);
        OutboundEndpoint endpointa = muleClient.getOutboundEndpoint("test://test1",
            MessageExchangePattern.REQUEST_RESPONSE, null);
        OutboundEndpoint endpointb = muleClient.getOutboundEndpoint("test://test1",
            MessageExchangePattern.REQUEST_RESPONSE, null);
        OutboundEndpoint endpointd = muleClient.getOutboundEndpoint("test://test2",
            MessageExchangePattern.REQUEST_RESPONSE, null);
        OutboundEndpoint endpointc = muleClient.getOutboundEndpoint("test://test1",
            MessageExchangePattern.REQUEST_RESPONSE, null);
        assertEquals(endpointa, endpointc);
        assertEquals(endpointb, endpointb);
        assertNotSame(endpointa, endpointd);
    }
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.