use of org.jbpm.services.api.model.DeployedUnit in project jbpm by kiegroup.
the class DeploymentServiceEJBIntegrationTest method testDeploymentOfProcesses.
@Test
public void testDeploymentOfProcesses() {
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());
assertNotNull(runtimeDataService);
Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(5, processes.size());
processes = runtimeDataService.getProcessesByFilter("custom", new QueryContext());
assertNotNull(processes);
assertEquals(1, processes.size());
processes = runtimeDataService.getProcessesByDeploymentId(deploymentUnit.getIdentifier(), new QueryContext());
assertNotNull(processes);
assertEquals(5, processes.size());
ProcessDefinition process = runtimeDataService.getProcessesByDeploymentIdProcessId(deploymentUnit.getIdentifier(), "customtask");
assertNotNull(process);
RuntimeManager manager = deploymentService.getRuntimeManager(deploymentUnit.getIdentifier());
assertNotNull(manager);
RuntimeEngine engine = manager.getRuntimeEngine(EmptyContext.get());
assertNotNull(engine);
Map<String, Object> params = new HashMap<String, Object>();
params.put("id", "test");
ProcessInstance processInstance = engine.getKieSession().startProcess("customtask", params);
assertEquals(ProcessInstance.STATE_COMPLETED, processInstance.getState());
}
use of org.jbpm.services.api.model.DeployedUnit 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.DeployedUnit 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.DeployedUnit 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.services.api.model.DeployedUnit 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());
}
Aggregations