Search in sources :

Example 66 with DeploymentDescriptor

use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.

the class DeploymentDescriptorTest method testWriteDeploymentDescriptorXml.

@Test
public void testWriteDeploymentDescriptorXml() {
    DeploymentDescriptor descriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
    descriptor.getBuilder().addMarshalingStrategy(new ObjectModel("org.jbpm.testCustomStrategy", new Object[] { new ObjectModel("java.lang.String", new Object[] { "param1" }), "param2" })).addRequiredRole("experts");
    String deploymentDescriptorXml = descriptor.toXml();
    assertNotNull(deploymentDescriptorXml);
    logger.info(deploymentDescriptorXml);
    ByteArrayInputStream stream = new ByteArrayInputStream(deploymentDescriptorXml.getBytes());
    DeploymentDescriptor fromXml = DeploymentDescriptorIO.fromXml(stream);
    assertNotNull(fromXml);
    assertEquals("org.jbpm.domain", fromXml.getPersistenceUnit());
    assertEquals("org.jbpm.domain", fromXml.getAuditPersistenceUnit());
    assertEquals(AuditMode.JPA, fromXml.getAuditMode());
    assertEquals(PersistenceMode.JPA, fromXml.getPersistenceMode());
    assertEquals(RuntimeStrategy.SINGLETON, fromXml.getRuntimeStrategy());
    assertEquals(1, fromXml.getMarshallingStrategies().size());
    assertEquals(0, fromXml.getConfiguration().size());
    assertEquals(0, fromXml.getEnvironmentEntries().size());
    assertEquals(0, fromXml.getEventListeners().size());
    assertEquals(0, fromXml.getGlobals().size());
    assertEquals(0, fromXml.getTaskEventListeners().size());
    assertEquals(0, fromXml.getWorkItemHandlers().size());
    assertEquals(1, fromXml.getRequiredRoles().size());
}
Also used : ObjectModel(org.kie.internal.runtime.conf.ObjectModel) NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) ByteArrayInputStream(java.io.ByteArrayInputStream) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) Test(org.junit.Test)

Example 67 with DeploymentDescriptor

use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.

the class DeploymentDescriptorTest method testReadDeploymentDescriptorFromXml.

@Test
public void testReadDeploymentDescriptorFromXml() throws Exception {
    InputStream input = this.getClass().getResourceAsStream("/deployment/deployment-descriptor-defaults.xml");
    DeploymentDescriptor descriptor = DeploymentDescriptorIO.fromXml(input);
    assertNotNull(descriptor);
    assertEquals("org.jbpm.domain", descriptor.getPersistenceUnit());
    assertEquals("org.jbpm.domain", descriptor.getAuditPersistenceUnit());
    assertEquals(AuditMode.JPA, descriptor.getAuditMode());
    assertEquals(PersistenceMode.JPA, descriptor.getPersistenceMode());
    assertEquals(RuntimeStrategy.SINGLETON, descriptor.getRuntimeStrategy());
    assertEquals(0, descriptor.getMarshallingStrategies().size());
    assertEquals(0, descriptor.getConfiguration().size());
    assertEquals(0, descriptor.getEnvironmentEntries().size());
    assertEquals(0, descriptor.getEventListeners().size());
    assertEquals(0, descriptor.getGlobals().size());
    assertEquals(0, descriptor.getTaskEventListeners().size());
    assertEquals(0, descriptor.getWorkItemHandlers().size());
    assertEquals(0, descriptor.getRequiredRoles().size());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) Test(org.junit.Test)

Example 68 with DeploymentDescriptor

use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.

the class DeploymentDescriptorTest method testReadDeploymentDescriptorMSFromXml.

@Test
public void testReadDeploymentDescriptorMSFromXml() throws Exception {
    InputStream input = this.getClass().getResourceAsStream("/deployment/deployment-descriptor-defaults-and-ms.xml");
    DeploymentDescriptor descriptor = DeploymentDescriptorIO.fromXml(input);
    assertNotNull(descriptor);
    assertEquals("org.jbpm.domain", descriptor.getPersistenceUnit());
    assertEquals("org.jbpm.domain", descriptor.getAuditPersistenceUnit());
    assertEquals(AuditMode.JPA, descriptor.getAuditMode());
    assertEquals(PersistenceMode.JPA, descriptor.getPersistenceMode());
    assertEquals(RuntimeStrategy.SINGLETON, descriptor.getRuntimeStrategy());
    assertEquals(1, descriptor.getMarshallingStrategies().size());
    assertEquals(0, descriptor.getConfiguration().size());
    assertEquals(0, descriptor.getEnvironmentEntries().size());
    assertEquals(0, descriptor.getEventListeners().size());
    assertEquals(0, descriptor.getGlobals().size());
    assertEquals(0, descriptor.getTaskEventListeners().size());
    assertEquals(0, descriptor.getWorkItemHandlers().size());
    assertEquals(1, descriptor.getRequiredRoles().size());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) Test(org.junit.Test)

