-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix get historic process instance api orquery for mutiple statues and… #4515
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -623,6 +623,106 @@ public void shouldReturnHistoricProcInstWithProcessDefinitionNameOrProcessDefini | |
assertEquals(2, processInstances.size()); | ||
} | ||
|
||
@Test | ||
public void shouldReturnHistoricProcInstWithMultipleStates() { | ||
// given | ||
BpmnModelInstance aProcessDefinition = Bpmn.createExecutableProcess("aProcessDefinition") | ||
.name("process1") | ||
.startEvent() | ||
.userTask() | ||
.endEvent() | ||
.done(); | ||
|
||
String deploymentId = repositoryService | ||
.createDeployment() | ||
.addModelInstance("foo.bpmn", aProcessDefinition) | ||
.deploy() | ||
.getId(); | ||
|
||
deploymentIds.add(deploymentId); | ||
|
||
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("aProcessDefinition"); | ||
|
||
BpmnModelInstance anotherProcessDefinition = Bpmn.createExecutableProcess("anotherProcessDefinition") | ||
.startEvent() | ||
.userTask() | ||
.endEvent() | ||
.done(); | ||
|
||
deploymentId = repositoryService | ||
.createDeployment() | ||
.addModelInstance("foo.bpmn", anotherProcessDefinition) | ||
.deploy() | ||
.getId(); | ||
|
||
deploymentIds.add(deploymentId); | ||
|
||
runtimeService.startProcessInstanceByKey("anotherProcessDefinition"); | ||
runtimeService.updateProcessInstanceSuspensionState() | ||
.byProcessInstanceId(processInstance1.getId()).suspend(); | ||
|
||
// when | ||
List<HistoricProcessInstance> processInstances = historyService.createHistoricProcessInstanceQuery() | ||
.or() | ||
.active() | ||
.suspended() | ||
.endOr() | ||
.list(); | ||
|
||
// then | ||
assertEquals(2, processInstances.size()); | ||
} | ||
|
||
@Test | ||
public void shouldReturnHistoricProcInstWithMatchingState() { | ||
// given | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the whole |
||
BpmnModelInstance aProcessDefinition = Bpmn.createExecutableProcess("aProcessDefinition") | ||
.name("process1") | ||
.startEvent() | ||
.userTask() | ||
.endEvent() | ||
.done(); | ||
|
||
String deploymentId = repositoryService | ||
.createDeployment() | ||
.addModelInstance("foo.bpmn", aProcessDefinition) | ||
.deploy() | ||
.getId(); | ||
|
||
deploymentIds.add(deploymentId); | ||
|
||
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("aProcessDefinition"); | ||
|
||
BpmnModelInstance anotherProcessDefinition = Bpmn.createExecutableProcess("anotherProcessDefinition") | ||
.startEvent() | ||
.userTask() | ||
.endEvent() | ||
.done(); | ||
|
||
deploymentId = repositoryService | ||
.createDeployment() | ||
.addModelInstance("foo.bpmn", anotherProcessDefinition) | ||
.deploy() | ||
.getId(); | ||
|
||
deploymentIds.add(deploymentId); | ||
|
||
runtimeService.startProcessInstanceByKey("anotherProcessDefinition"); | ||
runtimeService.updateProcessInstanceSuspensionState() | ||
.byProcessInstanceId(processInstance1.getId()).suspend(); | ||
|
||
// when | ||
List<HistoricProcessInstance> processInstances = historyService.createHistoricProcessInstanceQuery() | ||
.or() | ||
.active() | ||
.endOr() | ||
.list(); | ||
|
||
// then | ||
assertEquals(1, processInstances.size()); | ||
assertEquals("ACTIVE", processInstances.get(0).getState()); | ||
} | ||
|
||
@Test | ||
public void shouldReturnHistoricProcInstWithBusinessKeyOrBusinessKeyLike() { | ||
// given | ||
|
@@ -817,4 +917,89 @@ public void shouldReturnByProcessDefinitionIdOrIncidentType() { | |
assertThat(processInstances.size()).isEqualTo(2); | ||
} | ||
|
||
@Test | ||
@Deployment(resources={"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) | ||
public void shouldReturnHistoricProcInstWithVarValue1OrVarValue21() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// given | ||
Map<String, Object> vars = new HashMap<String, Object>(); | ||
vars.put("stringVar", "abcdef"); | ||
runtimeService.startProcessInstanceByKey("oneTaskProcess", vars); | ||
|
||
runtimeService.startProcessInstanceByKey("oneTaskProcess"); | ||
|
||
String processKey = "process"; | ||
deployFailingProcess(processKey); | ||
|
||
vars = new HashMap<String, Object>(); | ||
vars.put("stringVar", "ghijkl"); | ||
runtimeService.startProcessInstanceByKey(processKey, vars); | ||
|
||
String jobId = managementService.createJobQuery().singleResult().getId(); | ||
|
||
managementService.setJobRetries(jobId, 0); | ||
|
||
// when | ||
List<HistoricProcessInstance> processInstances = historyService.createHistoricProcessInstanceQuery() | ||
.withIncidents() | ||
.or() | ||
.variableValueEquals("stringVar", "abcdef") | ||
.variableValueEquals("stringVar", "ghijkl") | ||
.endOr() | ||
.list(); | ||
|
||
// then | ||
assertEquals(1, processInstances.size()); | ||
} | ||
|
||
protected void deployFailingProcess(String processKey) { | ||
BpmnModelInstance aProcessDefinition = Bpmn.createExecutableProcess(processKey) | ||
.startEvent() | ||
.serviceTask() | ||
.camundaClass("org.camunda.bpm.engine.test.jobexecutor.FailingDelegate") | ||
.camundaAsyncBefore() | ||
.endEvent() | ||
.done(); | ||
|
||
String deploymentId = repositoryService | ||
.createDeployment() | ||
.addModelInstance("foo.bpmn", aProcessDefinition) | ||
.deploy() | ||
.getId(); | ||
|
||
deploymentIds.add(deploymentId); | ||
} | ||
|
||
@Test | ||
@Deployment(resources={"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) | ||
public void shouldReturnHistoricProcInstWithVarValue1OrVarValue23() { | ||
// given | ||
Map<String, Object> vars = new HashMap<String, Object>(); | ||
vars.put("stringVar", "abcdef"); | ||
runtimeService.startProcessInstanceByKey("oneTaskProcess", vars); | ||
|
||
runtimeService.startProcessInstanceByKey("oneTaskProcess"); | ||
|
||
String processKey = "process"; | ||
deployFailingProcess(processKey); | ||
|
||
vars = new HashMap<String, Object>(); | ||
vars.put("stringVar", "ghijkl"); | ||
runtimeService.startProcessInstanceByKey(processKey, vars); | ||
|
||
String jobId = managementService.createJobQuery().singleResult().getId(); | ||
|
||
managementService.setJobRetries(jobId, 0); | ||
|
||
// when | ||
List<HistoricProcessInstance> processInstances = historyService.createHistoricProcessInstanceQuery() | ||
.or() | ||
.withIncidents() | ||
.variableValueEquals("stringVar", "abcdef") | ||
.endOr() | ||
.list(); | ||
|
||
// then | ||
assertEquals(1, processInstances.size()); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes related to multiple state handling don't seem to be described or explained in the issue. Only the unexpected behavior of the combination of
withIncidents
andorQueries
is described there. Could you please document this as well?