1   /*
2    * $Id: MapCombinerTestCase.java 10319 2008-01-14 21:19:47Z acooke $
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.config.spring.parsers;
12  
13  import org.mule.config.spring.parsers.beans.OrphanBean;
14  
15  public class MapCombinerTestCase extends AbstractNamespaceTestCase
16  {
17  
18      protected String getConfigResources()
19      {
20          return "org/mule/config/spring/parsers/map-combiner-test.xml";
21      }
22  
23      public void testProperties()
24      {
25          OrphanBean bean = (OrphanBean) assertBeanExists("checkProps", OrphanBean.class);
26          logger.info("Map size: " + bean.getMap().size());
27          assertMapEntryExists(bean.getMap(), "0", 0);
28      }
29  
30      public void testCombinedMap()
31      {
32          OrphanBean bean = (OrphanBean) assertBeanExists("orphan", OrphanBean.class);
33          logger.info("Map size: " + bean.getMap().size());
34          for (int i = 0; i < 6; ++i)
35          {
36              assertMapEntryExists(bean.getMap(), Integer.toString(i+1), i+1);
37          }
38      }
39  
40      public void testReverersedOrder()
41      {
42          OrphanBean bean = (OrphanBean) assertBeanExists("orphan2", OrphanBean.class);
43          logger.info("Map size: " + bean.getMap().size());
44          for (int i = 0; i < 2; ++i)
45          {
46              assertMapEntryExists(bean.getMap(), Integer.toString(i+1), i+1);
47          }
48      }
49  
50  }