1   /*
2    * $Id: SpringAutowireConfigBuilderTestCase.java 7976 2007-08-21 14:26:13Z dirk.olmes $
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      public ConfigurationBuilder getBuilder()
32      {
33          return new SpringConfigurationBuilder();
34      }
35  
36      public void testComponentResolverConfig() throws Exception
37      {
38          // test container init
39          UMOManager manager = MuleManager.getInstance();
40          assertNotNull(manager.getContainerContext());
41  
42          Object object = manager.getContainerContext().getComponent(
43              new ContainerKeyPair("spring", "fruitBowl"));
44          assertNotNull(object);
45          assertTrue(object instanceof FruitBowl);
46          FruitBowl bowl = (FruitBowl)object;
47          assertTrue(bowl.hasBanana());
48          assertTrue(bowl.hasApple());
49      }
50  
51  }