Search in sources :

Example 21 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallEndTerminateEvent.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEndTerminateEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDTERMINATEEVENT);
    assertDiagram(diagram, 3);
    assertEquals("endTerminateEvent", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> endNoneEventNode = diagram.getGraph().getNode("_1B379E3E-E4ED-4BD2-AEE8-CD85374CEC78");
    EndTerminateEvent endTerminateEvent = (EndTerminateEvent) endNoneEventNode.getContent().getDefinition();
    assertNotNull(endTerminateEvent.getGeneral());
    assertEquals("MyEndTerminateEvent", endTerminateEvent.getGeneral().getName().getValue());
    assertEquals("MyEndTerminateEventDocumentation", endTerminateEvent.getGeneral().getDocumentation().getValue());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) EndTerminateEvent(org.kie.workbench.common.stunner.bpmn.definition.EndTerminateEvent) Test(org.junit.Test)

Example 22 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallIntermediateMessageEventCatching.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallIntermediateMessageEventCatching() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_MESSAGE_EVENTCATCHING);
    assertDiagram(diagram, 2);
    assertEquals("IntermediateMessageEventCatching", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> intermediateMessageEventCatchingNode = diagram.getGraph().getNode("_BD708E30-CA48-4051-BAEA-BBCB5F396CEE");
    IntermediateMessageEventCatching intermediateMessageEventCatching = (IntermediateMessageEventCatching) intermediateMessageEventCatchingNode.getContent().getDefinition();
    assertNotNull(intermediateMessageEventCatching.getExecutionSet());
    MessageRef messageRef = intermediateMessageEventCatching.getExecutionSet().getMessageRef();
    assertEquals("msgref1", messageRef.getValue());
    DataIOSet dataIOSet = intermediateMessageEventCatching.getDataIOSet();
    AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
    assertEquals("||IntermediateMessageEventCatchingOutputVar1:String||[dout]IntermediateMessageEventCatchingOutputVar1->var1", assignmentsInfo.getValue());
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) Graph(org.kie.workbench.common.stunner.core.graph.Graph) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) IntermediateMessageEventCatching(org.kie.workbench.common.stunner.bpmn.definition.IntermediateMessageEventCatching) Test(org.junit.Test)

Example 23 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallStartMessageEvent.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallStartMessageEvent() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_STARTMESSAGEEVENT);
    assertDiagram(diagram, 2);
    assertEquals("StartMessageEvent", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> startMessageEventNode = diagram.getGraph().getNode("_34C4BBFC-544F-4E23-B17B-547BB48EEB63");
    StartMessageEvent startMessageEvent = (StartMessageEvent) startMessageEventNode.getContent().getDefinition();
    assertNotNull(startMessageEvent.getExecutionSet());
    MessageRef messageRef = startMessageEvent.getExecutionSet().getMessageRef();
    IsInterrupting isInterrupting = startMessageEvent.getExecutionSet().getIsInterrupting();
    assertEquals("msgref", messageRef.getValue());
    assertEquals(true, isInterrupting.getValue());
    DataIOSet dataIOSet = startMessageEvent.getDataIOSet();
    AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
    assertEquals("||StartMessageEventOutputVar1:String||[dout]StartMessageEventOutputVar1->var1", assignmentsInfo.getValue());
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) StartMessageEvent(org.kie.workbench.common.stunner.bpmn.definition.StartMessageEvent) Graph(org.kie.workbench.common.stunner.core.graph.Graph) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) IsInterrupting(org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting) Test(org.junit.Test)

Example 24 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallReusableSubprocess.

