Esempio 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);
  }
Esempio n. 2
0
 /**
  * Finds deployed application by name.
  *
  * @return the application if found, null otherwise
  */
 public Application findApplication(String appName) {
   return deploymentService.findApplication(appName);
 }
Esempio n. 3
0
 public void removeDeploymentListener(DeploymentListener listener) {
   deploymentService.removeDeploymentListener(listener);
 }
Esempio n. 4
0
 public void addDeploymentListener(DeploymentListener listener) {
   deploymentService.addDeploymentListener(listener);
 }
Esempio n. 5
0
  public void start() throws IOException, MuleException {
    coreExtensionManager.initialise();
    coreExtensionManager.start();

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

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