use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.
the class FilteredKModuleDeploymentServiceTest method testSerializationClassesLimitedInDeploymentDependencies.
@Test
public void testSerializationClassesLimitedInDeploymentDependencies() {
String groupId = "org.test";
String childArtifactId = "jbpm-kie-services-filter-test-dep";
String parentArtifactId = "jbpm-kie-services-filter-test-parent";
String version = VERSION;
FluentKieModuleDeploymentHelper.newFluentInstance().setGroupId(groupId).setArtifactId(childArtifactId).setVersion(version).addClass(Building.class, House.class, Person.class, OtherPerson.class, Thing.class).createKieJarAndDeployToMaven();
FluentKieModuleDeploymentHelper.newFluentInstance().setGroupId(groupId).setArtifactId(parentArtifactId).setVersion(version).addDependencies(groupId + ":" + childArtifactId + ":" + version).createKieJarAndDeployToMaven();
configureServices();
KModuleDeploymentUnit childDeploymentUnit = new KModuleDeploymentUnit(groupId, childArtifactId, version);
DeploymentDescriptor depDesc = new DeploymentDescriptorImpl().getBuilder().setLimitSerializationClasses(// parent dictates behavior
false).get();
childDeploymentUnit.setDeploymentDescriptor(depDesc);
deploymentService.deploy(childDeploymentUnit);
KModuleDeploymentUnit parentDeploymentUnit = new KModuleDeploymentUnit(groupId, parentArtifactId, version);
DeploymentDescriptor parentDepDesc = new DeploymentDescriptorImpl().getBuilder().setLimitSerializationClasses(true).get();
parentDeploymentUnit.setDeploymentDescriptor(parentDepDesc);
deploymentService.deploy(parentDeploymentUnit);
verifyDeployedUnitContainsCorrectClasses(parentDeploymentUnit);
}
use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.
the class KModuleDeploymentServiceTest method testDeploymentOfProcessWithDescriptorWitSecurityManager.
@Test(expected = SecurityException.class)
public void testDeploymentOfProcessWithDescriptorWitSecurityManager() {
assertNotNull(deploymentService);
KieServices ks = KieServices.Factory.get();
ReleaseId releaseId = ks.newReleaseId(GROUP_ID, "kjar-with-dd", VERSION);
List<String> processes = new ArrayList<String>();
processes.add("repo/processes/general/customtask.bpmn");
processes.add("repo/processes/general/humanTask.bpmn");
processes.add("repo/processes/general/import.bpmn");
DeploymentDescriptor customDescriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
customDescriptor.getBuilder().runtimeStrategy(RuntimeStrategy.PER_PROCESS_INSTANCE).addWorkItemHandler(new NamedObjectModel("Log", "org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler")).addRequiredRole("experts");
Map<String, String> resources = new HashMap<String, String>();
resources.put("src/main/resources/" + DeploymentDescriptor.META_INF_LOCATION, customDescriptor.toXml());
InternalKieModule kJar1 = createKieJar(ks, releaseId, processes, resources);
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);
DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, "kjar-with-dd", VERSION, "KBase-test", "ksession-test2");
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
DeployedUnit deployedGeneral = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployedGeneral);
assertNotNull(deployedGeneral.getDeploymentUnit());
assertNotNull(deployedGeneral.getRuntimeManager());
DeploymentDescriptor descriptor = ((InternalRuntimeManager) deployedGeneral.getRuntimeManager()).getDeploymentDescriptor();
assertNotNull(descriptor);
assertEquals("org.jbpm.domain", descriptor.getPersistenceUnit());
assertEquals("org.jbpm.domain", descriptor.getAuditPersistenceUnit());
assertEquals(AuditMode.JPA, descriptor.getAuditMode());
assertEquals(PersistenceMode.JPA, descriptor.getPersistenceMode());
assertEquals(RuntimeStrategy.PER_PROCESS_INSTANCE, descriptor.getRuntimeStrategy());
assertEquals(0, descriptor.getMarshallingStrategies().size());
assertEquals(0, descriptor.getConfiguration().size());
assertEquals(0, descriptor.getEnvironmentEntries().size());
assertEquals(0, descriptor.getEventListeners().size());
assertEquals(0, descriptor.getGlobals().size());
assertEquals(0, descriptor.getTaskEventListeners().size());
assertEquals(1, descriptor.getWorkItemHandlers().size());
assertEquals(1, descriptor.getRequiredRoles().size());
RuntimeManager manager = deploymentService.getRuntimeManager(deploymentUnit.getIdentifier());
assertNotNull(manager);
manager.getRuntimeEngine(EmptyContext.get());
checkFormsDeployment(deploymentUnit.getIdentifier());
}
use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.
the class ProcessServiceImplTest method testStartAndAbortProcessInExternalTransactions.
protected void testStartAndAbortProcessInExternalTransactions(RuntimeStrategy strategy) throws Exception {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
DeploymentDescriptor customDescriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
customDescriptor.getBuilder().runtimeStrategy(strategy);
deploymentUnit.setDeploymentDescriptor(customDescriptor);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
assertNotNull(processService);
boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier());
assertTrue(isDeployed);
UserTransaction ut = InitialContext.doLookup("java:comp/UserTransaction");
ut.begin();
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
processService.signalEvent(deploymentUnit.getIdentifier(), "test", null);
ut.commit();
// now let's start another transaction
ut.begin();
processService.abortProcessInstance(processInstanceId);
ut.commit();
try {
processService.getProcessInstance(processInstanceId);
} catch (ProcessInstanceNotFoundException e) {
// expected
}
}
use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.
the class ProcessServiceImplTest method testStartAndGetProcessInExternalTransactions.
protected void testStartAndGetProcessInExternalTransactions(RuntimeStrategy strategy) throws Exception {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
DeploymentDescriptor customDescriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
customDescriptor.getBuilder().runtimeStrategy(strategy);
deploymentUnit.setDeploymentDescriptor(customDescriptor);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
assertNotNull(processService);
boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier());
assertTrue(isDeployed);
UserTransaction ut = InitialContext.doLookup("java:comp/UserTransaction");
ut.begin();
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(processInstanceId);
assertNotNull(pi);
processService.abortProcessInstance(processInstanceId);
ut.commit();
try {
processService.getProcessInstance(processInstanceId);
} catch (ProcessInstanceNotFoundException e) {
// expected
}
}
use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.
the class RuntimeDataServiceImplSecurityTest method deployKjar.
protected static void deployKjar() {
KieServices ks = KieServices.Factory.get();
ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION);
List<String> processes = new ArrayList<String>();
processes.add("processes/EmptyHumanTask.bpmn");
processes.add("processes/humanTask.bpmn");
processes.add("processes/SimpleHTProcess.bpmn2");
DeploymentDescriptor customDescriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
customDescriptor.getBuilder().addRequiredRole("view:managers");
Map<String, String> resources = new HashMap<String, String>();
resources.put("src/main/resources/" + DeploymentDescriptor.META_INF_LOCATION, customDescriptor.toXml());
InternalKieModule kJar1 = createKieJar(ks, releaseId, processes, resources);
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.installArtifact(releaseId, kJar1, pom);
}
Aggregations