コード例 #1
0
  public void testPropertyWithoutOverrides() {

    UMODescriptor d = MuleManager.getInstance().getModel().getDescriptor("test2");
    assertNotNull(d);
    UMOEndpoint endpoint = d.getInboundRouter().getEndpoint("ep1");
    assertNotNull(endpoint);
    assertNotNull(endpoint.getProperties());
    assertEquals(3, endpoint.getProperties().size());
    assertEquals("value1", endpoint.getProperties().get("prop1"));
    assertEquals("overrideValue2", endpoint.getProperties().get("prop2"));
    assertEquals("value3", endpoint.getProperties().get("prop3"));
  }
コード例 #2
0
  public void testPropertyWithOverrides() {

    UMODescriptor d = MuleManager.getInstance().getModel().getDescriptor("test3");
    assertNotNull(d);
    UMOEndpoint endpoint = d.getInboundRouter().getEndpoint("ep2");
    assertNotNull(endpoint);
    assertEquals("test://embedded", endpoint.getEndpointURI().getUri().toString());
    assertNotNull(endpoint.getProperties());
    assertEquals(3, endpoint.getProperties().size());
    assertEquals("value1", endpoint.getProperties().get("prop1"));
    assertEquals("value2", endpoint.getProperties().get("prop2"));
    assertEquals("value3", endpoint.getProperties().get("prop3"));
  }
コード例 #3
0
  protected UMODescriptor getDefaultDescriptor() throws UMOException {
    // When the the beanFactory is refreshed all the beans get
    // reloaded so we need to unregister the component from Mule
    UMOModel model = MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL);
    if (model == null) {
      model = new SedaModel();
      model.setName(ModelHelper.SYSTEM_MODEL);
      MuleManager.getInstance().registerModel(model);
    }
    UMODescriptor descriptor = model.getDescriptor(EVENT_MULTICASTER_DESCRIPTOR_NAME);
    if (descriptor != null) {
      model.unregisterComponent(descriptor);
    }
    descriptor = new MuleDescriptor(EVENT_MULTICASTER_DESCRIPTOR_NAME);
    if (subscriptions == null) {
      logger.info("No receive endpoints have been set, using default '*'");
      descriptor.setInboundEndpoint(new MuleEndpoint("vm://*", true));
    } else {
      // Set multiple inbound subscriptions on the descriptor
      UMOInboundRouterCollection messageRouter = descriptor.getInboundRouter();

      for (int i = 0; i < subscriptions.length; i++) {
        String subscription = subscriptions[i];
        UMOEndpointURI endpointUri = new MuleEndpointURI(subscription);
        UMOEndpoint endpoint =
            MuleEndpoint.getOrCreateEndpointForUri(endpointUri, UMOEndpoint.ENDPOINT_TYPE_RECEIVER);
        if (!asynchronous) {
          endpoint.setSynchronous(true);
        }
        messageRouter.addEndpoint(endpoint);
      }
    }
    // set the implementation name to this bean so Mule will manage it
    descriptor.setImplementation(
        AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME);
    return descriptor;
  }