StandaloneArtifactDeployer implements ArtifactDeployer { protected void undeploy(File muleHome) throws DeploymentException { File appsDir = new File(muleHome + "/apps/"); for (File file : appsDir.listFiles()) { if (FilenameUtils.getBaseName(file.getName()).equals(deployment.getApplicationName())) { try { log.info("Deleting " + file); FileUtils.forceDelete(file); return; } catch (IOException e) { log.error("Could not delete " + file.getAbsolutePath()); throw new DeploymentException("Could not delete directory [" + file.getAbsolutePath() + "]", e); } } } throw new DeploymentException("Application " + deployment.getApplicationName() + " not found."); } StandaloneArtifactDeployer(Deployment deployment, MuleProcessController controller, DeployerLog log, Prober prober);  StandaloneArtifactDeployer(Deployment deployment, DeployerLog log); void waitForDeployments(); void verifyMuleIsStarted(); void addDomainFromstandaloneDeployment(StandaloneDeployment configuration); @Override String toString(); @Override void deployDomain(); @Override void undeployDomain(); @Override void deployApplication(); @Override void undeployApplication();  }
@Test public void undeployTest() throws DeploymentException, IOException { File appsFolder = new File(muleHome, "apps"); assertThat("Directory should have been created", appsFolder.mkdir(), is(true)); File deployedFile = new File(appsFolder, ARTIFACT_FILENAME); assertThat("File should have been created", deployedFile.createNewFile(), is(true)); deployer.undeploy(muleHome); assertThat("File should have been deleted", deployedFile.exists(), is(false)); assertThat("Folder shouldn't be deleted", appsFolder.exists(), is(true)); }
@Test(expected = DeploymentException.class) public void undeployNotFoundTest() throws DeploymentException, IOException { File appsFolder = new File(muleHome, "apps"); assertThat("Directory should have been created", appsFolder.mkdir(), is(true)); File deployedFile = new File(appsFolder, ARTIFACT_FILENAME); assertThat("File should have been deleted", deployedFile.exists(), is(false)); deployer.undeploy(muleHome); }