Skip to content

Commit

Permalink
verified test case and fixed logging
Browse files Browse the repository at this point in the history
issue #217
  • Loading branch information
rsoika committed Oct 23, 2016
1 parent 8395eb3 commit 242559c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,9 @@ public BPMNModel buildModel() throws ModelException {

/**
* This method returns all SourceTask Elements connected to a given eventID.
* The method takes care about loop events and follow up events (later ones
* will be handled by the method addImixsEvent().
* The method takes care about loop events and follow up events. Later ones
* are handled by the method addImixsEvent(). For that reason, the
* result of this method can be also an empty list.
*
* An event can be a shared event so it is possible that more than one
* source tasks are found
Expand Down Expand Up @@ -505,12 +506,9 @@ private List<ItemCollection> findSourceTasks(String eventID) throws ModelExcepti
}
}
}
if (result.size() == 0) {
logger.warning("Imixs BPMN Event '" + eventID + "' has no target task!");
}

logger.fine("Imixs BPMN Event '" + eventID + "' is directly assigend to " + result.size() + " task elements");
return result;

}

/**
Expand Down Expand Up @@ -538,7 +536,6 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod
"Imixs BPMN Event '" + eventName + "' has no source task!");
}


List<SequenceFlow> outFlows = findOutgoingFlows(eventID);
if (outFlows == null || outFlows.size() == 0) {
// invalid model!!
Expand Down Expand Up @@ -902,7 +899,7 @@ public ItemCollection findImixsTargetTask(SequenceFlow flow) {
for (SequenceFlow aflow : refList) {
// recursive call....
ItemCollection aResult = findImixsTargetTask(aflow);
if (aResult!=null) {
if (aResult != null) {
// we got the task!
return aResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.List;

import javax.xml.parsers.ParserConfigurationException;

Expand Down Expand Up @@ -66,41 +67,38 @@ public void testSimple()
// test count of elements
Assert.assertEquals(1, model.findAllTasks().size());

// test task 1000
ItemCollection task = model.getTask(1000);
Assert.assertNotNull(task);
Assert.assertEquals("1.0.0", task.getItemValueString("$ModelVersion"));
Assert.assertEquals("Simple", task.getItemValueString("txtworkflowgroup"));

// test import activity for task 1000.20 (followup)
// test import activity for task 1000.20 (import)
ItemCollection activity = model.getEvent(1000, 20);
Assert.assertNotNull(activity);
Assert.assertEquals("import", activity.getItemValueString("txtname"));

Assert.assertEquals("1", activity.getItemValueString("keyFollowUp"));
Assert.assertTrue("1".equals(activity.getItemValueString("keyFollowUp")));
Assert.assertEquals(30, activity.getItemValueInteger("numNextActivityID"));
Assert.assertEquals(1000, activity.getItemValueInteger("numprocessid"));

// test 1000.30
// test 1000.30 ([followup])
activity = model.getEvent(1000, 30);
Assert.assertNotNull(activity);
Assert.assertEquals("[follow up]", activity.getItemValueString("txtname"));

Assert.assertFalse("1".equals(activity.getItemValueString("keyFollowUp")));
Assert.assertEquals(1000, activity.getItemValueInteger("numprocessID"));
Assert.assertEquals(1000, activity.getItemValueInteger("numprocessid"));

// test 1000.10
// test 1000.10 (save)
activity = model.getEvent(1000, 10);
Assert.assertNotNull(activity);
Assert.assertEquals("Save", activity.getItemValueString("txtname"));

Assert.assertFalse("1".equals(activity.getItemValueString("keyFollowUp")));
Assert.assertEquals(1000, activity.getItemValueInteger("numprocessID"));
Assert.assertEquals(1000, activity.getItemValueInteger("numprocessid"));

}

// Now we test the task 1000
ItemCollection task = model.getTask(1000);
Assert.assertNotNull(task);
Assert.assertEquals("1.0.0", task.getItemValueString("$ModelVersion"));
Assert.assertEquals("Simple", task.getItemValueString("txtworkflowgroup"));
List<ItemCollection> events = model.findAllEventsByTask(1000);
Assert.assertEquals(3, events.size());

}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- origin at X=0.0 Y=0.0 -->
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:ext="http://org.eclipse.bpmn2/ext" xmlns:imixs="http://www.imixs.org/bpmn2" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="Definitions_1" exporter="org.eclipse.bpmn2.modeler.core" exporterVersion="1.3.0.Final-v20160602-2145-B47" targetNamespace="http://www.imixs.org/bpmn2">
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:ext="http://org.eclipse.bpmn2/ext" xmlns:imixs="http://www.imixs.org/bpmn2" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="Definitions_1" exporter="org.eclipse.bpmn2.modeler.core" exporterVersion="1.3.1.Final-v20161006-1425-B58" targetNamespace="http://www.imixs.org/bpmn2">
<bpmn2:extensionElements>
<imixs:item name="txtworkflowmodelversion" type="xs:string">
<imixs:value><![CDATA[1.0.0]]></imixs:value>
Expand Down

0 comments on commit 242559c

Please sign in to comment.