View Javadoc

1   /*
2    * $Id: AliasTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
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.config.spring.parsers;
12  
13  import org.mule.config.spring.parsers.beans.AbstractBean;
14  import org.mule.config.spring.parsers.beans.ChildBean;
15  import org.mule.config.spring.parsers.beans.OrphanBean;
16  
17  public class AliasTestCase extends AbstractNamespaceTestCase
18  {
19  
20      protected String getConfigResources()
21      {
22          return "org/mule/config/spring/parsers/alias-test.xml";
23      }
24  
25      protected void assertFooExists(int index)
26      {
27          OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class);
28          assertFooExists(orphan, 10 * index + 1);
29          ChildBean child = (ChildBean) assertContentExists(orphan.getChild(), ChildBean.class);
30          assertFooExists(child, 10 * index + 2);
31      }
32  
33      protected void assertFooExists(AbstractBean bean, int value)
34      {
35          assertNotNull(bean);
36          assertEquals(value, bean.getFoo());
37      }
38  
39      public void testNamed()
40      {
41          assertFooExists(1);
42      }
43  
44      public void testOrphan()
45      {
46          assertFooExists(2);
47      }
48  
49      public void testParent()
50      {
51          assertFooExists(3);
52      }
53  
54  }