Package org.mule.api.endpoint

Examples of org.mule.api.endpoint.OutboundEndpoint.process()


    public MuleMessage process(String uri, MessageExchangePattern mep, MuleMessage message)
        throws MuleException
    {
        OutboundEndpoint endpoint = endpointCache.getOutboundEndpoint(uri, mep, null);
        return returnMessage(endpoint.process(createMuleEvent(message, endpoint)));
    }

    protected MuleEvent createMuleEvent(MuleMessage message, OutboundEndpoint endpoint)
        throws EndpointException
    {
View Full Code Here


        // exception to throw
        MuleSession session = mock(MuleSession.class);
        MuleEvent eventToThrow = new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, null, session);
        MuleException rex = new RoutingException(eventToThrow, endpoint1);
        when(mockendpoint1.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(rex));
        when(mockendpoint2.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(rex));
        MuleEvent result = null;
        try
        {
            result = router.route(new OutboundRoutingTestEvent(message, session, muleContext));
            fail("Should have thrown exception as both targets would have failed");
View Full Code Here

        // exception to throw
        MuleEvent eventToThrow = new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, null, session);
        MuleException rex = new RoutingException(eventToThrow, endpoint1);
        // 1st failure
        when(mockendpoint1.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(rex));
        when(mockendpoint2.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(event));

        MuleEvent actualResult = router.route(new OutboundRoutingTestEvent(message, session, muleContext));
        assertEquals("Got an invalid return message.", expectedResultMessage, actualResult.getMessage());
    }
View Full Code Here

        // exception to throw
        MuleEvent eventToThrow = new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, null, session);
        MuleException rex = new RoutingException(eventToThrow, endpoint1);

        when(mockendpoint1.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(rex));
        when(mockendpoint2.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(event));

        MuleEvent actualResult = router.route(new OutboundRoutingTestEvent(message, session, muleContext));
        assertNull("Async call should not return any results.", actualResult);
    }
View Full Code Here

        final MuleSession session = mock(MuleSession.class);
        // 1st failure
        when(mockendpoint1.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(exPayloadMessageEvent));
        // next endpoint
        when(mockendpoint2.process(any(MuleEvent.class))).thenAnswer(new MuleEventCheckAnswer(expectedResultEvent));

        MuleEvent actualResult = router.route(new OutboundRoutingTestEvent(message, session, muleContext));
        assertEquals("Got an invalid return message.", expectedResultMessage, actualResult.getMessage());
    }
}
View Full Code Here

       
        OutboundEndpoint endpoint = createOutboundEndpoint(null, null, reqTransformer, resTransformer,
            MessageExchangePattern.REQUEST_RESPONSE, null);

        testOutboundEvent = createTestOutboundEvent();
        MuleEvent result = endpoint.process(testOutboundEvent);

        Mockito.verify(reqTransformer, Mockito.times(1)).process(Mockito.any(MuleEvent.class));
        Mockito.verify(resTransformer, Mockito.times(1)).process(Mockito.any(MuleEvent.class));
       
        assertMessageSentSame(true);
View Full Code Here

        OutboundEndpoint endpoint = createOutboundEndpoint(null, null, reqTransformer, resTransformer,
            MessageExchangePattern.ONE_WAY, null);

        testOutboundEvent = createTestOutboundEvent();
        MuleEvent result = endpoint.process(testOutboundEvent);
       
        Mockito.verify(reqTransformer, Mockito.times(1)).process(Mockito.any(MuleEvent.class));
        Mockito.verify(resTransformer, Mockito.never()).process(Mockito.any(MuleEvent.class));

        dispacher.latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS);
View Full Code Here

    {
        OutboundEndpoint endpoint = createOutboundEndpoint(null, new TestSecurityFilter(true),
            null, null, MessageExchangePattern.REQUEST_RESPONSE, null);

        testOutboundEvent = createTestOutboundEvent();
        MuleEvent result = endpoint.process(testOutboundEvent);

        assertMessageSentSame(true);

        assertSame(responseMessage, result.getMessage());
View Full Code Here

        testOutboundEvent = createTestOutboundEvent();
        RequestContext.setEvent(testOutboundEvent);
        try
        {
            endpoint.process(testOutboundEvent);
            fail("Exception expected");
        }
        catch (TestSecurityFilter.StaticMessageUnauthorisedException e)
        {
            testOutboundEvent.getFlowConstruct().getExceptionListener().handleException(e, testOutboundEvent);
View Full Code Here

        muleContext.registerListener(listener);

        OutboundEndpoint endpoint = createOutboundEndpoint(null, null, null, null,
            MessageExchangePattern.REQUEST_RESPONSE, null);
        MuleEvent outboundEvent = createTestOutboundEvent();
        endpoint.process(outboundEvent);

        assertTrue(listener.latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
        assertEquals(2, listener.messageNotificationList.size());
        assertEquals(EndpointMessageNotification.MESSAGE_SEND_BEGIN, listener.messageNotificationList.get(0).getAction());
        assertEquals(EndpointMessageNotification.MESSAGE_SEND_END, listener.messageNotificationList.get(1).getAction());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.