use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallUserTaskAssignees.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallUserTaskAssignees() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNEES);
assertDiagram(diagram, 6);
assertEquals("UserGroups", diagram.getMetadata().getTitle());
UserTaskExecutionSet executionSet = 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;
executionSet = userTask.getExecutionSet();
break;
}
}
}
assertEquals("user,user1", executionSet.getActors().getValue());
assertEquals("admin,kiemgmt", executionSet.getGroupid().getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallEndErrorEvent.
@Test
public void testUnmarshallEndErrorEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDERROR_EVENT);
assertDiagram(diagram, 2);
assertEquals("endErrorEventProcess", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> endEventNode = diagram.getGraph().getNode("_E69BD781-AB7F-45C4-85DA-B1F3BAE5BCCB");
EndErrorEvent endErrorEvent = (EndErrorEvent) endEventNode.getContent().getDefinition();
assertNotNull(endErrorEvent.getGeneral());
assertEquals("MyErrorEventName", endErrorEvent.getGeneral().getName().getValue());
assertEquals("MyErrorEventDocumentation", endErrorEvent.getGeneral().getDocumentation().getValue());
assertNotNull(endErrorEvent.getExecutionSet());
assertNotNull(endErrorEvent.getExecutionSet().getErrorRef());
assertEquals("MyError", endErrorEvent.getExecutionSet().getErrorRef().getValue());
DataIOSet dataIOSet = endErrorEvent.getDataIOSet();
AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
assertEquals("myErrorEventInput:String||||[din]var1->myErrorEventInput", assignmentsInfo.getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallEventDefinitionRef.
@Test
public void testUnmarshallEventDefinitionRef() {
try {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_DEFINITION_REF);
Node<? extends Definition<IntermediateTimerEvent>, ?> intermediateTimerEvent = diagram.getGraph().getNode("FLOWNODE_9e71d692-986c-11e7-40d3-005056844bde");
IntermediateTimerEvent definition = intermediateTimerEvent.getContent().getDefinition();
CancellingTimerEventExecutionSet executionSet = definition.getExecutionSet();
TimerSettings timerSettings = executionSet.getTimerSettings();
} catch (Exception ex) {
fail(ex.getMessage());
}
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallIntermediateErrorEventCatching.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallIntermediateErrorEventCatching() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_ERROR_EVENTCATCHING);
assertDiagram(diagram, 2);
assertEquals("intermediateErrorCatching", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> intermediateEventNode = diagram.getGraph().getNode("80A2A7A9-7C68-408C-BE3B-467562A2C139");
IntermediateErrorEventCatching intermediateErrorEventCatching = (IntermediateErrorEventCatching) intermediateEventNode.getContent().getDefinition();
assertNotNull(intermediateErrorEventCatching.getGeneral());
assertEquals("MyErrorCatchingEvent", intermediateErrorEventCatching.getGeneral().getName().getValue());
assertEquals("MyErrorCatchingEventDocumentation", intermediateErrorEventCatching.getGeneral().getDocumentation().getValue());
assertNotNull(intermediateErrorEventCatching.getExecutionSet());
assertEquals(true, intermediateErrorEventCatching.getExecutionSet().getCancelActivity().getValue());
assertEquals("MyError", intermediateErrorEventCatching.getExecutionSet().getErrorRef().getValue());
DataIOSet dataIOSet = intermediateErrorEventCatching.getDataIOSet();
AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
assertEquals("||theErrorEventOutput:String||[dout]theErrorEventOutput->errorVar", assignmentsInfo.getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallXorGateway.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallXorGateway() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_XORGATEWAY);
assertDiagram(diagram, 7);
assertEquals(diagram.getMetadata().getTitle(), "XORGateway");
Graph graph = diagram.getGraph();
Node<? extends Definition, ?> gatewayNode = graph.getNode("_877EA035-1A14-42E9-8CAA-43E9BF908C70");
ExclusiveGateway xorGateway = (ExclusiveGateway) gatewayNode.getContent().getDefinition();
assertEquals("AgeSplit", xorGateway.getGeneral().getName().getValue());
assertEquals("_5110D608-BDAD-47BF-A3F9-E1DBE43ED7CD", xorGateway.getExecutionSet().getDefaultRoute().getValue());
SequenceFlow sequenceFlow1 = null;
SequenceFlow sequenceFlow2 = null;
List<Edge> outEdges = (List<Edge>) gatewayNode.getOutEdges();
if (outEdges != null) {
for (Edge edge : outEdges) {
if ("_C72E00C3-70DC-4BC9-A08E-761B4263A239".equals(edge.getUUID())) {
sequenceFlow1 = (SequenceFlow) ((ViewConnector) edge.getContent()).getDefinition();
} else if ("_5110D608-BDAD-47BF-A3F9-E1DBE43ED7CD".equals(edge.getUUID())) {
sequenceFlow2 = (SequenceFlow) ((ViewConnector) edge.getContent()).getDefinition();
}
}
}
assertNotNull(sequenceFlow1);
assertEquals("10 and over", sequenceFlow1.getGeneral().getName().getValue());
assertNotNull(sequenceFlow2);
assertEquals("under 10", sequenceFlow2.getGeneral().getName().getValue());
}
Aggregations