use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallEndMessageEvent.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEndMessageEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDMESSAGEEVENT);
assertDiagram(diagram, 2);
assertEquals("EndMessageEvent", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> endMessageEventNode = diagram.getGraph().getNode("_4A8A0A9E-D4A5-4B6E-94A6-20817A57B3C6");
EndMessageEvent endMessageEvent = (EndMessageEvent) endMessageEventNode.getContent().getDefinition();
assertNotNull(endMessageEvent.getExecutionSet());
MessageRef messageRef = endMessageEvent.getExecutionSet().getMessageRef();
assertEquals("msgref", messageRef.getValue());
DataIOSet dataIOSet = endMessageEvent.getDataIOSet();
AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
assertEquals("EndMessageEventInputVar1:String||||[din]var1->EndMessageEventInputVar1", assignmentsInfo.getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallIsInterruptingStartErrorEvent.
@Test
public void testUnmarshallIsInterruptingStartErrorEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_SUBPROCESS_STARTERROREVENT);
assertDiagram(diagram, 7);
assertEquals("EventSubprocessStartErrorEvent", diagram.getMetadata().getTitle());
// Check first start event with all FILLED properties
Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("9ABD5C04-C6E2-4DF3-829F-ADB283330AD6");
StartErrorEvent startErrorEvent = (StartErrorEvent) startEventNode.getContent().getDefinition();
BPMNGeneralSet eventGeneralSet = startErrorEvent.getGeneral();
assertNotNull(eventGeneralSet);
assertEquals("StartErrorEvent", eventGeneralSet.getName().getValue());
assertEquals("Some not empty\nDocumentation\n~`!@#$%^&*()_+=-{}|[]\\:\";'<>/?.,", eventGeneralSet.getDocumentation().getValue());
InterruptingErrorEventExecutionSet eventExecutionSet = startErrorEvent.getExecutionSet();
assertNotNull(eventExecutionSet);
assertNotNull(eventExecutionSet.getErrorRef());
assertEquals("Error1", eventExecutionSet.getErrorRef().getValue());
assertEquals(true, eventExecutionSet.getIsInterrupting().getValue());
DataIOSet eventDataIOSet = startErrorEvent.getDataIOSet();
AssignmentsInfo assignmentsInfo = eventDataIOSet.getAssignmentsinfo();
assertEquals("||Var1:String||[dout]Var1->Var1", assignmentsInfo.getValue());
// Check second start event with all EMPTY properties
Node<? extends Definition, ?> emptyEventNode = diagram.getGraph().getNode("50B93E5E-C05D-40DD-BF48-2B6AE919763E");
StartErrorEvent emptyErrorEvent = (StartErrorEvent) emptyEventNode.getContent().getDefinition();
BPMNGeneralSet emptyEventGeneralSet = emptyErrorEvent.getGeneral();
assertNotNull(emptyEventGeneralSet);
assertEquals("", emptyEventGeneralSet.getName().getValue());
assertEquals("", emptyEventGeneralSet.getDocumentation().getValue());
InterruptingErrorEventExecutionSet emptyExecutionSet = emptyErrorEvent.getExecutionSet();
assertNotNull(emptyExecutionSet);
assertNotNull(emptyExecutionSet.getErrorRef());
assertEquals("", emptyExecutionSet.getErrorRef().getValue());
assertEquals(false, emptyExecutionSet.getIsInterrupting().getValue());
DataIOSet emptyDataIOSet = emptyErrorEvent.getDataIOSet();
AssignmentsInfo emptyAssignmentsInfo = emptyDataIOSet.getAssignmentsinfo();
assertEquals("", emptyAssignmentsInfo.getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallIntermediateMessageEventThrowing.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallIntermediateMessageEventThrowing() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_MESSAGE_EVENTTHROWING);
assertDiagram(diagram, 2);
assertEquals("IntermediateMessageEventThrowing", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> intermediateMessageEventThrowingNode = diagram.getGraph().getNode("_85823DF6-02A0-4B8D-AE7A-61641A3A2E4B");
IntermediateMessageEventThrowing intermediateMessageEventThrowing = (IntermediateMessageEventThrowing) intermediateMessageEventThrowingNode.getContent().getDefinition();
assertNotNull(intermediateMessageEventThrowing.getExecutionSet());
MessageRef messageRef = intermediateMessageEventThrowing.getExecutionSet().getMessageRef();
assertEquals("msgref", messageRef.getValue());
DataIOSet dataIOSet = intermediateMessageEventThrowing.getDataIOSet();
AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
assertEquals("IntermediateMessageEventThrowingInputVar1:String||||[din]var1->IntermediateMessageEventThrowingInputVar1", assignmentsInfo.getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallUserTaskProperties.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskProperties() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKPROPERTIES);
assertDiagram(diagram, 4);
assertEquals("MyBP", diagram.getMetadata().getTitle());
UserTaskExecutionSet userTaskExecutionSet = 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 UserTask) {
UserTask userTask = (UserTask) oDefinition;
userTaskExecutionSet = userTask.getExecutionSet();
break;
}
}
}
assertEquals("MyUserTask", userTaskExecutionSet.getTaskName().getValue());
assertEquals("true", userTaskExecutionSet.getIsAsync().getValue().toString());
assertEquals("false", userTaskExecutionSet.getSkippable().getValue().toString());
assertEquals("my subject", userTaskExecutionSet.getSubject().getValue());
assertEquals("admin", userTaskExecutionSet.getCreatedBy().getValue());
assertEquals("my description", userTaskExecutionSet.getDescription().getValue());
assertEquals("3", userTaskExecutionSet.getPriority().getValue());
assertEquals("true", userTaskExecutionSet.getAdHocAutostart().getValue().toString());
assertEquals("System.out.println(\"Hello\");", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getScript());
assertEquals("java", userTaskExecutionSet.getOnEntryAction().getValue().getValues().get(0).getLanguage());
assertEquals("System.out.println(\"Bye\");", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getScript());
assertEquals("java", userTaskExecutionSet.getOnExitAction().getValue().getValues().get(0).getLanguage());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallIntermediateTimerEvent.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallIntermediateTimerEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_TIMER_EVENT);
assertDiagram(diagram, 2);
assertEquals("intermediateTimer", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> intermediateEventNode = diagram.getGraph().getNode("_8D881072-284F-4F0D-8CF2-AD1F4540FC4E");
IntermediateTimerEvent intermediateTimerEvent = (IntermediateTimerEvent) intermediateEventNode.getContent().getDefinition();
assertNotNull(intermediateTimerEvent.getGeneral());
assertEquals("MyTimer", intermediateTimerEvent.getGeneral().getName().getValue());
assertNotNull(intermediateTimerEvent.getExecutionSet());
assertEquals("abc", intermediateTimerEvent.getExecutionSet().getTimerSettings().getValue().getTimeCycle());
assertEquals("none", intermediateTimerEvent.getExecutionSet().getTimerSettings().getValue().getTimeCycleLanguage());
assertEquals("abc", intermediateTimerEvent.getExecutionSet().getTimerSettings().getValue().getTimeDate());
assertEquals("abc", intermediateTimerEvent.getExecutionSet().getTimerSettings().getValue().getTimeDuration());
}
Aggregations