use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentServiceWithSyncTest method testDeploymentOfProcessesBySync.
@Test
public void testDeploymentOfProcessesBySync() throws Exception {
CoundDownDeploymentListener countDownListener = configureListener(1, true, false, false, false);
Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(0, deployed.size());
KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
store.enableDeploymentUnit(unit);
units.add(unit);
countDownListener.waitTillCompleted(10000);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(1, deployed.size());
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentServiceWithSyncTest method testUndeploymentOfProcessesBySync.
@Test
public void testUndeploymentOfProcessesBySync() throws Exception {
CoundDownDeploymentListener countDownListener = configureListener(1, false, true, false, false);
Collection<DeployedUnit> deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(0, deployed.size());
KModuleDeploymentUnit unit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(unit);
units.add(unit);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(1, deployed.size());
countDownListener.waitTillCompleted(1000);
store.disableDeploymentUnit(unit);
countDownListener.waitTillCompleted(10000);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(0, deployed.size());
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentStore method getEnabledDeploymentUnits.
public Collection<DeploymentUnit> getEnabledDeploymentUnits() {
List<DeploymentUnit> activeDeployments = new ArrayList<DeploymentUnit>();
Map<String, Object> params = new HashMap<String, Object>();
List<Integer> states = new ArrayList<Integer>();
states.add(STATE_ENABLED);
states.add(STATE_ACTIVATED);
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());
if (entry.getState() == STATE_DEACTIVATED) {
((KModuleDeploymentUnit) unit).setActive(false);
}
activeDeployments.add(unit);
}
}
return activeDeployments;
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentStore method getDeploymentUnitsByDate.
public void getDeploymentUnitsByDate(Date date, Collection<DeploymentUnit> enabled, Collection<DeploymentUnit> disabled, Collection<DeploymentUnit> activated, Collection<DeploymentUnit> deactivated) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("ludate", date);
List<DeploymentStoreEntry> deployments = commandService.execute(new QueryNameCommand<List<DeploymentStoreEntry>>("getDeploymentUnitsByDate", 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());
if (entry.getState() == STATE_ENABLED) {
enabled.add(unit);
} else if (entry.getState() == STATE_DISABLED) {
disabled.add(unit);
} else if (entry.getState() == STATE_ACTIVATED) {
activated.add(unit);
} else if (entry.getState() == STATE_DEACTIVATED) {
((KModuleDeploymentUnit) unit).setActive(false);
deactivated.add(unit);
} else {
logger.warn("Unknown state of deployment store entry {} for {} will be ignored", entry.getId(), entry);
}
}
}
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class ProcessServiceEJBIntegrationTest method testStartProcess.
@Test
public void testStartProcess() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier());
assertTrue(isDeployed);
assertNotNull(processService);
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "customtask");
assertNotNull(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(processInstanceId);
assertNull(pi);
}
Aggregations