View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.endpoint.outbound;
8   
9   import org.mule.RequestContext;
10  import org.mule.api.MuleEvent;
11  import org.mule.api.config.MuleProperties;
12  import org.mule.api.endpoint.OutboundEndpoint;
13  import org.mule.api.processor.MessageProcessor;
14  import org.mule.endpoint.AbstractMessageProcessorTestCase;
15  
16  import org.junit.Test;
17  
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertSame;
20  
21  public class OutboundEndpointPropertyMessageProcessorTestCase extends AbstractMessageProcessorTestCase
22  {
23  
24      @Test
25      public void testProcess() throws Exception
26      {
27          MessageProcessor mp = new OutboundEndpointPropertyMessageProcessor();
28          OutboundEndpoint endpoint = createTestOutboundEndpoint(null, null);
29  
30          MuleEvent event = mp.process(createTestOutboundEvent(endpoint));
31  
32          assertEquals(endpoint.getEndpointURI().getUri().toString(),
33                       event.getMessage().getOutboundProperty(MuleProperties.MULE_ENDPOINT_PROPERTY));
34          assertSame(event, RequestContext.getEvent());
35      }
36  
37  }