Skip to content

Commit

Permalink
Merge pull request Activiti#1071 from motorina0/act-4234
Browse files Browse the repository at this point in the history
ACT-4234 HistoricActivityInstanceQuery search unfinished activities - always zero results
  • Loading branch information
vasiledirla authored Nov 21, 2016
2 parents dff0b4b + 57c4924 commit c1e3612
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ public HistoricActivityInstanceQueryImpl taskAssignee(String assignee) {

public HistoricActivityInstanceQueryImpl finished() {
this.finished = true;
this.unfinished = false;
return this;
}

public HistoricActivityInstanceQueryImpl unfinished() {
this.unfinished = true;
this.finished = false;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.activiti.engine.ActivitiIllegalArgumentException;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricActivityInstanceQuery;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.impl.history.HistoryLevel;
import org.activiti.engine.impl.test.PluggableActivitiTestCase;
Expand Down Expand Up @@ -86,6 +87,21 @@ public void testHistoricActivityInstanceReceive() {
assertNotNull(historicActivityInstance.getStartTime());
}

@Deployment
public void testHistoricActivityInstanceUnfinished() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
assertNotNull(processInstance);

HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery();

long finishedActivityInstanceCount = historicActivityInstanceQuery.finished().count();
assertEquals("The Start event is completed", 1, finishedActivityInstanceCount);

long unfinishedActivityInstanceCount = historicActivityInstanceQuery.unfinished().count();
assertEquals("One active (unfinished) User Task", 1, unfinishedActivityInstanceCount);

}

@Deployment
public void testHistoricActivityInstanceQuery() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("noopProcess");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="Examples">

<process id="oneTaskProcess" name="The One Task Process">

<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" />
<userTask id="theTask" name="my task" />
<sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd" />
<endEvent id="theEnd" />

</process>

</definitions>

0 comments on commit c1e3612

Please sign in to comment.