use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class DeploymentServiceWithSyncTest method testDeploymentOfProcessesBySyncWithDisabledAttribute.
@Test
public void testDeploymentOfProcessesBySyncWithDisabledAttribute() 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);
unit.addAttribute("sync", "false");
store.enableDeploymentUnit(unit);
units.add(unit);
countDownListener.waitTillCompleted(4000);
deployed = deploymentService.getDeployedUnits();
assertNotNull(deployed);
assertEquals(0, deployed.size());
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class FilteredKModuleDeploymentServiceTest method testSerializationClassesLimitedInDeploymentDescriptor.
@Test
public void testSerializationClassesLimitedInDeploymentDescriptor() {
String groupId = "org.test";
String artifactId = "jbpm-kie-services-filter-test-desc";
String version = VERSION;
FluentKieModuleDeploymentHelper.newFluentInstance().setGroupId(groupId).setArtifactId(artifactId).setVersion(version).createKieJarAndDeployToMaven();
configureServices();
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(groupId, artifactId, version);
DeploymentDescriptor depDesc = new DeploymentDescriptorImpl().getBuilder().setLimitSerializationClasses(true).addClass(// interface, no annotations!
Building.class.getName()).addClass(// @XmlRootElement
House.class.getName()).addClass(// @XmlRootElement
Person.class.getName()).addClass(// inherits from Person
OtherPerson.class.getName()).addClass(// @Remotable
Thing.class.getName()).get();
deploymentUnit.setDeploymentDescriptor(depDesc);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
verifyDeployedUnitContainsCorrectClasses(deploymentUnit);
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class FilteredKModuleDeploymentServiceTest method testMultipleRemotableInPojoJar.
@Test
public void testMultipleRemotableInPojoJar() {
String groupId = "org.test";
String pojoArtifactId = "jbpm-kie-services-filter-test-pojo";
String projectArtifactId = "jbpm-kie-services-filter-test-project";
String version = VERSION;
KieServices ks = KieServices.Factory.get();
ReleaseId pojoReleaseId = ks.newReleaseId(groupId, pojoArtifactId, VERSION);
// contains two @Remotable classes MyPojo, MyPojo2
File pojojar = new File("src/test/resources/multi-remotable/pojo.jar");
File pojopom = new File(this.getClass().getResource("/multi-remotable/pojo-pom.xml").getFile());
KieMavenRepository.getKieMavenRepository().installArtifact(pojoReleaseId, pojojar, pojopom);
FluentKieModuleDeploymentHelper.newFluentInstance().setGroupId(groupId).setArtifactId(projectArtifactId).setVersion(version).addDependencies(groupId + ":" + pojoArtifactId + ":" + version).createKieJarAndDeployToMaven();
configureServices();
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(groupId, projectArtifactId, version);
DeploymentDescriptor depDesc = new DeploymentDescriptorImpl().getBuilder().setLimitSerializationClasses(true).get();
deploymentUnit.setDeploymentDescriptor(depDesc);
deploymentService.deploy(deploymentUnit);
DeployedUnit deployedUnit = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
Collection<Class<?>> deployedClasses = deployedUnit.getDeployedClasses();
ClassLoader classLoader = deploymentUnit.getKieContainer().getClassLoader();
try {
assertTrue("MyPojo is not added", deployedClasses.contains(classLoader.loadClass("com.sample.MyPojo")));
assertTrue("MyPojo2 is not added", deployedClasses.contains(classLoader.loadClass("com.sample.MyPojo2")));
} catch (ClassNotFoundException e) {
fail(e.getMessage());
}
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class FilteredKModuleDeploymentServiceTest method testDeploymentOfProcessesWildcardPackage.
@Test
public void testDeploymentOfProcessesWildcardPackage() {
prepare("customer.*");
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);
}
use of org.jbpm.kie.services.impl.KModuleDeploymentUnit in project jbpm by kiegroup.
the class IdentityProviderAwareProcessListenerTest method init.
@Before
public void init() {
configureServices();
final KieServices ks = KieServices.Factory.get();
ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION);
final List<String> processes = Collections.singletonList("repo/processes/general/humanTask.bpmn");
final InternalKieModule kJar1 = createKieJar(ks, releaseId, processes);
final File pom = new File("target/kmodule", "pom.xml");
pom.getParentFile().mkdir();
try (FileOutputStream fs = new FileOutputStream(pom)) {
fs.write(getPom(releaseId).getBytes());
} catch (Exception e) {
e.printStackTrace();
}
getKieMavenRepository().deployArtifact(releaseId, kJar1, pom);
deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
final DeploymentDescriptor descriptor = new DeploymentDescriptorImpl();
descriptor.getBuilder().addEventListener(new NamedObjectModel("mvel", "processIdentity", "new org.jbpm.kie.services.impl.IdentityProviderAwareProcessListener(ksession)"));
deploymentUnit.setDeploymentDescriptor(descriptor);
deploymentService.deploy(deploymentUnit);
final DeployedUnit deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployed);
assertNotNull(deployed.getDeploymentUnit());
assertNotNull(runtimeDataService);
Collection<ProcessDefinition> processDefinitions = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processDefinitions);
assertEquals(1, processDefinitions.size());
}
Aggregations