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