View Javadoc

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