Ejemplo n.º 1
0
  public FakeMuleServer(String muleHomePath, List<MuleCoreExtension> intialCoreExtensions) {
    this.coreExtensions = intialCoreExtensions;

    muleHome = new File(muleHomePath);
    muleHome.deleteOnExit();
    try {
      System.setProperty(
          MuleProperties.MULE_HOME_DIRECTORY_PROPERTY, getMuleHome().getCanonicalPath());
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    try {
      setMuleFolders();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }

    deploymentService = new MuleDeploymentService(new MulePluginClassLoaderManager());
    deploymentListener = mock(DeploymentListener.class);
    deploymentService.addDeploymentListener(deploymentListener);

    coreExtensionManager =
        new DefaultMuleCoreExtensionManager(
            new MuleCoreExtensionDiscoverer() {
              @Override
              public List<MuleCoreExtension> discover() throws DefaultMuleException {
                return coreExtensions;
              }
            },
            new ReflectionMuleCoreExtensionDependencyResolver());
    coreExtensionManager.setDeploymentService(deploymentService);
  }
Ejemplo n.º 2
0
 /**
  * Finds deployed application by name.
  *
  * @return the application if found, null otherwise
  */
 public Application findApplication(String appName) {
   return deploymentService.findApplication(appName);
 }
Ejemplo n.º 3
0
 public void removeDeploymentListener(DeploymentListener listener) {
   deploymentService.removeDeploymentListener(listener);
 }
Ejemplo n.º 4
0
 public void addDeploymentListener(DeploymentListener listener) {
   deploymentService.addDeploymentListener(listener);
 }
Ejemplo n.º 5
0
  public void start() throws IOException, MuleException {
    coreExtensionManager.initialise();
    coreExtensionManager.start();

    deploymentService.start();
  }
Ejemplo n.º 6
0
  public void stop() throws MuleException {
    deploymentService.stop();

    coreExtensionManager.stop();
    coreExtensionManager.dispose();
  }