Search in sources :

Example 26 with DeploymentUnit

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

the class DeploymentStoreTest method testEnableAndGetActiveDeployments.

@Test
public void testEnableAndGetActiveDeployments() {
    Collection<DeploymentUnit> enabled = store.getEnabledDeploymentUnits();
    assertNotNull(enabled);
    assertEquals(0, enabled.size());
    KModuleDeploymentUnit unit = new KModuleDeploymentUnit("org.jbpm", "test", "1.0");
    store.enableDeploymentUnit(unit);
    enabled = store.getEnabledDeploymentUnits();
    assertNotNull(enabled);
    assertEquals(1, enabled.size());
}
Also used : KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 27 with DeploymentUnit

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

the class ProcessInstanceAdminServiceImplTest method cleanup.

@After
public void cleanup() {
    cleanupSingletonSessionId();
    if (processInstanceId != null) {
        try {
            // let's abort process instance to leave the system in clear state
            processService.abortProcessInstance(processInstanceId);
            ProcessInstance pi = processService.getProcessInstance(processInstanceId);
            assertNull(pi);
        } catch (ProcessInstanceNotFoundException e) {
        // ignore it as it might already be completed/aborted
        }
    }
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            try {
                deploymentService.undeploy(unit);
            } catch (Exception e) {
            // do nothing in case of some failed tests to avoid next test to fail as well
            }
        }
        units.clear();
    }
    close();
    CountDownListenerFactory.clear();
}
Also used : ProcessInstance(org.kie.api.runtime.process.ProcessInstance) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) After(org.junit.After)

Example 28 with DeploymentUnit

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

the class ProcessInstanceMigrationServiceImplTest method cleanup.

@After
public void cleanup() {
    cleanupSingletonSessionId();
    if (units != null && !units.isEmpty()) {
        for (DeploymentUnit unit : units) {
            try {
                deploymentService.undeploy(unit);
            } catch (Exception e) {
            // do nothing in case of some failed tests to avoid next test to fail as well
            }
        }
        units.clear();
    }
    close();
}
Also used : DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) After(org.junit.After)

Example 29 with DeploymentUnit

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

the class BPMN2DataServicesReferencesTest method cleanup.

@After
public void cleanup() {
    for (long procInstId : procInstIds) {
        try {
            processService.abortProcessInstance(procInstId);
        } catch (Exception e) {
        // ignore if it fails..
        }
    }
    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) IOException(java.io.IOException) After(org.junit.After)

Example 30 with DeploymentUnit

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

the class BPMN2DataServicesTest 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(), "3");
    // now let's undeploy the unit
    deploymentService.undeploy(deploymentUnit);
    try {
        bpmn2Service.getProcessDefinition(deploymentUnit.getIdentifier(), processId);
        fail("DeploymentNotFoundException was not thrown");
    } catch (DeploymentNotFoundException e) {
    // expected
    }
}
Also used : DeploymentNotFoundException(org.jbpm.services.api.DeploymentNotFoundException) 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)

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