@Test
public void testUnmarshallReusableSubprocess() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_REUSABLE_SUBPROCESS);
    ReusableSubprocess reusableSubprocess = null;
    Iterator<Element> it = nodesIterator(diagram);
    while (it.hasNext()) {
        Element element = it.next();
        if (element.getContent() instanceof View) {
            Object oDefinition = ((View) element.getContent()).getDefinition();
            if (oDefinition instanceof ReusableSubprocess) {
                reusableSubprocess = (ReusableSubprocess) oDefinition;
                break;
            }
        }
    }
    assertNotNull(reusableSubprocess);
    assertNotNull(reusableSubprocess.getExecutionSet());
    assertNotNull(reusableSubprocess.getExecutionSet().getCalledElement());
    assertNotNull(reusableSubprocess.getGeneral());
    BPMNGeneralSet generalSet = reusableSubprocess.getGeneral();
    ReusableSubprocessTaskExecutionSet executionSet = reusableSubprocess.getExecutionSet();
    assertNotNull(generalSet);
    assertNotNull(executionSet);
    assertEquals("my subprocess", generalSet.getName().getValue());
    assertEquals("my-called-element", executionSet.getCalledElement().getValue());
    assertEquals(false, executionSet.getIndependent().getValue());
    assertEquals(false, executionSet.getWaitForCompletion().getValue());
    String assignmentsInfo = reusableSubprocess.getDataIOSet().getAssignmentsinfo().getValue();
    assertEquals("|input1:String,input2:Float||output1:String,output2:Float|[din]pv1->input1,[din]pv2->input2,[dout]output1->pv1,[dout]output2->pv2", assignmentsInfo);
    assertEquals("true", reusableSubprocess.getExecutionSet().getIsAsync().getValue().toString());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FlowElement(org.eclipse.bpmn2.FlowElement) RootElement(org.eclipse.bpmn2.RootElement) Element(org.kie.workbench.common.stunner.core.graph.Element) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ReusableSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.ReusableSubprocessTaskExecutionSet) Test(org.junit.Test)

Example 25 with Metadata

use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.

the class BPMNDirectDiagramMarshallerTest method testUnmarshallUserTaskAssignments.

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskAssignments() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS);
    assertDiagram(diagram, 8);
    assertEquals("UserTaskAssignments", diagram.getMetadata().getTitle());
    Node<? extends Definition, ?> selfEvaluationNode = diagram.getGraph().getNode("_6063D302-9D81-4C86-920B-E808A45377C2");
    UserTask selfEvaluationTask = (UserTask) selfEvaluationNode.getContent().getDefinition();
    assertEquals(selfEvaluationTask.getTaskType().getValue(), TaskTypes.USER);
    UserTaskExecutionSet executionSet = selfEvaluationTask.getExecutionSet();
    AssignmentsInfo assignmentsinfo = executionSet.getAssignmentsinfo();
    assertEquals(assignmentsinfo.getValue(), "|reason:com.test.Reason,Comment:Object,Skippable:Object||performance:Object|[din]reason->reason,[dout]performance->performance");
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) UserTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.UserTaskExecutionSet) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) Test(org.junit.Test)

Aggregations

Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)175 Graph (org.kie.workbench.common.stunner.core.graph.Graph)158 Test (org.junit.Test)156 Matchers.anyString (org.mockito.Matchers.anyString)53 View (org.kie.workbench.common.stunner.core.graph.content.view.View)32 AssignmentsInfo (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo)30 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)28 RootElement (org.eclipse.bpmn2.RootElement)28 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)28 Element (org.kie.workbench.common.stunner.core.graph.Element)27 FlowElement (org.eclipse.bpmn2.FlowElement)26 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)16 UserTask (org.kie.workbench.common.stunner.bpmn.definition.UserTask)14 Edge (org.kie.workbench.common.stunner.core.graph.Edge)14 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)11 StartErrorEvent (org.kie.workbench.common.stunner.bpmn.definition.StartErrorEvent)10 MessageRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef)10 StartSignalEvent (org.kie.workbench.common.stunner.bpmn.definition.StartSignalEvent)9 StartTimerEvent (org.kie.workbench.common.stunner.bpmn.definition.StartTimerEvent)9 Node (org.kie.workbench.common.stunner.core.graph.Node)9