Search in sources :

Example 6 with ServiceTask

use of org.kie.workbench.common.stunner.bpmn.workitem.ServiceTask in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest method testUnmarshallWorkItems.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallWorkItems() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_SERVICE_TASKS);
    assertDiagram(diagram, 5);
    // Email service task assertions.
    Node<? extends Definition, ?> emailNode = diagram.getGraph().getNode("_277CE006-5E6E-4960-A68C-CC8A5347C33F");
    assertTrue(emailNode.getContent().getDefinition() instanceof ServiceTask);
    ServiceTask email = (ServiceTask) emailNode.getContent().getDefinition();
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getName(), email.getName());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getCategory(), email.getCategory());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getDefaultHandler(), email.getDefaultHandler());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getDescription(), email.getDescription());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getDisplayName(), email.getGeneral().getName().getValue());
    assertEquals(WorkItemDefinitionMockRegistry.EMAIL.getDocumentation(), email.getGeneral().getDocumentation().getValue());
    // Log service task assertions.
    Node<? extends Definition, ?> logNode = diagram.getGraph().getNode("_A940748F-A658-4FB8-84FD-B69F4B7A9205");
    assertTrue(logNode.getContent().getDefinition() instanceof ServiceTask);
    ServiceTask log = (ServiceTask) logNode.getContent().getDefinition();
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getName(), log.getName());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getCategory(), log.getCategory());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getDefaultHandler(), log.getDefaultHandler());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getDescription(), log.getDescription());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getDisplayName(), log.getGeneral().getName().getValue());
    assertEquals(WorkItemDefinitionMockRegistry.LOG.getDocumentation(), log.getGeneral().getDocumentation().getValue());
}
Also used : ServiceTask(org.kie.workbench.common.stunner.bpmn.workitem.ServiceTask) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Aggregations

ServiceTask (org.kie.workbench.common.stunner.bpmn.workitem.ServiceTask)6 Before (org.junit.Before)3 WorkItemDefinition (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition)3 Consumer (java.util.function.Consumer)2 Function (java.util.function.Function)2 Test (org.junit.Test)2 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)2 Lane (org.kie.workbench.common.stunner.bpmn.definition.Lane)2 NoneTask (org.kie.workbench.common.stunner.bpmn.definition.NoneTask)2 SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)2 StartNoneEvent (org.kie.workbench.common.stunner.bpmn.definition.StartNoneEvent)2 WorkItemDefinitionRegistry (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionRegistry)2 DefinitionManager (org.kie.workbench.common.stunner.core.api.DefinitionManager)2 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)2 DefaultPaletteDefinition (org.kie.workbench.common.stunner.core.client.components.palette.DefaultPaletteDefinition)2 GwtMockitoTestRunner (com.google.gwtmockito.GwtMockitoTestRunner)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1