Search in sources :

Example 1 with DeploymentDescriptorImpl

use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.

the class AbstractCaseServicesBaseTest method prepareDeploymentUnit.

protected DeploymentUnit prepareDeploymentUnit() {
    assertThat(deploymentService).isNotNull();
    KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    final DeploymentDescriptor descriptor = new DeploymentDescriptorImpl();
    descriptor.getBuilder().addEventListener(new NamedObjectModel("mvel", "processIdentity", "new org.jbpm.kie.services.impl.IdentityProviderAwareProcessListener(ksession)"));
    deploymentUnit.setDeploymentDescriptor(descriptor);
    deploymentUnit.setStrategy(RuntimeStrategy.PER_CASE);
    deploymentService.deploy(deploymentUnit);
    return deploymentUnit;
}
Also used : NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) DeploymentDescriptorImpl(org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit)

Example 2 with DeploymentDescriptorImpl

use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.

the class AbstractCaseServicesBaseTest method createDeploymentDescriptor.

protected DeploymentDescriptor createDeploymentDescriptor() {
    // add this listener by default
    listenerMvelDefinitions.add("new org.jbpm.casemgmt.impl.util.TrackingCaseEventListener()");
    DeploymentDescriptor customDescriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
    DeploymentDescriptorBuilder ddBuilder = customDescriptor.getBuilder().runtimeStrategy(RuntimeStrategy.PER_CASE).addMarshalingStrategy(new ObjectModel("mvel", CaseMarshallerFactory.builder().withDoc().toString())).addWorkItemHandler(new NamedObjectModel("mvel", "StartCaseInstance", "new org.jbpm.casemgmt.impl.wih.StartCaseWorkItemHandler(ksession)"));
    listenerMvelDefinitions.forEach(listenerDefinition -> ddBuilder.addEventListener(new ObjectModel("mvel", listenerDefinition)));
    getProcessListeners().forEach(listener -> ddBuilder.addEventListener(listener));
    getWorkItemHandlers().forEach(listener -> ddBuilder.addWorkItemHandler(listener));
    return customDescriptor;
}
Also used : NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) ObjectModel(org.kie.internal.runtime.conf.ObjectModel) NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) DeploymentDescriptorImpl(org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl) DeploymentDescriptorBuilder(org.kie.internal.runtime.conf.DeploymentDescriptorBuilder)

Example 3 with DeploymentDescriptorImpl

use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.

the class TaskVariablesQueryServiceTest method prepare.

@Before
public void prepare() {
    configureServices();
    KieServices ks = KieServices.Factory.get();
    ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION);
    File kjar = new File("src/test/resources/kjar-task-vars/task-vars-1.0.jar");
    File pom = new File("src/test/resources/kjar-task-vars/pom.xml");
    KieMavenRepository repository = getKieMavenRepository();
    repository.installArtifact(releaseId, kjar, pom);
    ReleaseId releaseIdSales = ks.newReleaseId("org.jbpm.test", "product-sale", "1.0");
    File kjarSales = new File("src/test/resources/kjar-sales/product-sale-1.0.jar");
    File pomSales = new File("src/test/resources/kjar-sales/pom.xml");
    repository.installArtifact(releaseIdSales, kjarSales, pomSales);
    assertNotNull(deploymentService);
    KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    KModuleDeploymentUnit deploymentUnitSales = new KModuleDeploymentUnit(SALES_GROUP_ID, SALES_ARTIFACT_ID, SALES_VERSION);
    DeploymentDescriptor customDescriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
    customDescriptor.getBuilder().addMarshalingStrategy(new ObjectModel("mvel", "new org.drools.persistence.jpa.marshaller.JPAPlaceholderResolverStrategy(\"org.jbpm.test:product-sale:1.0\", classLoader)"));
    // disable below line to avoid jpa marshaling of ProductSale variable
    deploymentUnitSales.setDeploymentDescriptor(customDescriptor);
    deploymentService.deploy(deploymentUnitSales);
    deploymentUnitSalesId = deploymentUnitSales.getIdentifier();
    DeployedUnit deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
    assertNotNull(deployed);
    assertNotNull(deployed.getDeploymentUnit());
    assertNotNull(runtimeDataService);
    Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
    assertNotNull(processes);
    assertEquals(2, processes.size());
    deploymentUnitId = deploymentUnit.getIdentifier();
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) KieMavenRepository.getKieMavenRepository(org.kie.scanner.KieMavenRepository.getKieMavenRepository) KieMavenRepository(org.kie.scanner.KieMavenRepository) DeployedUnit(org.jbpm.services.api.model.DeployedUnit) DeploymentDescriptorImpl(org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl) KieServices(org.kie.api.KieServices) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) ReleaseId(org.kie.api.builder.ReleaseId) QueryContext(org.kie.api.runtime.query.QueryContext) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) File(java.io.File) Before(org.junit.Before)

