use of org.jbpm.services.api.DeploymentEventListener in project jbpm by kiegroup.
the class PostDeploymentServiceTest method testDuplicatedDeployment.
@Test
public void testDuplicatedDeployment() {
assertNotNull(deploymentService);
((KModuleDeploymentService) deploymentService).addListener(new DeploymentEventListener() {
@Override
public void onUnDeploy(DeploymentEvent event) {
}
@Override
public void onDeploy(DeploymentEvent event) {
throw new IllegalArgumentException("On purpose");
}
@Override
public void onActivate(DeploymentEvent event) {
}
@Override
public void onDeactivate(DeploymentEvent event) {
}
});
DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION, "KBase-test", "ksession-test");
try {
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
fail("Deployment should fail due to post process failuer - see ThrowExceptionOnDeploymentEvent");
} catch (RuntimeException e) {
}
DeployedUnit deployedGeneral = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNull(deployedGeneral);
assertFalse(RuntimeManagerRegistry.get().isRegistered(deploymentUnit.getIdentifier()));
}
Aggregations