use of org.jbpm.runtime.manager.impl.deploy.TransientObjectModel in project jbpm by kiegroup.
the class DeploymentStoreTest method testEnableAndGetActiveDeploymentsWithTransientNamedObject.
@Test
public void testEnableAndGetActiveDeploymentsWithTransientNamedObject() {
Collection<DeploymentUnit> enabled = store.getEnabledDeploymentUnits();
assertNotNull(enabled);
assertEquals(0, enabled.size());
KModuleDeploymentUnit unit = new KModuleDeploymentUnit("org.jbpm", "test", "1.0");
DeploymentDescriptor descriptor = unit.getDeploymentDescriptor();
if (descriptor == null) {
descriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
}
// add transient named object model that should not be persisted
descriptor.getBuilder().addWorkItemHandler(new TransientNamedObjectModel("ejb", "async", "org.jbpm.executor.impl.wih.AsyncWorkItemHandler", new Object[] { "jndi:java:module/ExecutorServiceEJBImpl", "org.jbpm.executor.commands.PrintOutCommand" })).addEventListener(new TransientObjectModel("ejb", "not.existing.listener"));
unit.setDeploymentDescriptor(descriptor);
store.enableDeploymentUnit(unit);
enabled = store.getEnabledDeploymentUnits();
assertNotNull(enabled);
assertEquals(1, enabled.size());
DeploymentUnit unitEnabled = enabled.iterator().next();
assertTrue(unitEnabled instanceof KModuleDeploymentUnit);
DeploymentDescriptor descriptorEnabled = ((KModuleDeploymentUnit) unitEnabled).getDeploymentDescriptor();
assertNotNull(descriptorEnabled);
assertEquals(0, descriptorEnabled.getWorkItemHandlers().size());
assertEquals(0, descriptorEnabled.getEventListeners().size());
}
Aggregations