use of org.jbpm.services.api.model.DeployedUnit in project jbpm by kiegroup.
the class EDeploymentTest method testUndeploy.
@Test
public void testUndeploy() {
DeploymentUnit basicKieJar = archive.deployBasicKieJar();
DeployedUnit deployed = deploymentService.getDeployedUnit(basicKieJar.getIdentifier());
Assertions.assertThat(deployed).isNotNull();
archive.undeployDeploymentUnit(basicKieJar);
DeployedUnit undeployed = deploymentService.getDeployedUnit(basicKieJar.getIdentifier());
Assertions.assertThat(undeployed).isNull();
}
use of org.jbpm.services.api.model.DeployedUnit in project jbpm by kiegroup.
the class DeploymentServiceWithSyncTest method testDeactivateAndActivateOfProcessesBySync.
@Test
public void testDeactivateAndActivateOfProcessesBySync() throws Exception {
CoundDownDeploymentListener countDownListener = configureListener(2, false, false, true, true);
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());
assertTrue(deployed.iterator().next().isActive());
store.deactivateDeploymentUnit(unit);
countDownListener.waitTillCompleted(10000);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(1, deployed.size());
assertFalse(deployed.iterator().next().isActive());
store.activateDeploymentUnit(unit);
countDownListener.reset(1);
countDownListener.waitTillCompleted(10000);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(1, deployed.size());
assertTrue(deployed.iterator().next().isActive());
}
use of org.jbpm.services.api.model.DeployedUnit in project jbpm by kiegroup.
the class FilteredKModuleDeploymentServiceTest method testDeploymentOfProcessesFromOrderPackage.
@Test
public void testDeploymentOfProcessesFromOrderPackage() {
prepare("order.repo.processes.general");
assertNotNull(deploymentService);
DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION, "KBase-test", "ksession-test");
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
DeployedUnit deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployed);
assertNotNull(deployed.getDeploymentUnit());
assertNotNull(deployed.getRuntimeManager());
assertEquals(GROUP_ID + ":" + ARTIFACT_ID + ":" + VERSION + ":" + "KBase-test" + ":" + "ksession-test", deployed.getDeploymentUnit().getIdentifier());
assertNotNull(runtimeDataService);
Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(1, processes.size());
processes = runtimeDataService.getProcessesByDeploymentId(deploymentUnit.getIdentifier(), new QueryContext());
assertNotNull(processes);
assertEquals(1, processes.size());
ProcessDefinition process = runtimeDataService.getProcessesByDeploymentIdProcessId(deploymentUnit.getIdentifier(), "Import");
assertNotNull(process);
}
use of org.jbpm.services.api.model.DeployedUnit in project jbpm by kiegroup.
the class FilteredKModuleDeploymentServiceTest method verifyDeployedUnitContainsCorrectClasses.
private void verifyDeployedUnitContainsCorrectClasses(DeploymentUnit deploymentUnit) {
DeployedUnit deployedUnit = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
DeploymentDescriptor descriptor = ((KModuleDeploymentUnit) deployedUnit.getDeploymentUnit()).getDeploymentDescriptor();
boolean limitClasses = descriptor.getLimitSerializationClasses();
boolean unAnnotatedClassesFound = false;
for (Class<?> depdClass : deployedUnit.getDeployedClasses()) {
Annotation[] declAnnos = depdClass.getDeclaredAnnotations();
boolean xmlOrRemotAnnoFound = false;
for (Annotation depdClassAnno : declAnnos) {
Class annoType = depdClassAnno.annotationType();
if (XmlRootElement.class.equals(annoType) || Remotable.class.equals(annoType)) {
xmlOrRemotAnnoFound = true;
break;
}
}
assertTrue("Expected to find annotations on " + depdClass.getSimpleName(), (xmlOrRemotAnnoFound && limitClasses) || !limitClasses);
if (!xmlOrRemotAnnoFound) {
unAnnotatedClassesFound = true;
}
}
assertTrue("Expected to find unannotated classes in " + deployedUnit.getDeploymentUnit().getIdentifier(), (limitClasses && !unAnnotatedClassesFound) || (!limitClasses && unAnnotatedClassesFound));
if (limitClasses) {
try {
JAXBContext.newInstance(deployedUnit.getDeployedClasses().toArray(new Class[0]));
} catch (JAXBException e) {
e.printStackTrace();
fail("JAXBContext creation with deployed unit classes failed: " + e.getMessage());
}
}
}
use of org.jbpm.services.api.model.DeployedUnit in project jbpm by kiegroup.
the class FilteredKModuleDeploymentServiceTest method testDeploymentOfProcessesFromCustomerPackage.
@Test
public void testDeploymentOfProcessesFromCustomerPackage() {
prepare("customer.repo.processes.general");
assertNotNull(deploymentService);
DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION, "KBase-test", "ksession-test");
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
DeployedUnit deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployed);
assertNotNull(deployed.getDeploymentUnit());
assertNotNull(deployed.getRuntimeManager());
assertEquals(GROUP_ID + ":" + ARTIFACT_ID + ":" + VERSION + ":" + "KBase-test" + ":" + "ksession-test", deployed.getDeploymentUnit().getIdentifier());
assertNotNull(runtimeDataService);
Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(2, processes.size());
processes = runtimeDataService.getProcessesByFilter("custom", new QueryContext());
assertNotNull(processes);
assertEquals(1, processes.size());
processes = runtimeDataService.getProcessesByDeploymentId(deploymentUnit.getIdentifier(), new QueryContext());
assertNotNull(processes);
assertEquals(2, processes.size());
ProcessDefinition process = runtimeDataService.getProcessesByDeploymentIdProcessId(deploymentUnit.getIdentifier(), "customtask");
assertNotNull(process);
}
Aggregations