Example 4 with DeploymentDescriptorImpl

use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.

the class UserTaskInstanceWithPotOwnerTest 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");
    this.dataSourceJNDIname = getDataSourceJNDI();
    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/EmptyHumanTask.bpmn");
    processes.add("repo/processes/general/humanTask.bpmn");
    processes.add("repo/processes/general/BPMN2-UserTask.bpmn2");
    processes.add("repo/processes/general/SimpleHTProcess.bpmn2");
    processes.add("repo/processes/general/AdHocSubProcess.bpmn2");
    processes.add("repo/processes/general/ExcludedOwner.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.deployArtifact(releaseId, kJar1, pom);
    assertNotNull(deploymentService);
    deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    prepareJPAModule(ks, repository);
    assertNotNull(processService);
}
Also used : HashMap(java.util.HashMap) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) ArrayList(java.util.ArrayList) DeploymentDescriptorImpl(org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl) KieServices(org.kie.api.KieServices) ReleaseId(org.kie.api.builder.ReleaseId) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) FileOutputStream(java.io.FileOutputStream) KieMavenRepository.getKieMavenRepository(org.kie.scanner.KieMavenRepository.getKieMavenRepository) KieMavenRepository(org.kie.scanner.KieMavenRepository) File(java.io.File) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Example 5 with DeploymentDescriptorImpl

use of org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl in project jbpm by kiegroup.

the class ProcessServiceWithEntitiesTest method prepare.

@Before
public void prepare() {
    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/entityprocessvar-process.bpmn2");
    DeploymentDescriptorImpl customDescriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
    List<String> remotableClasses = java.util.Arrays.asList("example.CaseDetail", "org.drools.persistence.jpa.marshaller.MappedVariable");
    customDescriptor.setClasses(remotableClasses);
    List<ObjectModel> marshallingStrategies = new ArrayList<ObjectModel>();
    marshallingStrategies.add(new ObjectModel("mvel", "new org.drools.persistence.jpa.marshaller.JPAPlaceholderResolverStrategy(\"org.jbpm.test:test-module:1.0.0-SNAPSHOT\", classLoader)"));
    customDescriptor.setMarshallingStrategies(marshallingStrategies);
    Map<String, String> extraResources = new HashMap<>();
    extraResources.put(CASEDETAIL_JAVA, getCaseDetailEntitySource());
    extraResources.put("src/main/resources/" + DeploymentDescriptor.META_INF_LOCATION, customDescriptor.toXml());
    extraResources.put("src/main/resources/META-INF/persistence.xml", getPersistenceXml());
    InternalKieModule kJar1 = createKieJar(ks, releaseId, processes, extraResources);
    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);
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DeploymentDescriptorImpl(org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl) KieServices(org.kie.api.KieServices) ReleaseId(org.kie.api.builder.ReleaseId) LazyInitializationException(org.hibernate.LazyInitializationException) FileOutputStream(java.io.FileOutputStream) KieMavenRepository.getKieMavenRepository(org.kie.scanner.KieMavenRepository.getKieMavenRepository) KieMavenRepository(org.kie.scanner.KieMavenRepository) File(java.io.File) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Aggregations

DeploymentDescriptorImpl (org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl)27 DeploymentDescriptor (org.kie.internal.runtime.conf.DeploymentDescriptor)26 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)19 KieServices (org.kie.api.KieServices)15 ReleaseId (org.kie.api.builder.ReleaseId)15 File (java.io.File)14 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)14 HashMap (java.util.HashMap)13 FileOutputStream (java.io.FileOutputStream)12 KieMavenRepository (org.kie.scanner.KieMavenRepository)12 KieMavenRepository.getKieMavenRepository (org.kie.scanner.KieMavenRepository.getKieMavenRepository)12 ArrayList (java.util.ArrayList)11 Test (org.junit.Test)11 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)9 Before (org.junit.Before)8 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)7 NamedObjectModel (org.kie.internal.runtime.conf.NamedObjectModel)7 ObjectModel (org.kie.internal.runtime.conf.ObjectModel)7 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)6 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)5