use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class DeploymentServiceEJBIntegrationTest method testDeploymentOfProcessesVerifyTransientObjectOmitted.
@Test
public void testDeploymentOfProcessesVerifyTransientObjectOmitted() {
assertNotNull(deploymentService);
assertNotNull(commandService);
DeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
DeployedUnit deployed = deploymentService.getDeployedUnit(deploymentUnit.getIdentifier());
assertNotNull(deployed);
assertNotNull(deployed.getDeploymentUnit());
assertNotNull(deployed.getRuntimeManager());
assertNotNull(runtimeDataService);
Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
assertNotNull(processes);
assertEquals(5, processes.size());
DeploymentStore store = new DeploymentStore();
store.setCommandService(commandService);
Collection<DeploymentUnit> units = store.getEnabledDeploymentUnits();
assertNotNull(units);
assertEquals(1, units.size());
DeploymentUnit enabled = units.iterator().next();
assertNotNull(enabled);
assertTrue(enabled instanceof KModuleDeploymentUnit);
KModuleDeploymentUnit kmoduleEnabled = (KModuleDeploymentUnit) enabled;
DeploymentDescriptor dd = kmoduleEnabled.getDeploymentDescriptor();
assertNotNull(dd);
// ejb deployment service add transitively Async WorkItem handler that should not be stored as part of deployment store
assertEquals(0, dd.getWorkItemHandlers().size());
}
use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class DeploymentServiceEJBImpl method addAsyncHandler.
protected void addAsyncHandler(KModuleDeploymentUnit unit) {
// add async only when the executor component is not disabled
if (isExecutorAvailable) {
DeploymentDescriptor descriptor = unit.getDeploymentDescriptor();
if (descriptor == null) {
descriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
}
descriptor.getBuilder().addWorkItemHandler(new TransientNamedObjectModel("ejb", "async", "org.jbpm.executor.impl.wih.AsyncWorkItemHandler", new Object[] { EXECUTOR_EJB_JNDI_NAME, "org.jbpm.executor.commands.PrintOutCommand" }));
unit.setDeploymentDescriptor(descriptor);
}
}
use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class SupportProcessBaseTest method prepare.
@Before
public void prepare() {
KieServices ks = KieServices.Factory.get();
ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION);
List<String> processes = new ArrayList<String>();
processes.add("repo/processes/support/support.bpmn");
DeploymentDescriptor customDescriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
customDescriptor.getBuilder().addTaskEventListener(new ObjectModel("org.jbpm.services.cdi.test.ext.DebugTaskLifeCycleEventListener"));
Map<String, String> resources = new HashMap<String, String>();
resources.put("src/main/resources/" + DeploymentDescriptor.META_INF_LOCATION, customDescriptor.toXml());
InternalKieModule kJar1 = createKieJar(ks, releaseId, processes, resources);
File pom = new File("target/kmodule", "pom.xml");
pom.getParentFile().mkdir();
try {
FileOutputStream fs = new FileOutputStream(pom);
fs.write(getPom(releaseId).getBytes());
fs.close();
} catch (Exception e) {
}
KieMavenRepository repository = getKieMavenRepository();
repository.deployArtifact(releaseId, kJar1, pom);
}
use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class TaskServiceEJBImpl method configureDelegate.
@PostConstruct
public void configureDelegate() {
UserGroupCallback callback = UserDataServiceProvider.getUserGroupCallback();
HumanTaskConfigurator configurator = HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).userGroupCallback(callback);
DeploymentDescriptorManager manager = new DeploymentDescriptorManager("org.jbpm.domain");
DeploymentDescriptor descriptor = manager.getDefaultDescriptor();
// in case there is descriptor with enabled audit register then by default
if (!descriptor.getAuditMode().equals(AuditMode.NONE)) {
JPATaskLifeCycleEventListener listener = new JPATaskLifeCycleEventListener(false);
BAMTaskEventListener bamListener = new BAMTaskEventListener(false);
// if the audit persistence unit is different than default for the engine perform proper init
if (!"org.jbpm.domain".equals(descriptor.getAuditPersistenceUnit())) {
EntityManagerFactory emf = EntityManagerFactoryManager.get().getOrCreate(descriptor.getAuditPersistenceUnit());
listener = new JPATaskLifeCycleEventListener(emf);
bamListener = new BAMTaskEventListener(emf);
}
configurator.listener(listener);
configurator.listener(bamListener);
}
delegate = (InternalTaskService) configurator.getTaskService();
}
use of org.kie.internal.runtime.conf.DeploymentDescriptor in project drools by kiegroup.
the class DeploymentDescriptorIO method fromXml.
/**
* Reads XML data from given input stream and produces valid instance of
* <code>DeploymentDescriptor</code>
* @param inputStream input stream that comes with xml data of the descriptor
* @return instance of the descriptor after deserialization
*/
public static DeploymentDescriptor fromXml(InputStream inputStream) {
try {
Unmarshaller unmarshaller = getContext().createUnmarshaller();
unmarshaller.setSchema(schema);
DeploymentDescriptor descriptor = (DeploymentDescriptor) unmarshaller.unmarshal(inputStream);
return descriptor;
} catch (Exception e) {
throw new RuntimeException("Unable to read deployment descriptor from xml", e);
}
}
Aggregations