Ejemplo n.º 1
0
  public void testPropertyMapsListsEtc() {

    UMODescriptor d = MuleManager.getInstance().getModel().getDescriptor("test3");
    assertNotNull(d);
    Map props = (Map) d.getProperties().get("testMap");
    assertNotNull(props);
    assertEquals("foo entry", props.get("foo"));

    List list = (List) d.getProperties().get("testList");
    assertNotNull(list);
    assertEquals("bar entry", list.get(0).toString());

    assertEquals("${this should not be found}", d.getProperties().get("blah"));
    assertEquals("two tags foo entry and bar entry.", d.getProperties().get("foobar"));
  }
Ejemplo n.º 2
0
  /**
   * Creates a component based on its descriptor.
   *
   * @param descriptor the descriptor to create the component from
   * @return The newly created component
   * @throws UMOException
   */
  public static Object createService(UMODescriptor descriptor) throws UMOException {
    Object component;
    try {
      component = descriptor.getServiceFactory().create();

      // TODO MULE-1933 Would be nice to remove this eventually.
      BeanUtils.populate(component, descriptor.getProperties());
    } catch (Exception e) {
      throw new LifecycleException(
          MessageFactory.createStaticMessage("Unable to create component"), e, descriptor);
    }

    // Call any custom initialisers
    if (descriptor instanceof MuleDescriptor) {
      ((MuleDescriptor) descriptor).fireInitialisationCallbacks(component);
    }

    return component;
  }