Skip to content

Commit

Permalink
refactoring junit tests for engine
Browse files Browse the repository at this point in the history
issue #381
  • Loading branch information
rsoika committed Jun 5, 2018
1 parent d39c3a3 commit 7ba1ffe
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testDeprecatedModelVersion() {
ItemCollection workitem = database.get("W0000-00001");
workitem.replaceItemValue(WorkflowKernel.MODELVERSION,"0.9.0");
workitem.replaceItemValue(WorkflowKernel.PROCESSID,100);
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID,10);
workitem.setEventID(10);
workitem.replaceItemValue("txtWorkflowGroup","Ticket");

Model amodel=null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ public void testConditionalEvent1()

// test none condition ...
workitem.replaceItemValue(WorkflowKernel.PROCESSID, 1000);
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 10);
workitem.setEventID(10);
workitem = wse.processWorkItem(workitem);
Assert.assertEquals("1.0.0", workitem.getItemValueString("$ModelVersion"));
Assert.assertEquals(1000, workitem.getProcessID());

// test _budget<100
workitem.replaceItemValue(WorkflowKernel.PROCESSID, 1000);
workitem.replaceItemValue("_budget", 99);
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 10);
workitem.setEventID(10);
workitem = wse.simulationService.processWorkItem(workitem, null);
Assert.assertEquals(1200, workitem.getProcessID());

// test _budget>100
workitem.replaceItemValue(WorkflowKernel.PROCESSID, 1000);
workitem.replaceItemValue("_budget", 9999);
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 10);
workitem.setEventID(10);
workitem = wse.simulationService.processWorkItem(workitem, null);
Assert.assertEquals(1100, workitem.getProcessID());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ public void testConditionalEvent1()

// test none condition ...
workitem.replaceItemValue(WorkflowKernel.PROCESSID, 1000);
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 10);
workitem.setEventID(10);
workitem = workflowMockEnvironment.workflowService.processWorkItem(workitem);
Assert.assertEquals("1.0.0", workitem.getItemValueString("$ModelVersion"));
Assert.assertEquals(1000, workitem.getProcessID());

// test _budget<100
workitem.replaceItemValue(WorkflowKernel.PROCESSID, 1000);
workitem.replaceItemValue("_budget", 99);
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 10);
workitem.setEventID(10);
workitem = workflowMockEnvironment.workflowService.processWorkItem(workitem);
Assert.assertEquals(1200, workitem.getProcessID());

// test _budget>100
workitem.replaceItemValue(WorkflowKernel.PROCESSID, 1000);
workitem.replaceItemValue("_budget", 9999);
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 10);
workitem.setEventID(10);
workitem = workflowMockEnvironment.workflowService.processWorkItem(workitem);
Assert.assertEquals(1100, workitem.getProcessID());

Expand Down Expand Up @@ -103,7 +103,7 @@ public void testSplitEvent1()
// test none condition ...
workitem.replaceItemValue("_subject", "Hello");
workitem.replaceItemValue(WorkflowKernel.PROCESSID, 1000);
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 10);
workitem.setEventID(10);
workitem = workflowMockEnvironment.workflowService.processWorkItem(workitem);
Assert.assertEquals("1.0.0", workitem.getItemValueString("$ModelVersion"));
Assert.assertEquals(1100, workitem.getProcessID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ protected void createTestDatabase() {
entity.replaceItemValue("txtName", "Workitem " + i);
entity.replaceItemValue("$ModelVersion", "1.0.0");
entity.replaceItemValue("$ProcessID", 100);
entity.replaceItemValue("$ActivityID", 10);
entity.setEventID(10);
entity.replaceItemValue(DocumentService.ISAUTHOR, true);
database.put(entity.getItemValueString(WorkflowKernel.UNIQUEID), entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void testCondition() throws ModelException {
// case I.

documentContext.replaceItemValue(WorkflowKernel.PROCESSID, 200);
documentContext.replaceItemValue(WorkflowKernel.ACTIVITYID, 20);
documentContext.setEventID(20);
documentContext.replaceItemValue("_budget", 50);
try {
documentContext = workflowMockEnvironment.processWorkItem(documentContext);
Expand All @@ -209,7 +209,7 @@ public void testCondition() throws ModelException {
// case II.

documentContext.replaceItemValue(WorkflowKernel.PROCESSID, 200);
documentContext.replaceItemValue(WorkflowKernel.ACTIVITYID, 20);
documentContext.setEventID(20);
documentContext.replaceItemValue("_budget", 570);
try {
documentContext = workflowMockEnvironment.processWorkItem(documentContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,19 @@ public void testProcessTypeAttriubteComplex()
workitem.replaceItemValue(WorkflowKernel.PROCESSID, 100);

// case 1 - no type attribute
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 10);
workitem.setEventID(10);
workitem = workflowMockEnvironment.processWorkItem(workitem);
Assert.assertEquals(100, workitem.getProcessID());
Assert.assertEquals("", workitem.getType());

// case 2 - workitem
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 20);
workitem.setEventID(20);
workitem = workflowMockEnvironment.processWorkItem(workitem);
Assert.assertEquals(200, workitem.getProcessID());
Assert.assertEquals("workitem", workitem.getType());

// case 3 - workitemdeleted
workitem.replaceItemValue(WorkflowKernel.ACTIVITYID, 30);
workitem.setEventID(30);
workitem = workflowMockEnvironment.processWorkItem(workitem);
Assert.assertEquals(200, workitem.getProcessID());
Assert.assertEquals("workitemdeleted", workitem.getType());
Expand Down

0 comments on commit 7ba1ffe

Please sign in to comment.