Search in sources :

Example 86 with DeploymentUnit

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

the class UserTaskAdminServiceImplTest 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);
            Assertions.assertThat(pi).isNull();
        } 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) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException) TaskNotFoundException(org.jbpm.services.api.TaskNotFoundException) After(org.junit.After)

Example 87 with DeploymentUnit

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

the class DeploymentStore method getDeactivatedDeploymentUnits.

public Collection<DeploymentUnit> getDeactivatedDeploymentUnits() {
    List<DeploymentUnit> activeDeployments = new ArrayList<DeploymentUnit>();
    Map<String, Object> params = new HashMap<String, Object>();
    List<Integer> states = new ArrayList<Integer>();
    states.add(STATE_DEACTIVATED);
    params.put("state", states);
    List<DeploymentStoreEntry> deployments = commandService.execute(new QueryNameCommand<List<DeploymentStoreEntry>>("getDeploymentUnitsByState", params));
    for (DeploymentStoreEntry entry : deployments) {
        String sync = getEntryAttributes(entry.getAttributes()).get("sync");
        // add to the deployable list only sync flag is set to true or does not exists (default)
        if (sync == null || sync.equalsIgnoreCase("true")) {
            DeploymentUnit unit = (DeploymentUnit) xstream.fromXML(entry.getDeploymentUnit());
            ((KModuleDeploymentUnit) unit).setActive(false);
            activeDeployments.add(unit);
        }
    }
    return activeDeployments;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) ArrayList(java.util.ArrayList) List(java.util.List) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit)

Example 88 with DeploymentUnit

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

the class DeploymentSynchronizer method onDeactivate.

@Override
public void onDeactivate(DeploymentEvent event) {
    if (event != null && event.getDeployedUnit() != null) {
        DeploymentUnit unit = event.getDeployedUnit().getDeploymentUnit();
        deploymentStore.deactivateDeploymentUnit(unit);
        logger.info("Deployment unit {} deactivated successfully", unit.getIdentifier());
    }
}
Also used : DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit)

Example 89 with DeploymentUnit

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

the class DeploymentSynchronizer method onActivate.

@Override
public void onActivate(DeploymentEvent event) {
    if (event != null && event.getDeployedUnit() != null) {
        DeploymentUnit unit = event.getDeployedUnit().getDeploymentUnit();
        deploymentStore.activateDeploymentUnit(unit);
        logger.info("Deployment unit {} activated successfully", unit.getIdentifier());
    }
}
Also used : DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit)

Example 90 with DeploymentUnit

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

the class DeploymentSynchronizer method onUnDeploy.

@Override
public void onUnDeploy(DeploymentEvent event) {
    if (event != null && event.getDeployedUnit() != null) {
        DeploymentUnit unit = event.getDeployedUnit().getDeploymentUnit();
        deploymentStore.disableDeploymentUnit(unit);
        entries.remove(unit.getIdentifier());
        logger.info("Deployment unit {} removed successfully", unit.getIdentifier());
    }
}
Also used : DeploymentUnit(org.jbpm.services.api.model.DeploymentUnit)

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