Search in sources :

Example 1 with DeploymentUnit

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

the class KModuleDeploymentService method addClassToDeployedUnit.

protected void addClassToDeployedUnit(Class deploymentClass, DeployedUnitImpl deployedUnit) {
    if (deploymentClass != null) {
        DeploymentUnit unit = deployedUnit.getDeploymentUnit();
        Boolean limitClasses = false;
        if (unit != null) {
            DeploymentDescriptor depDesc = ((KModuleDeploymentUnit) unit).getDeploymentDescriptor();
            if (depDesc != null) {
                limitClasses = depDesc.getLimitSerializationClasses();
            }
        }
        if (limitClasses != null && limitClasses) {
            filterClassesAddedToDeployedUnit(deployedUnit, deploymentClass);
        } else {
            logger.debug("Loaded {} onto the classpath from deployment {}", deploymentClass.getName(), unit.getIdentifier());
            deployedUnit.addClass(deploymentClass);
        }
    }
}
Also used : DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit)

Example 2 with DeploymentUnit

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

the class EDefinitionTest method testAssociatedEntities.

@Test
public void testAssociatedEntities() {
    DeploymentUnit basicKieJar = archive.deployBasicKieJar();
    Map<String, Collection<String>> entities = definitionService.getAssociatedEntities(basicKieJar.getIdentifier(), HUMAN_TASK_PROCESS_ID);
    Assertions.assertThat(entities).isNotNull().hasSize(1);
    Assertions.assertThat(entities.get("Hello")).contains("ibek");
}
Also used : Collection(java.util.Collection) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) Test(org.junit.Test) AbstractEJBServicesTest(org.jbpm.test.container.AbstractEJBServicesTest)

Example 3 with DeploymentUnit

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

the class EDefinitionTest method testServiceTasks.

@Test
public void testServiceTasks() {
    DeploymentUnit serviceKieJar = archive.deployServiceKieJar();
    Map<String, String> services = definitionService.getServiceTasks(serviceKieJar.getIdentifier(), REST_WORK_ITEM_PROCESS_ID);
    Assertions.assertThat(services).isNotNull().hasSize(1).containsEntry("Any REST operation", "Rest");
}
Also used : DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) Test(org.junit.Test) AbstractEJBServicesTest(org.jbpm.test.container.AbstractEJBServicesTest)

Example 4 with DeploymentUnit

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

the class EDefinitionTest method testGetProcessDefinition.

@Test
public void testGetProcessDefinition() {
    DeploymentUnit basicKieJar = archive.deployBasicKieJar();
    ProcessDefinition pd = definitionService.getProcessDefinition(basicKieJar.getIdentifier(), HUMAN_TASK_PROCESS_ID);
    Assertions.assertThat(pd).isNotNull();
    System.out.println(pd.getId());
    System.out.println(pd.getName());
    System.out.println(pd.getKnowledgeType());
    System.out.println(pd.getOriginalPath());
    System.out.println(pd.getPackageName());
    System.out.println(pd.getType());
    System.out.println(pd.getVersion());
    System.out.println(pd.getAssociatedEntities());
    System.out.println(pd.getProcessVariables());
    System.out.println(pd.getReusableSubProcesses());
    System.out.println(pd.getServiceTasks());
    Assertions.assertThat(pd.getId()).isNotNull().isEqualTo(HUMAN_TASK_PROCESS_ID);
    Assertions.assertThat(pd.getName()).isNotNull().isEqualTo("HumanTask");
    Assertions.assertThat(pd.getKnowledgeType()).isNotNull();
    // Assertions.assertThat(pd.getOriginalPath()).isNotNull(); // Related to asset deployment
    Assertions.assertThat(pd.getPackageName()).isNotNull();
    Assertions.assertThat(pd.getType()).isNotNull();
    Assertions.assertThat(pd.getVersion()).isNotNull();
    Assertions.assertThat(pd.getAssociatedEntities()).isNotNull();
    Assertions.assertThat(pd.getProcessVariables()).isNotNull();
    Assertions.assertThat(pd.getReusableSubProcesses()).isNotNull();
    Assertions.assertThat(pd.getServiceTasks()).isNotNull();
}
Also used : ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) Test(org.junit.Test) AbstractEJBServicesTest(org.jbpm.test.container.AbstractEJBServicesTest)

Example 5 with DeploymentUnit

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

the class EDefinitionTest method testTasksDefinitions.

@Test
public void testTasksDefinitions() {
    DeploymentUnit basicKieJar = archive.deployBasicKieJar();
    Collection<UserTaskDefinition> tasks = definitionService.getTasksDefinitions(basicKieJar.getIdentifier(), HUMAN_TASK_PROCESS_ID);
    Assertions.assertThat(tasks).isNotNull().hasSize(1);
    UserTaskDefinition task = tasks.iterator().next();
    Assertions.assertThat(task.getName()).isEqualTo("Hello");
    Assertions.assertThat(task.getAssociatedEntities()).contains("ibek");
    Assertions.assertThat(task.getTaskInputMappings()).containsEntry("TaskName", "java.lang.String");
}
Also used : UserTaskDefinition(org.jbpm.services.api.model.UserTaskDefinition) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) Test(org.junit.Test) AbstractEJBServicesTest(org.jbpm.test.container.AbstractEJBServicesTest)

Aggregations

DeploymentUnit (org.jbpm.services.api.model.DeploymentUnit)104 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)88 Test (org.junit.Test)53 After (org.junit.After)35 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)34 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)28 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)25 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)19 HashMap (java.util.HashMap)16 RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)15 ArrayList (java.util.ArrayList)14 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)13 QueryContext (org.kie.api.runtime.query.QueryContext)13 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)12 KieServices (org.kie.api.KieServices)10 ReleaseId (org.kie.api.builder.ReleaseId)10 InternalRuntimeManager (org.kie.internal.runtime.manager.InternalRuntimeManager)9 AbstractEJBServicesTest (org.jbpm.test.container.AbstractEJBServicesTest)8 Collection (java.util.Collection)6 DeployedUnitImpl (org.jbpm.kie.services.impl.DeployedUnitImpl)6