Skip to content

Commit 2da3d57

Browse files
punitdarirayanavasileva
authored andcommitted
feat(engine): Tests
related to #4334
1 parent 498ef00 commit 2da3d57

File tree

5 files changed

+52
-3
lines changed

5 files changed

+52
-3
lines changed

engine/src/main/java/org/camunda/bpm/engine/impl/RestartProcessInstancesJobHandler.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
import org.camunda.bpm.engine.impl.persistence.entity.JobEntity;
3232
import org.camunda.bpm.engine.impl.persistence.entity.MessageEntity;
3333
import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
34-
import org.camunda.bpm.engine.impl.util.JsonUtil;
35-
36-
import static org.camunda.bpm.engine.impl.RestartProcessInstancesBatchConfigurationJsonConverter.PROCESS_DEFINITION_ID;
3734

3835
/**
3936
*

engine/src/test/java/org/camunda/bpm/engine/test/api/history/BatchHistoricDecisionInstanceDeletionTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package org.camunda.bpm.engine.test.api.history;
1818

19+
import static org.assertj.core.api.Assertions.assertThat;
1920
import static org.assertj.core.api.Assertions.assertThatThrownBy;
2021
import static org.junit.Assert.assertEquals;
2122
import static org.junit.Assert.assertNotNull;
@@ -147,6 +148,19 @@ public void removeBatches() {
147148
ClockUtil.reset();
148149
}
149150

151+
@Test
152+
public void shouldCreateProcessInstanceRelatedBatchJobsForSingleInvocations(){
153+
// when
154+
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, null);
155+
helper.executeSeedJob(batch);
156+
157+
//then
158+
//Making sure that processInstanceId is set in execution jobs #4205
159+
assertThat(helper.getExecutionJobs(batch))
160+
.extracting("processInstanceId")
161+
.containsExactlyInAnyOrder(decisionInstanceIds.toArray());
162+
}
163+
150164
@Test
151165
public void createBatchDeletionByIds() {
152166
// when

engine/src/test/java/org/camunda/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeTest.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,34 @@ public void shouldSetRemovalTimeForBatch_MultipleInvocationsPerBatchJob() {
420420
assertThat(historicBatches.get(1).getRemovalTime()).isEqualTo(REMOVAL_TIME);
421421
}
422422

423+
@Test
424+
public void shouldCreateProcessInstanceRelatedBatchJobsForSingleInvocations() {
425+
// given
426+
testRule.getProcessEngineConfiguration().setInvocationsPerBatchJob(1);
427+
428+
String processInstanceIdOne = testRule.process().userTask().deploy().start();
429+
String processInstanceIdTwo = testRule.process().userTask().deploy().start();
430+
431+
// when
432+
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
433+
Batch batch = historyService.setRemovalTimeToHistoricProcessInstances()
434+
.absoluteRemovalTime(REMOVAL_TIME)
435+
.byQuery(query)
436+
.executeAsync();
437+
438+
testRule.executeSeedJobs(batch);
439+
440+
// then
441+
//Making sure that processInstanceId is set in execution jobs #4205
442+
List<Job> executionJobs = testRule.getExecutionJobs(batch);
443+
assertThat(executionJobs)
444+
.extracting("processInstanceId")
445+
.containsExactlyInAnyOrder(processInstanceIdOne, processInstanceIdTwo);
446+
447+
// clear
448+
managementService.deleteBatch(batch.getId(), true);
449+
}
450+
423451
@Test
424452
public void shouldSetRemovalTime_SingleInvocationPerBatchJob() {
425453
// given
@@ -2835,6 +2863,9 @@ public void shouldSetExecutionStartTimeInBatchAndHistoryForDecisions() {
28352863
.putValue("temperature", 32)
28362864
.putValue("dayType", "Weekend")
28372865
).evaluate();
2866+
2867+
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
2868+
28382869
Batch batch = historyService.setRemovalTimeToHistoricDecisionInstances()
28392870
.absoluteRemovalTime(CURRENT_DATE)
28402871
.byQuery(historyService.createHistoricDecisionInstanceQuery())
@@ -2851,6 +2882,11 @@ public void shouldSetExecutionStartTimeInBatchAndHistoryForDecisions() {
28512882

28522883
assertThat(batch.getExecutionStartTime()).isEqualToIgnoringMillis(CURRENT_DATE);
28532884
assertThat(historicBatch.getExecutionStartTime()).isEqualToIgnoringMillis(CURRENT_DATE);
2885+
2886+
//Making sure that processInstanceId is set in execution jobs #4205
2887+
assertThat(executionJobs)
2888+
.extracting("processInstanceId")
2889+
.containsExactlyInAnyOrder(query.list().stream().map(HistoricDecisionInstance::getId).toArray());
28542890
}
28552891

28562892
}

engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/CorrelateAllMessageBatchTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ public void shouldCreateProcessInstanceRelatedBatchJobsForSingleInvocations() {
580580
rule.executeSeedJobs(batch);
581581

582582
// then
583+
//Making sure that processInstanceId is set in execution jobs #4205
583584
List<Job> executionJobs = rule.getExecutionJobs(batch);
584585
assertThat(executionJobs)
585586
.extracting("processInstanceId")

engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/SetVariablesBatchTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ public void shouldCreateProcessInstanceRelatedBatchJobsForSingleInvocations() {
685685
rule.executeSeedJobs(batch);
686686

687687
// then
688+
//Making sure that processInstanceId is set in execution jobs #4205
688689
List<Job> executionJobs = rule.getExecutionJobs(batch);
689690
assertThat(executionJobs)
690691
.extracting("processInstanceId")

0 commit comments

Comments
 (0)