use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.
the class FilteredKModuleDeploymentServiceTest method testDeploymentOfProcessesFromCustomerPackageDeafultKBase.
@Test
public void testDeploymentOfProcessesFromCustomerPackageDeafultKBase() {
prepare("customer.repo.processes.general");
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());
assertEquals(GROUP_ID + ":" + ARTIFACT_ID + ":" + VERSION, deployed.getDeploymentUnit().getIdentifier());
assertNotNull(runtimeDataService);
Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(2, processes.size());
processes = runtimeDataService.getProcessesByFilter("custom", new QueryContext());
assertNotNull(processes);
assertEquals(1, processes.size());
processes = runtimeDataService.getProcessesByDeploymentId(deploymentUnit.getIdentifier(), new QueryContext());
assertNotNull(processes);
assertEquals(2, processes.size());
ProcessDefinition process = runtimeDataService.getProcessesByDeploymentIdProcessId(deploymentUnit.getIdentifier(), "customtask");
assertNotNull(process);
}
use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.
the class KModuleDeploymentServiceTest method testDeploymentOfProcessesOnDefaultKbaseAndKsession.
@Test
public void testDeploymentOfProcessesOnDefaultKbaseAndKsession() {
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());
assertNull(deployed.getDeployedAssetLocation("customtask"));
assertEquals(GROUP_ID + ":" + ARTIFACT_ID + ":" + VERSION, deployed.getDeploymentUnit().getIdentifier());
assertNotNull(runtimeDataService);
Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(3, processes.size());
processes = runtimeDataService.getProcessesByFilter("custom", new QueryContext());
assertNotNull(processes);
assertEquals(1, processes.size());
processes = runtimeDataService.getProcessesByDeploymentId(deploymentUnit.getIdentifier(), new QueryContext());
assertNotNull(processes);
assertEquals(3, 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());
checkFormsDeployment(deploymentUnit.getIdentifier());
}
use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.
the class PostDeploymentServiceTest 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.ProcessDefinition in project jbpm by kiegroup.
the class RuntimeDataServiceImplTest method testGetProcessesSortByProcessVersion.
@Test
public void testGetProcessesSortByProcessVersion() {
Collection<ProcessDefinition> definitions = runtimeDataService.getProcesses(new QueryContext("ProcessVersion", true));
assertNotNull(definitions);
assertEquals(5, definitions.size());
List<String> expectedProcessIds = new ArrayList<String>();
expectedProcessIds.add("UserTask");
expectedProcessIds.add("org.jboss.qa.bpms.HumanTask");
expectedProcessIds.add("AdHocSubProcess");
expectedProcessIds.add("org.jbpm.writedocument.empty");
expectedProcessIds.add("org.jbpm.writedocument");
int index = 0;
for (ProcessDefinition def : definitions) {
assertEquals(def.getId(), expectedProcessIds.get(index));
index++;
}
}
use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.
the class BPMN2DataServiceImplMultiThreadTest method testBuildProcessDefinitionConcurrent.
@Test
public void testBuildProcessDefinitionConcurrent() throws Exception {
final List<ProcessDefinition> defs = new ArrayList<ProcessDefinition>();
byte[] process1 = IoUtils.readBytesFromInputStream(this.getClass().getResourceAsStream("/repo/processes/general/customtask.bpmn"));
byte[] process2 = IoUtils.readBytesFromInputStream(this.getClass().getResourceAsStream("/repo/processes/general/humanTask.bpmn"));
final String process1Content = new String(process1, "UTF-8");
final String process2Content = new String(process2, "UTF-8");
final CyclicBarrier threadsFinishedBarrier = new CyclicBarrier(3);
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
ProcessDefinition def = bpmn2Service.buildProcessDefinition("test", process1Content, null, true);
defs.add(def);
waitForTheOtherThreads(threadsFinishedBarrier);
}
});
Thread t2 = new Thread(new Runnable() {
@Override
public void run() {
ProcessDefinition def = bpmn2Service.buildProcessDefinition("test", process2Content, null, true);
defs.add(def);
waitForTheOtherThreads(threadsFinishedBarrier);
}
});
t1.start();
t2.start();
waitForTheOtherThreads(threadsFinishedBarrier);
assertEquals(2, defs.size());
}
Aggregations