use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.
the class DeploymentServiceEJBIntegrationTest method testDuplicatedDeployment.
@Test
public void testDuplicatedDeployment() {
assertNotNull(deploymentService);
DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
DeployedUnit deployedGeneral = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployedGeneral);
assertNotNull(deployedGeneral.getDeploymentUnit());
assertNotNull(deployedGeneral.getRuntimeManager());
try {
// duplicated deployment of the same deployment unit should fail
deploymentService.deploy(deploymentUnit);
} catch (Exception e) {
assertTrue(e.getMessage().endsWith("Unit with id org.jbpm.test:test-module:1.0.0-SNAPSHOT is already deployed"));
}
}
use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.
the class DeploymentServiceEJBIntegrationTest method testDeploymentOfProcessesWithActivation.
@Test
public void testDeploymentOfProcessesWithActivation() {
assertNotNull(deploymentService);
DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
DeployedUnit deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployed);
assertNotNull(deployed.getDeploymentUnit());
assertNotNull(deployed.getRuntimeManager());
assertTrue(deployed.isActive());
assertEquals(0, ((DeployedUnitImpl) deployed).getDeployedClasses().size());
assertNotNull(runtimeDataService);
Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(5, processes.size());
RuntimeManager manager = deploymentService.getRuntimeManager(deploymentUnit.getIdentifier());
assertNotNull(manager);
// then deactivate it
deploymentService.deactivate(deploymentUnit.getIdentifier());
deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployed);
assertNotNull(deployed.getDeploymentUnit());
assertNotNull(deployed.getRuntimeManager());
assertFalse(deployed.isActive());
processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(0, processes.size());
// and not activate it again
deploymentService.activate(deploymentUnit.getIdentifier());
deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployed);
assertNotNull(deployed.getDeploymentUnit());
assertNotNull(deployed.getRuntimeManager());
assertTrue(deployed.isActive());
processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(5, processes.size());
}
use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.
the class ClientProcessServiceWithCustomDataEJBTest method cleanup.
@After
public void cleanup() {
if (processInstanceId != null) {
// let's abort process instance to leave the system in clear state
processService.abortProcessInstance(processInstanceId);
}
Thread.currentThread().setContextClassLoader(originClassLoader);
cleanupSingletonSessionId();
if (units != null && !units.isEmpty()) {
for (DeploymentUnit unit : units) {
deploymentService.undeploy(unit);
}
units.clear();
}
close();
}
use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.
the class AbstractEJBServicesTest method cleanup.
@After
public void cleanup() {
cleanupSingletonSessionId();
List<DeploymentUnit> units = archive.getUnits();
if (units != null && !units.isEmpty()) {
for (DeploymentUnit unit : units) {
deploymentService.undeploy(unit);
}
units.clear();
}
}
use of org.jbpm.services.api.model.DeploymentUnit in project jbpm by kiegroup.
the class AbstractRuntimeEJBServicesTest method cleanup.
@After
@Override
public void cleanup() {
List<Long> pids = archive.getPids();
List<Long> all = (List<Long>) ((ArrayList<Long>) pids).clone();
for (Long pid : all) {
ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(pid);
if (pi == null || pi.getState() != ProcessInstance.STATE_ACTIVE) {
pids.remove(pid);
}
}
if (!pids.isEmpty()) {
processService.abortProcessInstances(pids);
}
pids.clear();
cleanupSingletonSessionId();
List<DeploymentUnit> units = archive.getUnits();
if (units != null && !units.isEmpty()) {
for (DeploymentUnit unit : units) {
// clear audit logs
RuntimeManager manager = deploymentService.getRuntimeManager(unit.getIdentifier());
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get());
engine.getAuditService().clear();
deploymentService.undeploy(unit);
}
units.clear();
}
kieJar = null;
}
Aggregations