Beispiel #1
0
  public void testSpecificContainerAddressing() throws Exception {
    UMOContainerContext context = MuleManager.getInstance().getContainerContext();
    assertNotNull(context);
    Orange o = (Orange) context.getComponent(new ContainerKeyPair("spring1", "Orange"));
    assertNotNull(o);
    assertEquals(new Integer(8), o.getSegments());

    o = (Orange) context.getComponent(new ContainerKeyPair("spring2", "Orange"));
    assertNotNull(o);
    assertEquals(new Integer(10), o.getSegments());

    // gets the component from the first container
    o = (Orange) context.getComponent("Orange");
    assertNotNull(o);
    assertEquals(new Integer(8), o.getSegments());
  }
Beispiel #2
0
  public void testSpecificContainerAddressingForComponents() throws Exception {
    QuickConfigurationBuilder builder = new QuickConfigurationBuilder();
    UMODescriptor d = builder.createDescriptor("Orange", "myOrange", "test://foo", null, null);
    d.setContainer("spring2");
    builder.registerComponent(d);
    UMOComponent c = builder.getManager().getModel().getComponent("myOrange");
    assertNotNull(c);
    Object o = c.getInstance();
    assertTrue(o instanceof Orange);
    Orange orange = (Orange) o;
    assertEquals(10, orange.getSegments().intValue());

    d = builder.createDescriptor("Orange", "myOrange2", "test://bar", null, null);
    d.setContainer("spring1");
    builder.registerComponent(d);
    c = builder.getManager().getModel().getComponent("myOrange2");
    assertNotNull(c);
    o = c.getInstance();
    assertTrue(o instanceof Orange);
    orange = (Orange) o;
    assertEquals(8, orange.getSegments().intValue());
  }