Search in sources :

Example 21 with InternalKieModule

use of org.drools.compiler.kie.builder.impl.InternalKieModule 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 22 with InternalKieModule

use of org.drools.compiler.kie.builder.impl.InternalKieModule in project jbpm by kiegroup.

the class ProcessServiceImplWithDeploymentIdTest 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/customtask.bpmn");
    processes.add("repo/processes/general/humanTask.bpmn");
    processes.add("repo/processes/general/import.bpmn");
    processes.add("repo/processes/general/signal.bpmn");
    processes.add("repo/processes/general/signalWithExpression.bpmn2");
    processes.add("repo/processes/general/callactivity.bpmn");
    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);
}
Also used : FileOutputStream(java.io.FileOutputStream) ArrayList(java.util.ArrayList) KieMavenRepository.getKieMavenRepository(org.kie.scanner.KieMavenRepository.getKieMavenRepository) KieMavenRepository(org.kie.scanner.KieMavenRepository) KieServices(org.kie.api.KieServices) ReleaseId(org.kie.api.builder.ReleaseId) File(java.io.File) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Example 23 with InternalKieModule

use of org.drools.compiler.kie.builder.impl.InternalKieModule 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)

Example 24 with InternalKieModule

use of org.drools.compiler.kie.builder.impl.InternalKieModule in project jbpm by kiegroup.

the class ProcessServiceWithServiceRegistryTest 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/customtask.bpmn");
    processes.add("repo/processes/general/humanTask.bpmn");
    processes.add("repo/processes/general/import.bpmn");
    processes.add("repo/processes/general/signal.bpmn");
    processes.add("repo/processes/ServiceRegistryScriptTask.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);
    deploymentService.deploy(deploymentUnit);
}
Also used : FileOutputStream(java.io.FileOutputStream) ArrayList(java.util.ArrayList) KieMavenRepository.getKieMavenRepository(org.kie.scanner.KieMavenRepository.getKieMavenRepository) KieMavenRepository(org.kie.scanner.KieMavenRepository) KieServices(org.kie.api.KieServices) ReleaseId(org.kie.api.builder.ReleaseId) File(java.io.File) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Example 25 with InternalKieModule

use of org.drools.compiler.kie.builder.impl.InternalKieModule in project jbpm by kiegroup.

the class QueryServiceImplTest 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) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) QueryNotFoundException(org.jbpm.services.api.query.QueryNotFoundException) 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

InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)201 ReleaseId (org.kie.api.builder.ReleaseId)125 KieServices (org.kie.api.KieServices)120 Test (org.junit.Test)86 KieMavenRepository.getKieMavenRepository (org.kie.scanner.KieMavenRepository.getKieMavenRepository)72 File (java.io.File)62 ArrayList (java.util.ArrayList)57 KieContainer (org.kie.api.runtime.KieContainer)57 KieBuilder (org.kie.api.builder.KieBuilder)55 KieFileSystem (org.kie.api.builder.KieFileSystem)54 FileOutputStream (java.io.FileOutputStream)53 KieMavenRepository (org.kie.scanner.KieMavenRepository)51 KieSession (org.kie.api.runtime.KieSession)43 HashMap (java.util.HashMap)28 Before (org.junit.Before)28 KieModule (org.kie.api.builder.KieModule)24 DeploymentDescriptor (org.kie.internal.runtime.conf.DeploymentDescriptor)23 KieScanner (org.kie.api.builder.KieScanner)20 InternalKieScanner (org.drools.compiler.kie.builder.impl.InternalKieScanner)18 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)17