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.tck.junit4.FunctionalTestCase;
10  
11  import org.junit.Test;
12  
13  import static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertNotNull;
15  
16  public class PropertyPlaceholderMule2150TestCase extends FunctionalTestCase
17  {
18  
19      @Override
20      protected String getConfigResources()
21      {
22          System.getProperties().put("systemProperty", "org");
23          return "org/mule/test/spring/property-placeholder-mule-2150-test.xml";
24      }
25  
26      protected String getProperty(String name)
27      {
28          MapHolder holder = (MapHolder) muleContext.getRegistry().lookupObject("props");
29          String value = (String) holder.getMap().get(name);
30          assertNotNull(name, value);
31          return value;
32      }
33  
34      @Test
35      public void testMuleEnvironment()
36      {
37          assertEquals("value1", getProperty("prop1"));
38      }
39  
40      @Test
41      public void testSpringPropertyPlaceholder()
42      {
43          assertEquals("value2", getProperty("prop2"));
44      }
45  
46      @Test
47      public void testJavaEnvironment()
48      {
49          assertEquals(System.getProperty("java.version"), getProperty("prop3"));
50      }
51  
52  }