Exemplo n.º 1
0
  public void testWriteReadPayload() throws Exception {
    // Create orange to send over the wire
    Properties messageProerties = new Properties();
    messageProerties.put("key1", "val1");
    Orange inOrange = new Orange();
    inOrange.setBrand("Walmart");
    inOrange.setMapProperties(messageProerties);

    Object outObject = readWrite(inOrange);

    // Test deserialized Fruit
    assertTrue(outObject instanceof Orange);
    assertEquals("Walmart", ((Orange) outObject).getBrand());
    assertEquals("val1", ((Orange) outObject).getMapProperties().get("key1"));
  }
Exemplo n.º 2
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());
  }
Exemplo n.º 3
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());
  }