View Javadoc

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