use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallEndNoneEvent.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEndNoneEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ENDNONEEVENT);
assertDiagram(diagram, 3);
assertEquals("endNoneEvent", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> endNoneEventNode = diagram.getGraph().getNode("_9DF2C9D3-15DF-4436-B6C6-85B58B8696B6");
EndNoneEvent endNoneEvent = (EndNoneEvent) endNoneEventNode.getContent().getDefinition();
assertNotNull(endNoneEvent.getGeneral());
assertEquals("MyEndNoneEvent", endNoneEvent.getGeneral().getName().getValue());
assertEquals("MyEndNoneEventDocumentation", endNoneEvent.getGeneral().getDocumentation().getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallAddHocSubprocess.
@Test
public void testUnmarshallAddHocSubprocess() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_ADHOC_SUBPROCESS);
AdHocSubprocess adHocSubprocess = 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 AdHocSubprocess) {
adHocSubprocess = (AdHocSubprocess) oDefinition;
break;
}
}
}
assertNotNull(adHocSubprocess);
BPMNGeneralSet generalSet = adHocSubprocess.getGeneral();
AdHocSubprocessTaskExecutionSet executionSet = adHocSubprocess.getExecutionSet();
ProcessData processData = adHocSubprocess.getProcessData();
assertNotNull(generalSet);
assertNotNull(executionSet);
assertNotNull(processData);
assertEquals("AdHocSubprocess1", generalSet.getName().getValue());
assertEquals("AdHocSubprocess1Documentation", generalSet.getDocumentation().getValue());
assertNotNull(executionSet.getAdHocCompletionCondition());
assertNotNull(executionSet.getAdHocCompletionCondition().getValue());
assertNotNull(executionSet.getAdHocOrdering());
assertNotNull(executionSet.getOnEntryAction());
assertNotNull(executionSet.getOnExitAction());
assertEquals("autocomplete", executionSet.getAdHocCompletionCondition().getValue().getScript());
assertEquals("drools", executionSet.getAdHocCompletionCondition().getValue().getLanguage());
assertEquals("Sequential", executionSet.getAdHocOrdering().getValue());
assertEquals(1, executionSet.getOnEntryAction().getValue().getValues().size());
assertEquals("System.out.println(\"onEntryAction\");", executionSet.getOnEntryAction().getValue().getValues().get(0).getScript());
assertEquals("mvel", executionSet.getOnEntryAction().getValue().getValues().get(0).getLanguage());
assertEquals(1, executionSet.getOnExitAction().getValue().getValues().size());
assertEquals("System.out.println(\"onExitAction\");", executionSet.getOnExitAction().getValue().getValues().get(0).getScript());
assertEquals("java", executionSet.getOnExitAction().getValue().getValues().get(0).getLanguage());
assertEquals("subProcessVar1:String,subProcessVar2:String", processData.getProcessVariables().getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallStartErrorEvent.
@Test
public void testUnmarshallStartErrorEvent() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_STARTERROREVENT);
assertDiagram(diagram, 3);
assertEquals("startErrorEventProcess", diagram.getMetadata().getTitle());
Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("3BD5BBC8-F1C7-45DE-8BDF-A06D8464A61B");
StartErrorEvent startErrorEvent = (StartErrorEvent) startEventNode.getContent().getDefinition();
assertNotNull(startErrorEvent.getGeneral());
assertEquals("MyStartErrorEvent", startErrorEvent.getGeneral().getName().getValue());
assertEquals("MyStartErrorEventDocumentation", startErrorEvent.getGeneral().getDocumentation().getValue());
assertNotNull(startErrorEvent.getExecutionSet());
assertNotNull(startErrorEvent.getExecutionSet().getErrorRef());
assertEquals("MyError", startErrorEvent.getExecutionSet().getErrorRef().getValue());
DataIOSet dataIOSet = startErrorEvent.getDataIOSet();
AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo();
assertEquals("||errorOutput_:String||[dout]errorOutput_->var1", assignmentsInfo.getValue());
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class MigrationDiagramMarshallerTest method testUnmarshallOldStuff.
@Test
public void testUnmarshallOldStuff() throws Exception {
String[] oldStuff = { BPMN_BASIC, BPMN_EVALUATION, BPMN_LANES, BPMN_BOUNDARY_EVENTS, BPMN_NOT_BOUNDARY_EVENTS, BPMN_PROCESSVARIABLES, BPMN_USERTASKASSIGNMENTS, BPMN_BUSINESSRULETASKASSIGNMENTS, BPMN_STARTNONEEVENT, BPMN_STARTTIMEREVENT, BPMN_STARTSIGNALEVENT, BPMN_STARTMESSAGEEVENT, BPMN_STARTERROREVENT, BPMN_INTERMEDIATE_SIGNAL_EVENTCATCHING, BPMN_INTERMEDIATE_ERROR_EVENTCATCHING, BPMN_INTERMEDIATE_SIGNAL_EVENTTHROWING, BPMN_INTERMEDIATE_MESSAGE_EVENTCATCHING, BPMN_INTERMEDIATE_MESSAGE_EVENTTHROWING, BPMN_INTERMEDIATE_TIMER_EVENT, BPMN_ENDSIGNALEVENT, BPMN_ENDMESSAGEEVENT, BPMN_ENDNONEEVENT, BPMN_ENDTERMINATEEVENT, BPMN_PROCESSPROPERTIES, BPMN_BUSINESSRULETASKRULEFLOWGROUP, BPMN_REUSABLE_SUBPROCESS, BPMN_SCRIPTTASK, BPMN_USERTASKASSIGNEES, BPMN_USERTASKPROPERTIES, BPMN_SEQUENCEFLOW, BPMN_XORGATEWAY, BPMN_TIMER_EVENT, BPMN_SIMULATIONPROPERTIES, BPMN_MAGNETDOCKERS, BPMN_MAGNETSINLANE, BPMN_ENDERROR_EVENT };
Diagram<Graph, Metadata> oldDiagram;
Diagram<Graph, Metadata> newDiagram;
for (String fileName : oldStuff) {
oldDiagram = Unmarshalling.unmarshall(oldMarshaller, fileName);
newDiagram = Unmarshalling.unmarshall(newMarshaller, fileName);
// Doesn't work, due to old Marshaller and new Marshaller have different BPMNDefinitionSet uuids
// assertEquals(oldDiagram.getGraph(), newDiagram.getGraph());
// Let's check nodes only.
assertDiagramEquals(oldDiagram, newDiagram, fileName);
}
}
use of org.kie.workbench.common.stunner.core.diagram.Metadata in project kie-wb-common by kiegroup.
the class Unmarshalling method unmarshall.
public static Diagram<Graph, Metadata> unmarshall(DiagramMarshaller tested, InputStream is) throws Exception {
Metadata metadata = new MetadataImpl.MetadataImplBuilder(BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class)).build();
DiagramImpl diagram = new DiagramImpl(UUID.uuid(), metadata);
Graph<DefinitionSet, Node> graph = tested.unmarshall(metadata, is);
diagram.setGraph(graph);
return diagram;
}
Aggregations