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.test.spring;
8   
9   import org.mule.api.endpoint.ImmutableEndpoint;
10  import org.mule.api.service.Service;
11  import org.mule.service.ServiceCompositeMessageSource;
12  import org.mule.tck.junit4.FunctionalTestCase;
13  
14  import org.junit.Test;
15  
16  import static org.junit.Assert.assertEquals;
17  import static org.junit.Assert.assertNotNull;
18  
19  public class GlobalPropertiesMule2458TestCase extends FunctionalTestCase
20  {
21  
22      @Override
23      protected String getConfigResources()
24      {
25          return "org/mule/test/spring/global-properties-mule-2458-test.xml";
26      }
27  
28      @Test
29      public void testProperties()
30      {
31          Service service = muleContext.getRegistry().lookupService("service");
32          assertNotNull(service);
33          ImmutableEndpoint ep = ((ServiceCompositeMessageSource) service.getMessageSource()).getEndpoints().get(0);
34          assertNotNull(ep);
35          assertEquals("local", ep.getProperties().get("local"));
36          assertEquals("global", ep.getProperties().get("global"));
37          assertEquals("local", ep.getProperties().get("override-me"));
38          assertEquals(3, ep.getProperties().size());
39      }
40  
41  }