View Javadoc

1   /*
2    * $Id: MuleCopiedEndpointURITestCase.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;
12  
13  import org.mule.api.endpoint.EndpointURI;
14  import org.mule.api.endpoint.ImmutableEndpoint;
15  import org.mule.tck.MuleTestUtils;
16  import org.mule.tck.junit4.AbstractMuleContextTestCase;
17  
18  import org.junit.Test;
19  
20  import static org.junit.Assert.assertEquals;
21  
22  public class MuleCopiedEndpointURITestCase extends AbstractMuleContextTestCase
23  {
24  
25      /**
26       * See MULE-2164
27       * @throws Exception
28       */
29      @Test
30      public void testCopyMetaSchemeEndpointURI() throws Exception
31      {
32          // Create and test values
33          ImmutableEndpoint endpoint = MuleTestUtils.getTestSchemeMetaInfoOutboundEndpoint("testEndpoint", "protocol", muleContext);
34          EndpointURI endpointUri = endpoint.getEndpointURI();
35          assertEquals("protocol", endpointUri.getScheme());
36          assertEquals("test", endpointUri.getSchemeMetaInfo());
37          assertEquals("test:protocol", endpointUri.getFullScheme());
38          assertEquals("test", endpointUri.getAddress());
39  
40          // Copy and test values
41          EndpointURI newEndpointUri = new MuleEndpointURI(endpointUri);
42          newEndpointUri.initialise();
43          assertEquals("protocol", newEndpointUri.getScheme());
44          assertEquals("test", newEndpointUri.getSchemeMetaInfo());
45          assertEquals("test:protocol", newEndpointUri.getFullScheme());
46          assertEquals("test", newEndpointUri.getAddress());
47          assertEquals(endpointUri, newEndpointUri);
48      }
49  
50  }