Search in sources :

Example 46 with KieMavenRepository

use of org.kie.scanner.KieMavenRepository in project jbpm by kiegroup.

the class BPMN2DataServicesReferencesTest method prepare.

@Before
public void prepare() {
    configureServices();
    KieServices ks = KieServices.Factory.get();
    ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION);
    List<String> resources = new ArrayList<String>();
    // extension
    if (loadGlobalImportProcesses) {
        resources.add("repo/processes/references/importWithScriptTask.bpmn2");
        resources.add("repo/processes/references/globalBasedOnEntryExitScriptProcess.bpmn2");
    }
    // call activity (referenced sub processes)
    if (loadCallActivityProcesses) {
        resources.add("repo/processes/references/callActivityByNameParent.bpmn2");
        resources.add("repo/processes/references/callActivityParent.bpmn2");
        resources.add("repo/processes/references/callActivitySubProcess.bpmn2");
    }
    // item def, business rules
    if (loadBusinesRuleProcesses) {
        resources.add("repo/processes/references/businessRuleTask.bpmn2");
        resources.add("repo/processes/references/businessRuleTask.drl");
    }
    // qualified class in script
    if (loadJavaMvelScriptProcesses) {
        resources.add("repo/processes/references/javaScriptTaskWithQualifiedClass.bpmn2");
        resources.add("repo/processes/references/javaScriptTaskWithQualifiedClassItemDefinition.bpmn2");
        resources.add("repo/processes/references/mvelScriptTaskWithQualifiedClass.bpmn2");
        resources.add("repo/processes/references/rulesScriptTaskWithQualifiedClass.bpmn2");
    }
    // qualified class in script
    if (loadSignalGlobalInfoProcess) {
        resources.add("repo/processes/general/signal.bpmn");
    }
    InternalKieModule kJar1 = createKieJar(ks, releaseId, resources);
    File pom = new File("target/kmodule", "pom.xml");
    pom.getParentFile().mkdir();
    FileOutputStream fs = null;
    try {
        fs = new FileOutputStream(pom);
        fs.write(getPom(releaseId).getBytes());
    } catch (Exception e) {
        fail("Unable to write pom.xml to filesystem: " + e.getMessage());
    }
    try {
        fs.close();
    } catch (Exception e) {
        logger.info("Unable to close fileystem used to write pom.xml");
    }
    KieMavenRepository repository = getKieMavenRepository();
    repository.deployArtifact(releaseId, kJar1, pom);
    // check
    assertNotNull(deploymentService);
    deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    deploymentId = deploymentUnit.getIdentifier();
    procInstIds.clear();
}
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) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) File(java.io.File) IOException(java.io.IOException) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Example 47 with KieMavenRepository

use of org.kie.scanner.KieMavenRepository in project jbpm by kiegroup.

the class BPMN2DataServicesTest method prepare.

@Before
public void prepare() {
    configureServices();
    KieServices ks = KieServices.Factory.get();
    ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION);
    List<String> processes = new ArrayList<String>();
    processes.add("repo/processes/hr/hiring.bpmn2");
    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/callactivity.bpmn");
    processes.add("repo/processes/general/BPMN2-UserTask.bpmn2");
    processes.add("repo/processes/itemrefissue/itemrefissue.bpmn");
    processes.add("repo/processes/general/ObjectVariableProcess.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);
}
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) ProcessDefinitionNotFoundException(org.jbpm.services.api.ProcessDefinitionNotFoundException) IOException(java.io.IOException) DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Example 48 with KieMavenRepository

use of org.kie.scanner.KieMavenRepository in project jbpm by kiegroup.

the class ClassloaderKModuleDeploymentServiceTest 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/jbpm-module.jar");
    File pom = new File("src/test/resources/kjar/pom.xml");
    KieMavenRepository repository = getKieMavenRepository();
    repository.installArtifact(releaseId, kjar, pom);
}
Also used : 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) Before(org.junit.Before)

Example 49 with KieMavenRepository

use of org.kie.scanner.KieMavenRepository in project jbpm by kiegroup.

the class DeploymentServiceTest method prepare.

@Before
public void prepare() {
    configureServices();
    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/signal.bpmn");
    processes.add("repo/processes/general/import.bpmn");
    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);
    ReleaseId releaseIdSupport = ks.newReleaseId(GROUP_ID, "support", VERSION);
    List<String> processesSupport = new ArrayList<String>();
    processesSupport.add("repo/processes/support/support.bpmn");
    InternalKieModule kJar2 = createKieJar(ks, releaseIdSupport, processesSupport);
    File pom2 = new File("target/kmodule2", "pom.xml");
    pom2.getParentFile().mkdir();
    try {
        FileOutputStream fs = new FileOutputStream(pom2);
        fs.write(getPom(releaseIdSupport).getBytes());
        fs.close();
    } catch (Exception e) {
    }
    repository.deployArtifact(releaseIdSupport, kJar2, pom2);
    ReleaseId releaseId3 = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, "1.1.0-SNAPSHOT");
    processes.add("repo/rules/RuleWIthDeclaredType.drl");
    InternalKieModule kJar3 = createKieJar(ks, releaseId3, processes);
    File pom3 = new File("target/kmodule3", "pom.xml");
    pom3.getParentFile().mkdirs();
    try {
        FileOutputStream fs = new FileOutputStream(pom3);
        fs.write(getPom(releaseId3).getBytes());
        fs.close();
    } catch (Exception e) {
    }
    repository = getKieMavenRepository();
    repository.deployArtifact(releaseId3, kJar3, pom3);
}
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) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Example 50 with KieMavenRepository

use of org.kie.scanner.KieMavenRepository in project jbpm by kiegroup.

the class DeploymentServiceWithSyncTest method prepare.

@Before
public void prepare() {
    configureServices();
    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/signal.bpmn");
    processes.add("repo/processes/general/import.bpmn");
    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);
    ReleaseId releaseIdSupport = ks.newReleaseId(GROUP_ID, "support", VERSION);
    List<String> processesSupport = new ArrayList<String>();
    processesSupport.add("repo/processes/support/support.bpmn");
    InternalKieModule kJar2 = createKieJar(ks, releaseIdSupport, processesSupport);
    File pom2 = new File("target/kmodule2", "pom.xml");
    pom2.getParentFile().mkdir();
    try {
        FileOutputStream fs = new FileOutputStream(pom2);
        fs.write(getPom(releaseIdSupport).getBytes());
        fs.close();
    } catch (Exception e) {
    }
    repository.deployArtifact(releaseIdSupport, kJar2, pom2);
    configureDeploymentSync();
}
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) InternalKieModule(org.drools.compiler.kie.builder.impl.InternalKieModule) Before(org.junit.Before)

Aggregations

KieMavenRepository (org.kie.scanner.KieMavenRepository)58 KieMavenRepository.getKieMavenRepository (org.kie.scanner.KieMavenRepository.getKieMavenRepository)55 KieServices (org.kie.api.KieServices)54 ReleaseId (org.kie.api.builder.ReleaseId)53 File (java.io.File)51 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)51 FileOutputStream (java.io.FileOutputStream)45 ArrayList (java.util.ArrayList)42 Before (org.junit.Before)32 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)17 HashMap (java.util.HashMap)15 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)15 DeploymentDescriptorImpl (org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl)12 DeploymentDescriptor (org.kie.internal.runtime.conf.DeploymentDescriptor)12 Test (org.junit.Test)10 KieContainer (org.kie.api.runtime.KieContainer)7 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)5 ObjectModel (org.kie.internal.runtime.conf.ObjectModel)5 IOException (java.io.IOException)4 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)4