Search in sources :

Example 6 with ProcessDefinition

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

the class RuntimeDataServiceImplTest method testGetProcessesByDeploymentId.

@Test
public void testGetProcessesByDeploymentId() {
    Collection<ProcessDefinition> definitions = runtimeDataService.getProcessesByDeploymentId(deploymentUnit.getIdentifier(), new QueryContext());
    assertNotNull(definitions);
    assertEquals(5, definitions.size());
    List<String> expectedProcessIds = new ArrayList<String>();
    expectedProcessIds.add("org.jbpm.writedocument.empty");
    expectedProcessIds.add("org.jbpm.writedocument");
    expectedProcessIds.add("UserTask");
    expectedProcessIds.add("org.jboss.qa.bpms.HumanTask");
    expectedProcessIds.add("AdHocSubProcess");
    for (ProcessDefinition def : definitions) {
        assertTrue(expectedProcessIds.contains(def.getId()));
    }
    String origVer = deploymentUnit.getVersion();
    deploymentUnit.setVersion("LATEST");
    definitions = runtimeDataService.getProcessesByDeploymentId(deploymentUnit.getIdentifier(), new QueryContext());
    assertNotNull(definitions);
    assertEquals(5, definitions.size());
    deploymentUnit.setVersion(origVer);
}
Also used : ArrayList(java.util.ArrayList) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) QueryContext(org.kie.api.runtime.query.QueryContext) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 7 with ProcessDefinition

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

the class RuntimeDataServiceImplTest method testGetProcessesSortByProcessName.

@Test
public void testGetProcessesSortByProcessName() {
    Collection<ProcessDefinition> definitions = runtimeDataService.getProcesses(new QueryContext("ProcessName", true));
    assertNotNull(definitions);
    assertEquals(5, definitions.size());
    List<String> expectedProcessIds = new ArrayList<String>();
    expectedProcessIds.add("AdHoc SubProcess");
    expectedProcessIds.add("HumanTask");
    expectedProcessIds.add("User Task");
    expectedProcessIds.add("humanTaskSample");
    expectedProcessIds.add("humanTaskSample");
    int index = 0;
    for (ProcessDefinition def : definitions) {
        assertEquals(def.getName(), expectedProcessIds.get(index));
        index++;
    }
}
Also used : ArrayList(java.util.ArrayList) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) QueryContext(org.kie.api.runtime.query.QueryContext) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 8 with ProcessDefinition

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

the class RuntimeDataServiceImplTest 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) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 9 with ProcessDefinition

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

the class RuntimeDataServiceImplTest method testGetProcesses.

@Test
public void testGetProcesses() {
    Collection<ProcessDefinition> definitions = runtimeDataService.getProcesses(new QueryContext());
    assertNotNull(definitions);
    assertEquals(5, definitions.size());
    List<String> expectedProcessIds = new ArrayList<String>();
    expectedProcessIds.add("org.jbpm.writedocument.empty");
    expectedProcessIds.add("org.jbpm.writedocument");
    expectedProcessIds.add("UserTask");
    expectedProcessIds.add("org.jboss.qa.bpms.HumanTask");
    expectedProcessIds.add("AdHocSubProcess");
    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) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 10 with ProcessDefinition

use of org.jbpm.services.api.model.ProcessDefinition 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)

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