use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class ProcessServiceImplTest 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(key);
assertNull(pi);
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentStoreTest method testEnableAndGetActiveDeploymentsWithTransientNamedObject.
@Test
public void testEnableAndGetActiveDeploymentsWithTransientNamedObject() {
Collection<DeploymentUnit> enabled = store.getEnabledDeploymentUnits();
assertNotNull(enabled);
assertEquals(0, enabled.size());
KModuleDeploymentUnit unit = new KModuleDeploymentUnit("org.jbpm", "test", "1.0");
DeploymentDescriptor descriptor = unit.getDeploymentDescriptor();
if (descriptor == null) {
descriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
}
// add transient named object model that should not be persisted
descriptor.getBuilder().addWorkItemHandler(new TransientNamedObjectModel("ejb", "async", "org.jbpm.executor.impl.wih.AsyncWorkItemHandler", new Object[] { "jndi:java:module/ExecutorServiceEJBImpl", "org.jbpm.executor.commands.PrintOutCommand" })).addEventListener(new TransientObjectModel("ejb", "not.existing.listener"));
unit.setDeploymentDescriptor(descriptor);
store.enableDeploymentUnit(unit);
enabled = store.getEnabledDeploymentUnits();
assertNotNull(enabled);
assertEquals(1, enabled.size());
DeploymentUnit unitEnabled = enabled.iterator().next();
assertTrue(unitEnabled instanceof KModuleDeploymentUnit);
DeploymentDescriptor descriptorEnabled = ((KModuleDeploymentUnit) unitEnabled).getDeploymentDescriptor();
assertNotNull(descriptorEnabled);
assertEquals(0, descriptorEnabled.getWorkItemHandlers().size());
assertEquals(0, descriptorEnabled.getEventListeners().size());
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentStoreTest method testEnableAndGetActiveDeployments.
@Test
public void testEnableAndGetActiveDeployments() {
Collection<DeploymentUnit> enabled = store.getEnabledDeploymentUnits();
assertNotNull(enabled);
assertEquals(0, enabled.size());
KModuleDeploymentUnit unit = new KModuleDeploymentUnit("org.jbpm", "test", "1.0");
store.enableDeploymentUnit(unit);
enabled = store.getEnabledDeploymentUnits();
assertNotNull(enabled);
assertEquals(1, enabled.size());
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class ProcessInstanceAdminServiceImplTest method prepare.
@Before
public void prepare() {
configureServices();
logger.debug("Preparing kjar");
KieServices ks = KieServices.Factory.get();
// version 1 of kjar
ReleaseId releaseId = ks.newReleaseId(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1);
List<String> processes = new ArrayList<String>();
processes.add("repo/processes/general/humanTask.bpmn");
processes.add("repo/processes/general/BPMN2-IntermediateCatchEventTimerDuration.bpmn2");
processes.add("repo/processes/errors/BPMN2-BrokenScriptTask.bpmn2");
processes.add("repo/processes/errors/BPMN2-UserTaskWithRollback.bpmn2");
InternalKieModule kJar1 = createKieJar(ks, releaseId, processes);
File pom = new File("target/admin", "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.installArtifact(releaseId, kJar1, pom);
processAdminService = new ProcessInstanceAdminServiceImpl();
((ProcessInstanceAdminServiceImpl) processAdminService).setProcessService(processService);
((ProcessInstanceAdminServiceImpl) processAdminService).setRuntimeDataService(runtimeDataService);
((ProcessInstanceAdminServiceImpl) processAdminService).setCommandService(new TransactionalCommandService(emf));
((ProcessInstanceAdminServiceImpl) processAdminService).setIdentityProvider(identityProvider);
// now let's deploy to runtime both kjars
deploymentUnit = new KModuleDeploymentUnit(ADMIN_GROUP_ID, ADMIN_ARTIFACT_ID, ADMIN_VERSION_V1);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class ProcessInstanceMigrationServiceImplTest method prepare.
@Before
public void prepare() {
configureServices();
logger.debug("Preparing kjar");
KieServices ks = KieServices.Factory.get();
// version 1 of kjar
ReleaseId releaseId = ks.newReleaseId(MIGRATION_GROUP_ID, MIGRATION_ARTIFACT_ID, MIGRATION_VERSION_V1);
List<String> processes = new ArrayList<String>();
processes.add("migration/v1/AddTaskAfterActive-v1.bpmn2");
processes.add("migration/v1/RemoveActiveTask-v1.bpmn2");
InternalKieModule kJar1 = createKieJar(ks, releaseId, processes);
File pom = new File("target/migration-v1", "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.installArtifact(releaseId, kJar1, pom);
// version 2 of kjar
ReleaseId releaseId2 = ks.newReleaseId(MIGRATION_GROUP_ID, MIGRATION_ARTIFACT_ID, MIGRATION_VERSION_V2);
processes = new ArrayList<String>();
processes.add("migration/v2/AddTaskAfterActive-v2.bpmn2");
processes.add("migration/v2/RemoveActiveTask-v2.bpmn2");
InternalKieModule kJar2 = createKieJar(ks, releaseId2, processes);
File pom2 = new File("target/migration-v2", "pom.xml");
pom2.getParentFile().mkdirs();
try {
FileOutputStream fs = new FileOutputStream(pom2);
fs.write(getPom(releaseId2).getBytes());
fs.close();
} catch (Exception e) {
}
repository = getKieMavenRepository();
repository.installArtifact(releaseId2, kJar2, pom2);
migrationService = new ProcessInstanceMigrationServiceImpl();
// now let's deploy to runtime both kjars
deploymentUnitV1 = new KModuleDeploymentUnit(MIGRATION_GROUP_ID, MIGRATION_ARTIFACT_ID, MIGRATION_VERSION_V1);
deploymentService.deploy(deploymentUnitV1);
units.add(deploymentUnitV1);
deploymentUnitV2 = new KModuleDeploymentUnit(MIGRATION_GROUP_ID, MIGRATION_ARTIFACT_ID, MIGRATION_VERSION_V2);
deploymentService.deploy(deploymentUnitV2);
units.add(deploymentUnitV2);
}
Aggregations