コード例 #1
0
 // @Test
 // removing until we start supporting global tasks
 public void testManualTaskUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("manualTask.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   GlobalManualTask task = (GlobalManualTask) definitions.getRootElements().get(0);
   assertEquals("pull a lever", task.getName());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #2
0
 // @Test
 // removing until we start supporting global tasks
 public void testSimpleGlobalTaskUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("oneTask.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   assertTrue(definitions.getRootElements().iterator().next() instanceof GlobalTask);
   GlobalTask task = (GlobalTask) definitions.getRootElements().iterator().next();
   assertEquals("oneTask", task.getName());
   assertEquals("my task doc", task.getDocumentation().iterator().next().getText());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #3
0
 @Test
 public void testEndEventUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("endEvent.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   Process process = getRootProcess(definitions);
   EndEvent g = (EndEvent) process.getFlowElements().get(0);
   assertEquals("end event", g.getName());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #4
0
 @Test
 public void testMessageUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("message.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 2);
   assertTrue(definitions.getRootElements().iterator().next() instanceof Message);
   Message msg = (Message) definitions.getRootElements().iterator().next();
   assertEquals("message", msg.getName());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #5
0
 @Test
 public void testDataStoreUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("dataStore.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   assertTrue(definitions.getRootElements().iterator().next() instanceof DataStore);
   DataStore da = (DataStore) definitions.getRootElements().iterator().next();
   assertEquals("data store", da.getName());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #6
0
 @Test
 public void testSimpleDefinitionsUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("empty.json"), "").getContents().get(0));
   assertEquals("my doc", definitions.getDocumentation().iterator().next().getText());
   assertEquals("http://www.w3.org/1999/XPath", definitions.getExpressionLanguage());
   assertEquals("http://www.omg.org/bpmn20", definitions.getTargetNamespace());
   assertEquals("http://www.w3.org/2001/XMLSchema", definitions.getTypeLanguage());
   assertTrue(definitions.getRootElements().isEmpty());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #7
0
 @Test
 public void testDataObjectUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("dataObject.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 2);
   Process process = getRootProcess(definitions);
   assertTrue(process.getFlowElements().iterator().next() instanceof DataObject);
   DataObject da = (DataObject) process.getFlowElements().iterator().next();
   assertEquals("data object", da.getName());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #8
0
 // @Test
 // removing until we start supporting global tasks
 public void testScriptTaskUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("scriptTask.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   GlobalScriptTask task = (GlobalScriptTask) definitions.getRootElements().get(0);
   assertEquals("my script", task.getName());
   assertEquals(
       "git status | grep modified | awk '{print $3}' | xargs echo | xargs git add",
       task.getScript());
   assertEquals("bash", task.getScriptLanguage());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #9
0
 @Test
 public void testPoolUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("pool.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   assertTrue(definitions.getRootElements().get(0) instanceof Process);
   Process process = getRootProcess(definitions);
   assertEquals("pool", process.getName());
   assertEquals(ProcessType.PRIVATE, process.getProcessType());
   assertTrue(process.isIsClosed());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #10
0
 @Test
 public void testLaneUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("pool.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   assertTrue(definitions.getRootElements().get(0) instanceof Process);
   Process process = getRootProcess(definitions);
   assertTrue(process.getLaneSets().size() == 1);
   assertTrue(process.getLaneSets().get(0).getLanes().size() == 1);
   Lane l = process.getLaneSets().get(0).getLanes().get(0);
   assertEquals("my first lane", l.getName());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #11
0
 @Test
 public void testIntermediateThrowSignalUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller
               .unmarshall(getTestJsonFile("intermediateThrowSignalEvent.json"), "")
               .getContents()
               .get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   Process process = getRootProcess(definitions);
   ThrowEvent g = (ThrowEvent) process.getFlowElements().get(0);
   assertEquals("throw signal event", g.getName());
   assertTrue(g.getEventDefinitions().iterator().next() instanceof SignalEventDefinition);
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #12
0
 @Test
 public void testSimpleChainUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller
               .unmarshall(getTestJsonFile("startEvent-task-endEvent.json"), "")
               .getContents()
               .get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   Process process = getRootProcess(definitions);
   assertTrue(process.getFlowElements().size() == 5);
   assertTrue(process.getLaneSets().size() == 1);
   assertTrue(process.getLaneSets().get(0).getLanes().size() == 1);
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #13
0
 /**
  * @Test this test needs to be revised (the json) public void testGroupUnmarshalling() throws
  * Exception { Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller(); Definitions
  * definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("group.json"),
  * "").getContents().get(0)); assertTrue(definitions.getRootElements().size() == 1); Process
  * process = getRootProcess(definitions); assertTrue(process.getArtifacts().iterator().next()
  * instanceof Group); definitions.eResource().save(System.out, Collections.emptyMap()); }*
  */
 @Test
 public void testTextAnnotationUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller
               .unmarshall(getTestJsonFile("textAnnotation.json"), "")
               .getContents()
               .get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   Process process = getRootProcess(definitions);
   assertTrue(process.getArtifacts().iterator().next() instanceof TextAnnotation);
   TextAnnotation ta = (TextAnnotation) process.getArtifacts().iterator().next();
   assertEquals("text annotation", ta.getText());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #14
0
 @Test
 public void testStartParallelMultipleEventUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller
               .unmarshall(getTestJsonFile("startParallelMultipleEvent.json"), "")
               .getContents()
               .get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   Process process = getRootProcess(definitions);
   StartEvent g = (StartEvent) process.getFlowElements().get(0);
   assertEquals("start parallel multiple event", g.getName());
   // TODO multiple event definitions ???
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #15
0
 @Test
 public void testAssociationUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("association.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   Process process = getRootProcess(definitions);
   Task g = (Task) process.getFlowElements().get(0);
   assertEquals("task", g.getName());
   TextAnnotation textA = (TextAnnotation) process.getArtifacts().get(0);
   Association association = (Association) process.getArtifacts().get(1);
   assertEquals(g, association.getSourceRef());
   assertEquals(textA, association.getTargetRef());
   assertEquals(AssociationDirection.NONE, association.getAssociationDirection());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }
コード例 #16
0
 @Test
 public void testSequenceFlowUnmarshalling() throws Exception {
   Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
   Definitions definitions =
       ((Definitions)
           unmarshaller.unmarshall(getTestJsonFile("sequenceFlow.json"), "").getContents().get(0));
   assertTrue(definitions.getRootElements().size() == 1);
   Process process = getRootProcess(definitions);
   assertTrue(process.getFlowElements().get(0) instanceof Task);
   Task task = (Task) process.getFlowElements().get(0);
   assertEquals("task1", task.getName());
   Task task2 = (Task) process.getFlowElements().get(1);
   assertEquals("task2", task2.getName());
   SequenceFlow flow = (SequenceFlow) process.getFlowElements().get(2);
   assertEquals("seqFlow", flow.getName());
   assertEquals(task, flow.getSourceRef());
   assertEquals(task2, flow.getTargetRef());
   definitions.eResource().save(System.out, Collections.emptyMap());
 }