1   /*
2    * $Id: MultiContainerTestCase.java 10529 2008-01-25 05:58:36Z dfeist $
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.test.integration.config;
12  
13  import org.mule.tck.FunctionalTestCase;
14  
15  /**
16   * Tests Deploying and referencing components from two different spring container
17   * contexts
18   * 
19   * TODO MULE-1789
20   */
21  public class MultiContainerTestCase extends FunctionalTestCase
22  {
23      protected String getConfigResources()
24      {
25          return "org/mule/test/integration/config/multi-container-test.xml";
26      }
27  
28      public void testSanity()
29      {
30          fail("TODO MULE-1789");
31      }
32      
33      public void testContainer() throws Exception
34      {
35  //        Registry registry = muleContext.getRegistry();
36  //        assertNotNull(registry);
37  //        assertNotNull(registry.lookupObject("spring2-Apple"));
38  //        assertNotNull(registry.lookupObject("spring-Apple"));
39  //        assertNotNull(registry.lookupObject("spring2-Banana"));
40  //        assertNotNull(registry.lookupObject("spring-Banana"));
41  //
42  //        assertNull(registry.lookupObject("WaterMelon"));
43      }
44  
45  //    public void testSpecificContainerAddressing() throws Exception
46  //    {
47  //        Registry registry = muleContext.getRegistry();
48  //        assertNotNull(registry);
49  //        Orange o = (Orange)registry.lookupObject(new ContainerKeyPair("spring1", "Orange"));
50  //        assertNotNull(o);
51  //        assertEquals(new Integer(8), o.getSegments());
52  //
53  //        o = (Orange)registry.lookupObject(new ContainerKeyPair("spring2", "Orange"));
54  //        assertNotNull(o);
55  //        assertEquals(new Integer(10), o.getSegments());
56  //
57  //        // gets the service from the first container
58  //        o = (Orange)registry.lookupObject("Orange");
59  //        assertNotNull(o);
60  //        assertEquals(new Integer(8), o.getSegments());
61  //    }
62  //
63  //    public void testSpecificContainerAddressingForComponents() throws Exception
64  //    {
65  //        QuickConfigurationBuilder builder = new QuickConfigurationBuilder();
66  //        UMODescriptor d = builder.createDescriptor("Orange", "myOrange", "test://foo", null, null);
67  //        //d.setContainer("spring2");
68  //        builder.registerComponent(d);
69  //        Service c = builder.getMuleContext().getRegistry().lookupModel("main").getComponent("myOrange");
70  //        assertNotNull(c);
71  //        Object o = c.getInstance();
72  //        assertTrue(o instanceof Orange);
73  //        Orange orange = (Orange)o;
74  //        assertEquals(10, orange.getSegments().intValue());
75  //
76  //        d = builder.createDescriptor("Orange", "myOrange2", "test://bar", null, null);
77  //        //d.setContainer("spring1");
78  //        builder.registerComponent(d);
79  //        c = builder.getMuleContext().getRegistry().lookupModel("main").getComponent("myOrange2");
80  //        assertNotNull(c);
81  //        o = c.getInstance();
82  //        assertTrue(o instanceof Orange);
83  //        orange = (Orange)o;
84  //        assertEquals(8, orange.getSegments().intValue());
85  //
86  //    }
87  }