use of org.mule.runtime.module.deployment.api.TestDeploymentListener in project mule by mulesoft.
the class AbstractDeploymentTestCase method setUp.
@Before
public void setUp() throws Exception {
if (parallelDeployment) {
setProperty(PARALLEL_DEPLOYMENT_PROPERTY, "");
}
final String tmpDir = getProperty("java.io.tmpdir");
muleHome = new File(new File(tmpDir, "mule_home"), getClass().getSimpleName() + currentTimeMillis());
appsDir = new File(muleHome, "apps");
appsDir.mkdirs();
domainsDir = new File(muleHome, "domains");
domainsDir.mkdirs();
setProperty(MULE_HOME_DIRECTORY_PROPERTY, muleHome.getCanonicalPath());
GlobalConfigLoader.reset();
final File domainFolder = getDomainFolder(DEFAULT_DOMAIN_NAME);
assertThat(domainFolder.mkdirs(), is(true));
services = getServicesFolder();
services.mkdirs();
copyFileToDirectory(buildSchedulerServiceFile(compilerWorkFolder.newFolder("schedulerService")), services);
copyFileToDirectory(buildExpressionLanguageServiceFile(compilerWorkFolder.newFolder("expressionLanguageService")), services);
applicationDeploymentListener = mock(DeploymentListener.class);
testDeploymentListener = new TestDeploymentListener();
domainDeploymentListener = mock(DeploymentListener.class);
domainBundleDeploymentListener = mock(DeploymentListener.class);
moduleDiscoverer = new TestModuleDiscoverer(getPrivilegedArtifactIds());
moduleRepository = new DefaultModuleRepository(moduleDiscoverer);
MuleArtifactResourcesRegistry muleArtifactResourcesRegistry = new MuleArtifactResourcesRegistry.Builder().moduleRepository(moduleRepository).build();
serviceManager = muleArtifactResourcesRegistry.getServiceManager();
containerClassLoader = muleArtifactResourcesRegistry.getContainerClassLoader();
extensionModelLoaderManager = muleArtifactResourcesRegistry.getExtensionModelLoaderManager();
artifactClassLoaderManager = muleArtifactResourcesRegistry.getArtifactClassLoaderManager();
deploymentService = new TestMuleDeploymentService(muleArtifactResourcesRegistry.getDomainFactory(), muleArtifactResourcesRegistry.getApplicationFactory(), () -> findSchedulerService(serviceManager));
deploymentService.addDeploymentListener(applicationDeploymentListener);
deploymentService.addDomainDeploymentListener(domainDeploymentListener);
deploymentService.addDeploymentListener(testDeploymentListener);
deploymentService.addDomainDeploymentListener(testDeploymentListener);
deploymentService.addDomainBundleDeploymentListener(domainBundleDeploymentListener);
policyManager = new TestPolicyManager(deploymentService, new PolicyTemplateDescriptorFactory(muleArtifactResourcesRegistry.getArtifactPluginDescriptorLoader(), createDescriptorLoaderRepository(), ArtifactDescriptorValidatorBuilder.builder()));
// Reset test component state
invocationCount = 0;
policyParametrization = "";
}
Aggregations