1   /*
2    * $Id: SpringAutowireConfigBuilderTestCase.java 9206 2007-10-18 15:38:38Z holger $
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.extras.spring.config;
12  
13  import org.mule.MuleManager;
14  import org.mule.config.ConfigurationBuilder;
15  import org.mule.impl.container.ContainerKeyPair;
16  import org.mule.tck.AbstractConfigBuilderTestCase;
17  import org.mule.tck.testmodels.fruit.FruitBowl;
18  import org.mule.umo.manager.UMOManager;
19  
20  /**
21   * Tests the Mule-to-Spring XSLT transformation with Autowiring for Mule.
22   */
23  public class SpringAutowireConfigBuilderTestCase extends AbstractConfigBuilderTestCase
24  {
25  
26      public String getConfigResources()
27      {
28          return "test-mule-autowire-app-context.xml,test-application-context.xml";
29      }
30  
31      // @Override
32      public ConfigurationBuilder getBuilder()
33      {
34          return new SpringConfigurationBuilder();
35      }
36  
37      public void testComponentResolverConfig() throws Exception
38      {
39          // test container init
40          UMOManager manager = MuleManager.getInstance();
41          assertNotNull(manager.getContainerContext());
42  
43          Object object = manager.getContainerContext().getComponent(
44              new ContainerKeyPair("spring", "fruitBowl"));
45          assertNotNull(object);
46          assertTrue(object instanceof FruitBowl);
47          FruitBowl bowl = (FruitBowl) object;
48          assertTrue(bowl.hasBanana());
49          assertTrue(bowl.hasApple());
50      }
51  
52  }