1   /*
2    * $Id: InheritedPropertiesMule2458TestCase.java 10761 2008-02-10 21:43:57Z rossmason $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.test.spring;
12  
13  import org.mule.api.endpoint.ImmutableEndpoint;
14  import org.mule.api.service.Service;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class InheritedPropertiesMule2458TestCase extends FunctionalTestCase
18  {
19  
20      protected String getConfigResources()
21      {
22          return "org/mule/test/spring/inherited-properties-mule-2458-test.xml";
23      }
24  
25      public void testProperties()
26      {
27          Service service = muleContext.getRegistry().lookupService("service");
28          assertNotNull(service);
29          ImmutableEndpoint endpoint = (ImmutableEndpoint) service.getInboundRouter().getEndpoints().get(0);
30          assertNotNull(endpoint);
31  
32          assertProperty(endpoint, "global-only", "global");
33          assertProperty(endpoint, "local-only", "local");
34          assertProperty(endpoint, "url-only", "url");
35  
36          assertProperty(endpoint, "global-and-local", "local");
37          assertProperty(endpoint, "global-and-url", "global");
38          assertProperty(endpoint, "local-and-url", "local");
39          
40          assertProperty(endpoint, "all", "local");
41      }
42  
43      protected void assertProperty(ImmutableEndpoint endpoint, String name, String value)
44      {
45          Object property = endpoint.getProperty(name);
46          assertNotNull("Property " + name + " is missing", property);
47          String actual = property.toString();
48          assertEquals("Unexpected value for " + name + ": " + actual + ", not " + value, value, actual);
49      }
50  
51  }