Search in sources :

Example 46 with ProcessDefinition

use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.

the class RuntimeDataServiceEJBIntegrationTest method testGetProcessByDeploymentIdAndProcessId.

@Test
public void testGetProcessByDeploymentIdAndProcessId() {
    ProcessDefinition definition = runtimeDataService.getProcessesByDeploymentIdProcessId(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
    assertNotNull(definition);
    assertEquals("org.jbpm.writedocument", definition.getId());
}
Also used : ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) Test(org.junit.Test)

Example 47 with ProcessDefinition

use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.

the class RuntimeDataServiceEJBIntegrationTest method testGetProcesses.

@Test
public void testGetProcesses() {
    Collection<ProcessDefinition> definitions = runtimeDataService.getProcesses(new QueryContext());
    assertNotNull(definitions);
    assertEquals(3, definitions.size());
    List<String> expectedProcessIds = new ArrayList<String>();
    expectedProcessIds.add("org.jbpm.writedocument.empty");
    expectedProcessIds.add("org.jbpm.writedocument");
    expectedProcessIds.add("org.jboss.qa.bpms.HumanTask");
    for (ProcessDefinition def : definitions) {
        assertTrue(expectedProcessIds.contains(def.getId()));
    }
}
Also used : ArrayList(java.util.ArrayList) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) QueryContext(org.kie.api.runtime.query.QueryContext) Test(org.junit.Test)

Example 48 with ProcessDefinition

use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.

the class RuntimeDataServiceEJBIntegrationTest method testGetProcessByFilter.

@Test
public void testGetProcessByFilter() {
    Collection<ProcessDefinition> definitions = runtimeDataService.getProcessesByFilter("org.jbpm", new QueryContext());
    assertNotNull(definitions);
    assertEquals(2, definitions.size());
    List<String> expectedProcessIds = new ArrayList<String>();
    expectedProcessIds.add("org.jbpm.writedocument.empty");
    expectedProcessIds.add("org.jbpm.writedocument");
    for (ProcessDefinition def : definitions) {
        assertTrue(expectedProcessIds.contains(def.getId()));
    }
}
Also used : ArrayList(java.util.ArrayList) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) QueryContext(org.kie.api.runtime.query.QueryContext) Test(org.junit.Test)

Example 49 with ProcessDefinition

use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.

the class DefinitionServiceEJBIntegrationTest method testHumanTaskProcessBeforeAndAfterUndeploy.

@Test
public void testHumanTaskProcessBeforeAndAfterUndeploy() throws IOException {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    String processId = "org.jbpm.writedocument";
    ProcessDefinition procDef = bpmn2Service.getProcessDefinition(deploymentUnit.getIdentifier(), processId);
    assertNotNull(procDef);
    assertEquals(procDef.getId(), "org.jbpm.writedocument");
    assertEquals(procDef.getName(), "humanTaskSample");
    assertEquals(procDef.getKnowledgeType(), "PROCESS");
    assertEquals(procDef.getPackageName(), "defaultPackage");
    assertEquals(procDef.getType(), "RuleFlow");
    assertEquals(procDef.getVersion(), "1");
    // now let's undeploy the unit
    deploymentService.undeploy(deploymentUnit);
    procDef = bpmn2Service.getProcessDefinition(deploymentUnit.getIdentifier(), processId);
    assertNull(procDef);
}
Also used : ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) Test(org.junit.Test)

Example 50 with ProcessDefinition

use of org.jbpm.services.api.model.ProcessDefinition in project jbpm by kiegroup.

the class DeploymentServiceEJBIntegrationTest method testDeploymentOfMultipleVersions.

@Test
public void testDeploymentOfMultipleVersions() {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    DeploymentUnit deploymentUnit3 = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, "1.1.0-SNAPSHOT");
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    deploymentService.deploy(deploymentUnit3);
    units.add(deploymentUnit3);
    DeployedUnit deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
    assertNotNull(deployed);
    assertNotNull(deployed.getDeploymentUnit());
    assertNotNull(deployed.getRuntimeManager());
    assertEquals(0, ((DeployedUnitImpl) deployed).getDeployedClasses().size());
    DeployedUnit deployed3 = deploymentService.getDeployedUnit(deploymentUnit3.getIdentifier());
    assertNotNull(deployed3);
    assertNotNull(deployed3.getDeploymentUnit());
    assertNotNull(deployed3.getRuntimeManager());
    assertEquals(0, ((DeployedUnitImpl) deployed3).getDeployedClasses().size());
    assertNotNull(runtimeDataService);
    Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
    assertNotNull(processes);
    assertEquals(10, processes.size());
    DeployedUnit deployedLatest = deploymentService.getDeployedUnit(GROUP_ID + ":" + ARTIFACT_ID + ":LATEST");
    assertNotNull(deployedLatest);
    assertNotNull(deployedLatest.getDeploymentUnit());
    assertNotNull(deployedLatest.getRuntimeManager());
    assertEquals(deploymentUnit3.getIdentifier(), deployedLatest.getDeploymentUnit().getIdentifier());
}
Also used : DeployedUnit(org.jbpm.services.api.model.DeployedUnit) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) QueryContext(org.kie.api.runtime.query.QueryContext) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeployedUnitImpl(org.jbpm.kie.services.impl.DeployedUnitImpl) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) Test(org.junit.Test)

Aggregations

ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)50 Test (org.junit.Test)44 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)29 QueryContext (org.kie.api.runtime.query.QueryContext)27 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)22 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)19 DeploymentUnit (org.jbpm.services.api.model.DeploymentUnit)19 HashMap (java.util.HashMap)14 ArrayList (java.util.ArrayList)12 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)12 RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)9 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)7 DeployedUnitImpl (org.jbpm.kie.services.impl.DeployedUnitImpl)6 OtherPerson (org.jbpm.kie.test.objects.OtherPerson)6 Person (org.jbpm.kie.test.objects.Person)6 InternalRuntimeManager (org.kie.internal.runtime.manager.InternalRuntimeManager)6 KieSession (org.kie.api.runtime.KieSession)4 AbstractEJBServicesTest (org.jbpm.test.container.AbstractEJBServicesTest)3 DeploymentDescriptor (org.kie.internal.runtime.conf.DeploymentDescriptor)3 File (java.io.File)2