Search in sources :

Example 6 with ServiceTask

use of org.eclipse.bpmn2.ServiceTask 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

ServiceTask (org.eclipse.bpmn2.ServiceTask)4 Entry (java.util.Map.Entry)3 Interface (org.eclipse.bpmn2.Interface)3 Operation (org.eclipse.bpmn2.Operation)3 RootElement (org.eclipse.bpmn2.RootElement)3 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)3 Definitions (org.eclipse.bpmn2.Definitions)2 FlowElement (org.eclipse.bpmn2.FlowElement)2 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)2 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)2 Message (org.eclipse.bpmn2.Message)2 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)2 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)2 Test (org.junit.Test)2 BPMNDiagramMarshallerBaseTest (org.kie.workbench.common.stunner.bpmn.backend.service.diagram.marshalling.BPMNDiagramMarshallerBaseTest)2 ScriptTypeListValue (org.kie.workbench.common.stunner.bpmn.definition.property.task.ScriptTypeListValue)2 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)2 Graph (org.kie.workbench.common.stunner.core.graph.Graph)2 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1