Search in sources :

Example 51 with Definitions

use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.

the class GenericServiceTaskTest method marshallServiceTask.

@Test
public void marshallServiceTask() throws Exception {
    Diagram<Graph, Metadata> d = unmarshall(marshaller, BPMN_FILE_PATH);
    DefinitionsConverter definitionsConverter = new DefinitionsConverter(d.getGraph());
    Definitions definitions = definitionsConverter.toDefinitions();
    Process p = (Process) definitions.getRootElements().get(0);
    assertEquals(ServiceTaskImpl.class, p.getFlowElements().stream().filter(e -> e.getId().equals(TASK_ID)).findFirst().get().getClass());
    org.eclipse.bpmn2.ServiceTask flowElement = (org.eclipse.bpmn2.ServiceTask) p.getFlowElements().stream().filter(e -> e.getId().equals(TASK_ID)).findFirst().get();
    assertEquals("Service", flowElement.getName());
    assertEquals("op", flowElement.getOperationRef().getName());
    assertEquals("Java", CustomAttribute.serviceImplementation.of(flowElement).get());
    assertEquals("op", CustomAttribute.serviceOperation.of(flowElement).get());
    assertEquals("hgfhfgh", CustomAttribute.serviceInterface.of(flowElement).get());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Process(org.eclipse.bpmn2.Process) ServiceTaskImpl(org.eclipse.bpmn2.impl.ServiceTaskImpl) Test(org.junit.Test) CustomAttribute(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.CustomAttribute) BPMNDiagramMarshallerBaseTest(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.marshalling.BPMNDiagramMarshallerBaseTest) DefinitionsConverter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsConverter) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Definitions(org.eclipse.bpmn2.Definitions) TestCase.assertEquals(junit.framework.TestCase.assertEquals) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Definitions(org.eclipse.bpmn2.Definitions) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Process(org.eclipse.bpmn2.Process) DefinitionsConverter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsConverter) Test(org.junit.Test) BPMNDiagramMarshallerBaseTest(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.marshalling.BPMNDiagramMarshallerBaseTest)

Aggregations

Definitions (org.eclipse.bpmn2.Definitions)42 Process (org.eclipse.bpmn2.Process)16 Test (org.junit.Test)15 Graph (org.kie.workbench.common.stunner.core.graph.Graph)12 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)11 Before (org.junit.Before)9 IOException (java.io.IOException)8 List (java.util.List)8 DefinitionsConverter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsConverter)8 RootElement (org.eclipse.bpmn2.RootElement)7 BPMNDiagram (org.eclipse.bpmn2.di.BPMNDiagram)6 BusinessProcessFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel)6 DefinitionResolver (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver)6 HashMap (java.util.HashMap)5 Optional (java.util.Optional)5 DataInput (org.eclipse.bpmn2.DataInput)5 XMLResource (org.eclipse.emf.ecore.xmi.XMLResource)5 Definitions (org.kie.dmn.model.v1_1.Definitions)5 TaskFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)5 Path (org.uberfire.backend.vfs.Path)5