Search in sources :

Example 66 with DeploymentUnit

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

the class PostDeploymentServiceTest method testDuplicatedDeployment.

@Test
public void testDuplicatedDeployment() {
    assertNotNull(deploymentService);
    ((KModuleDeploymentService) deploymentService).addListener(new DeploymentEventListener() {

        @Override
        public void onUnDeploy(DeploymentEvent event) {
        }

        @Override
        public void onDeploy(DeploymentEvent event) {
            throw new IllegalArgumentException("On purpose");
        }

        @Override
        public void onActivate(DeploymentEvent event) {
        }

        @Override
        public void onDeactivate(DeploymentEvent event) {
        }
    });
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION, "KBase-test", "ksession-test");
    try {
        deploymentService.deploy(deploymentUnit);
        units.add(deploymentUnit);
        fail("Deployment should fail due to post process failuer - see ThrowExceptionOnDeploymentEvent");
    } catch (RuntimeException e) {
    }
    DeployedUnit deployedGeneral = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
    assertNull(deployedGeneral);
    assertFalse(RuntimeManagerRegistry.get().isRegistered(deploymentUnit.getIdentifier()));
}
Also used : KModuleDeploymentService(org.jbpm.kie.services.impl.KModuleDeploymentService) DeployedUnit(org.jbpm.services.api.model.DeployedUnit) DeploymentEventListener(org.jbpm.services.api.DeploymentEventListener) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentEvent(org.jbpm.services.api.DeploymentEvent) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 67 with DeploymentUnit

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

the class TaskVariablesQueryServiceTest method cleanup.

@After
public void cleanup() {
    cleanupSingletonSessionId();
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            deploymentService.undeploy(unit);
        }
        units.clear();
    }
    close();
}
Also used : DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) After(org.junit.After)

Example 68 with DeploymentUnit

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

the class BPMN2DataServicesTest method testObjectVariable.

@Test
public void testObjectVariable() throws IOException {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    String processId = "ObjectVariableProcess";
    ProcessDefinition procDef = bpmn2Service.getProcessDefinition(deploymentUnit.getIdentifier(), processId);
    assertNotNull(procDef);
    assertEquals(procDef.getId(), "ObjectVariableProcess");
    assertEquals(procDef.getName(), "ObjectVariableProcess");
    assertEquals(procDef.getKnowledgeType(), "PROCESS");
    assertEquals(procDef.getPackageName(), "defaultPackage");
    assertEquals(procDef.getType(), "RuleFlow");
    assertEquals(procDef.getVersion(), "1");
    Map<String, String> processData = bpmn2Service.getProcessVariables(deploymentUnit.getIdentifier(), processId);
    assertEquals("String", processData.get("type"));
    assertEquals("Object", processData.get("myobject"));
    assertEquals(2, processData.keySet().size());
}
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) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 69 with DeploymentUnit

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

the class BPMN2DataServicesTest method testFindReusableSubProcesses.

@Test
public void testFindReusableSubProcesses() {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    String theString = "ParentProcess";
    assertNotNull(theString);
    Collection<String> reusableProcesses = bpmn2Service.getReusableSubProcesses(deploymentUnit.getIdentifier(), theString);
    assertNotNull(reusableProcesses);
    assertEquals(1, reusableProcesses.size());
    assertEquals("org.jbpm.signal", reusableProcesses.iterator().next());
}
Also used : KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 70 with DeploymentUnit

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

the class BPMN2DataServicesTest method testGetProcessDefinitionInvalidProcessId.

@Test(expected = ProcessDefinitionNotFoundException.class)
public void testGetProcessDefinitionInvalidProcessId() throws IOException {
    assertNotNull(deploymentService);
    DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
    deploymentService.deploy(deploymentUnit);
    units.add(deploymentUnit);
    bpmn2Service.getProcessDefinition(deploymentUnit.getIdentifier(), "org.jbpm.invalidId");
}
Also used : KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

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