use of org.jbpm.kie.services.impl.KModuleDeploymentUnit 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.kie.services.impl.KModuleDeploymentUnit 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.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentServiceEJBWithSyncIntegrationTest method testUndeploymentOfProcessesBySync.
@Test
public void testUndeploymentOfProcessesBySync() throws Exception {
CoundDownDeploymentListener countDownListener = configureListener(2);
DeploymentStore store = new DeploymentStore();
store.setCommandService(commandService);
Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(0, deployed.size());
KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(unit);
units.add(unit);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(1, deployed.size());
countDownListener.waitTillCompleted(1000);
store.disableDeploymentUnit(unit);
countDownListener.waitTillCompleted(10000);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(0, deployed.size());
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentServiceEJBWithSyncIntegrationTest method testDeploymentOfProcessesBySync.
@Test
public void testDeploymentOfProcessesBySync() throws Exception {
CoundDownDeploymentListener countDownListener = configureListener(1);
DeploymentStore store = new DeploymentStore();
store.setCommandService(commandService);
Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(0, deployed.size());
KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
store.enableDeploymentUnit(unit);
units.add(unit);
countDownListener.waitTillCompleted(10000);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(1, deployed.size());
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class ProcessServiceEJBIntegrationTest method testStartAndSignalProcessesWithExpression.
@Test
public void testStartAndSignalProcessesWithExpression() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier());
assertTrue(isDeployed);
assertNotNull(processService);
// first start first instance
long processInstanceId1 = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.signalWithExpression");
assertNotNull(processInstanceId1);
ProcessInstance pi = processService.getProcessInstance(processInstanceId1);
assertNotNull(pi);
// then start second instance
long processInstanceId2 = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.signalWithExpression");
assertNotNull(processInstanceId2);
ProcessInstance pi2 = processService.getProcessInstance(processInstanceId2);
assertNotNull(pi2);
List<Long> instances = new ArrayList<Long>();
instances.add(processInstanceId1);
instances.add(processInstanceId2);
// and lastly cancel both
processService.signalProcessInstances(instances, "MySignal", null);
pi = processService.getProcessInstance(processInstanceId1);
assertNull(pi);
pi2 = processService.getProcessInstance(processInstanceId2);
assertNull(pi2);
}
Aggregations