use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class ProcessServiceImplWithoutAuditTest method testStartAndAbortProcess.
@Test
public void testStartAndAbortProcess() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
assertNotNull(processService);
boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier());
assertTrue(isDeployed);
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(deploymentUnit.getIdentifier(), processInstanceId);
assertNotNull(pi);
processService.abortProcessInstance(deploymentUnit.getIdentifier(), processInstanceId);
pi = processService.getProcessInstance(deploymentUnit.getIdentifier(), processInstanceId);
assertNull(pi);
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class ProcessServiceImplWithoutAuditTest method testStartAndSignalProcesses.
@Test
public void testStartAndSignalProcesses() {
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.signal");
assertNotNull(processInstanceId1);
ProcessInstance pi = processService.getProcessInstance(deploymentUnit.getIdentifier(), processInstanceId1);
assertNotNull(pi);
// then start second instance
long processInstanceId2 = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.signal");
assertNotNull(processInstanceId2);
ProcessInstance pi2 = processService.getProcessInstance(deploymentUnit.getIdentifier(), processInstanceId2);
assertNotNull(pi2);
List<Long> instances = new ArrayList<Long>();
instances.add(processInstanceId1);
instances.add(processInstanceId2);
// and lastly cancel both
processService.signalProcessInstances(deploymentUnit.getIdentifier(), instances, "MySignal", null);
pi = processService.getProcessInstance(deploymentUnit.getIdentifier(), processInstanceId1);
assertNull(pi);
pi2 = processService.getProcessInstance(deploymentUnit.getIdentifier(), processInstanceId2);
assertNull(pi2);
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class ProcessServiceImplWithoutAuditTest method testStartProcessWithCorrelationKey.
@Test
public void testStartProcessWithCorrelationKey() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
assertNotNull(processService);
CorrelationKey key = KieInternalServices.Factory.get().newCorrelationKeyFactory().newCorrelationKey("my business key");
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "customtask", key);
assertNotNull(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(deploymentUnit.getIdentifier(), key);
assertNull(pi);
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class QueryServiceImplTest method prepareJPAModule.
protected void prepareJPAModule(KieServices ks, KieMavenRepository repository) {
// jpa module
ReleaseId releaseIdJPA = ks.newReleaseId("org.jbpm.test", "persistence-test", "1.0.0");
File kjarJPA = new File("src/test/resources/kjar-jpa/persistence-test.jar");
File pomJPA = new File("src/test/resources/kjar-jpa/pom.xml");
repository.installArtifact(releaseIdJPA, kjarJPA, pomJPA);
deploymentUnitJPA = new KModuleDeploymentUnit("org.jbpm.test", "persistence-test", "1.0.0");
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class RuntimeDataServiceImplTaskLookupTest method prepare.
@Before
public void prepare() {
System.setProperty("org.jbpm.ht.callback", "custom");
System.setProperty("org.jbpm.ht.custom.callback", "org.jbpm.kie.services.test.objects.TestUserGroupCallbackImpl");
configureServices();
logger.debug("Preparing kjar");
KieServices ks = KieServices.Factory.get();
ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION);
List<String> processes = new ArrayList<String>();
processes.add("repo/processes/general/BPMN2-UserTasksAssignedToGroup.bpmn2");
InternalKieModule kJar1 = createKieJar(ks, releaseId, processes);
File pom = new File("target/kmodule", "pom.xml");
pom.getParentFile().mkdir();
try {
FileOutputStream fs = new FileOutputStream(pom);
fs.write(getPom(releaseId).getBytes());
fs.close();
} catch (Exception e) {
}
KieMavenRepository repository = getKieMavenRepository();
repository.deployArtifact(releaseId, kJar1, pom);
assertNotNull(deploymentService);
deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
assertNotNull(processService);
}
Aggregations