1   /*
2    * $Id: EmbeddedBeansXmlTestCase.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.tck.FunctionalTestCase;
15  import org.mule.umo.manager.ObjectNotFoundException;
16  import org.mule.umo.manager.UMOContainerContext;
17  
18  /**
19   * Tests an embedded (inline) Spring config XML within a Mule config file.
20   */
21  public class EmbeddedBeansXmlTestCase extends FunctionalTestCase
22  {
23  
24      protected String getConfigResources()
25      {
26          return "test-embedded-spring-config.xml";
27      }
28  
29      protected void doFunctionalSetUp() throws Exception
30      {
31          System.setProperty("org.mule.xml.validate", "false");
32      }
33  
34      protected void doFunctionalTearDown() throws Exception
35      {
36          System.setProperty("org.mule.xml.validate", "true");
37      }
38  
39      public void testContainer() throws Exception
40      {
41          UMOContainerContext context = MuleManager.getInstance().getContainerContext();
42          assertNotNull(context);
43          assertNotNull(context.getComponent("Apple"));
44          assertNotNull(context.getComponent("Banana"));
45  
46          try
47          {
48              context.getComponent("Orange");
49              fail("Object should  not found");
50          }
51          catch (ObjectNotFoundException e)
52          {
53              // ignore
54          }
55      }
56  }