Exemplo n.º 1
0
  protected void initMule() {
    try {
      // endpointsCache.clear();
      // See if there has been a discriptor explicitly configured
      if (applicationContext.containsBean(EVENT_MULTICASTER_DESCRIPTOR_NAME)) {
        descriptor = (UMODescriptor) applicationContext.getBean(EVENT_MULTICASTER_DESCRIPTOR_NAME);
      }
      // If the mule manager has been initialised in the contain
      // there is not need to do anything here
      if (applicationContext.containsBean("muleManager")) {
        // Register the multicaster descriptor
        registerMulticasterDescriptor();
        return;
      }
      UMOManager manager = MuleManager.getInstance();
      Map map = applicationContext.getBeansOfType(MuleConfiguration.class);
      if (map != null && map.size() > 0) {
        MuleManager.setConfiguration((MuleConfiguration) map.values().iterator().next());
      }
      if (!manager.isStarted()) {
        MuleManager.getConfiguration().setSynchronous(!asynchronous);
        // register any endpointUri mappings
        registerEndpointMappings();
      }
      // tell mule to load component definitions from spring
      SpringContainerContext containerContext = new SpringContainerContext();
      containerContext.setBeanFactory(applicationContext);
      manager.setContainerContext(null);
      manager.setContainerContext(containerContext);

      // see if there are any UMOConnectors to register
      registerConnectors();

      // Next see if there are any UMOTransformers to register
      registerTransformers();

      registerGlobalEndpoints();

      // Register the multicaster descriptor
      registerMulticasterDescriptor();

      if (!manager.isStarted()) {
        manager.start();
      }
    } catch (UMOException e) {
      throw new MuleRuntimeException(SpringMessages.failedToReinitMule(), e);
    }
  }
Exemplo n.º 2
0
 /*
  * (non-Javadoc)
  *
  * @see junit.framework.TestCase#setUp()
  */
 protected void doSetUp() throws Exception {
   context = new SpringContainerContext();
   context.setConfigFile("test-application-context.xml");
 }