View Javadoc

1   /*
2    * $Id: ReferenceCollectionTestCase.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.OrphanBean;
14  
15  import java.util.Collection;
16  
17  /**
18   * References to collections in attributes are currently not handled correctly
19   */
20  public class ReferenceCollectionTestCase extends AbstractNamespaceTestCase
21  {
22  
23      protected String getConfigResources()
24      {
25          return "org/mule/config/spring/parsers/reference-collection-test.xml";
26      }
27  
28      protected void testOffspringRef(int index, int size)
29      {
30          OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class);
31          Collection offspring = (Collection) assertContentExists(orphan.getOffspring(), Collection.class);
32          assertEquals(size, offspring.size());
33      }
34  
35      public void testNamed()
36      {
37          testOffspringRef(1, 2);
38      }
39  
40      public void testOrphan()
41      {
42          testOffspringRef(2, 1);
43      }
44  
45      public void testParent()
46      {
47          testOffspringRef(3, 3);
48      }
49  
50  }