Example 69 with DeploymentDescriptor

use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.

the class DeploymentDescriptorTest method testPrintDescriptor.

@Test
public void testPrintDescriptor() {
    DeploymentDescriptor descriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
    descriptor.getBuilder().addWorkItemHandler(new NamedObjectModel("mvel", "Log", "new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler()")).addWorkItemHandler(new NamedObjectModel("mvel", "WebService", "new org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler(ksession)")).addWorkItemHandler(new NamedObjectModel("mvel", "Rest", "new org.jbpm.process.workitem.rest.RESTWorkItemHandler()")).addWorkItemHandler(new NamedObjectModel("mvel", "Service Task", "new org.jbpm.process.workitem.bpmn2.ServiceTaskHandler(ksession)"));
    logger.debug(descriptor.toXml());
}
Also used : NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) Test(org.junit.Test)

Example 70 with DeploymentDescriptor

use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.

the class DeploymentDescriptorTest method testWriteDeploymentDescriptorXmlWithDuplicateNamedObjects.

@Test
public void testWriteDeploymentDescriptorXmlWithDuplicateNamedObjects() {
    DeploymentDescriptor descriptor = new DeploymentDescriptorImpl("org.jbpm.domain");
    descriptor.getBuilder().addWorkItemHandler(new NamedObjectModel("mvel", "Log", "new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler()")).addWorkItemHandler(new NamedObjectModel("mvel", "Log", "new org.jbpm.process.instance.impl.demo.CustomSystemOutWorkItemHandler()")).addRequiredRole("experts");
    String deploymentDescriptorXml = descriptor.toXml();
    assertNotNull(deploymentDescriptorXml);
    logger.info(deploymentDescriptorXml);
    ByteArrayInputStream stream = new ByteArrayInputStream(deploymentDescriptorXml.getBytes());
    DeploymentDescriptor fromXml = DeploymentDescriptorIO.fromXml(stream);
    assertNotNull(fromXml);
    assertEquals("org.jbpm.domain", fromXml.getPersistenceUnit());
    assertEquals("org.jbpm.domain", fromXml.getAuditPersistenceUnit());
    assertEquals(AuditMode.JPA, fromXml.getAuditMode());
    assertEquals(PersistenceMode.JPA, fromXml.getPersistenceMode());
    assertEquals(RuntimeStrategy.SINGLETON, fromXml.getRuntimeStrategy());
    assertEquals(0, fromXml.getMarshallingStrategies().size());
    assertEquals(0, fromXml.getConfiguration().size());
    assertEquals(0, fromXml.getEnvironmentEntries().size());
    assertEquals(0, fromXml.getEventListeners().size());
    assertEquals(0, fromXml.getGlobals().size());
    assertEquals(0, fromXml.getTaskEventListeners().size());
    assertEquals(1, fromXml.getWorkItemHandlers().size());
    assertEquals(1, fromXml.getRequiredRoles().size());
}
Also used : NamedObjectModel(org.kie.internal.runtime.conf.NamedObjectModel) ByteArrayInputStream(java.io.ByteArrayInputStream) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) Test(org.junit.Test)

Aggregations

DeploymentDescriptor (org.kie.internal.runtime.conf.DeploymentDescriptor)78 Test (org.junit.Test)39 NamedObjectModel (org.kie.internal.runtime.conf.NamedObjectModel)30 HashMap (java.util.HashMap)27 DeploymentDescriptorImpl (org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorImpl)26 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)23 ObjectModel (org.kie.internal.runtime.conf.ObjectModel)23 KieServices (org.kie.api.KieServices)22 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)21 ReleaseId (org.kie.api.builder.ReleaseId)21 ArrayList (java.util.ArrayList)18 File (java.io.File)13 KieMavenRepository (org.kie.scanner.KieMavenRepository)12 FileOutputStream (java.io.FileOutputStream)11 KieMavenRepository.getKieMavenRepository (org.kie.scanner.KieMavenRepository.getKieMavenRepository)11 DeployedUnit (org.jbpm.services.api.model.DeployedUnit)10 ByteArrayInputStream (java.io.ByteArrayInputStream)9 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)9 InternalRuntimeManager (org.kie.internal.runtime.manager.InternalRuntimeManager)8 DeploymentDescriptorManager (org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorManager)6