Skip to content

Commit

Permalink
cleanup smells
Browse files Browse the repository at this point in the history
  • Loading branch information
mboskamp committed Sep 20, 2024
1 parent ee8b680 commit fe8f455
Showing 1 changed file with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.camunda.bpm.engine.history.HistoricProcessInstanceQuery;
import org.camunda.bpm.engine.impl.batch.BatchMonitorJobHandler;
import org.camunda.bpm.engine.impl.batch.BatchSeedJobHandler;
import org.camunda.bpm.engine.impl.persistence.entity.JobEntity;
import org.camunda.bpm.engine.migration.MigrationPlan;
import org.camunda.bpm.engine.repository.ProcessDefinition;
import org.camunda.bpm.engine.runtime.ActivityInstance;
Expand Down Expand Up @@ -230,7 +229,7 @@ public void shouldSetBatchIdOnJobAndJobLog_DeleteHistoricProcessInstances() {
.startEvent()
.endEvent()
.done());
ProcessInstance process = runtimeService.startProcessInstanceByKey("process");
runtimeService.startProcessInstanceByKey("process");

HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery()
.processDefinitionKey("process");
Expand Down Expand Up @@ -392,7 +391,7 @@ public void shouldSetBatchIdOnJobAndJobLog_SetExternalTaskRetries() {
public void shouldSetBatchIdOnJobAndJobLog_SetJobRetries() {
// given
testRule.deploy(getTimerProcess());
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
runtimeService.startProcessInstanceByKey("process");

Job timerJob = managementService.createJobQuery().singleResult();

Expand Down Expand Up @@ -428,7 +427,7 @@ public void shouldSetBatchIdOnJobAndJobLog_UpdateProcessInstancesSuspendState()
public void shouldNotSetBatchIdOnJobOrJobLog_nonBatchJob() {
// given
testRule.deploy(getTimerProcess());
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
runtimeService.startProcessInstanceByKey("process");

Job timerJob = managementService.createJobQuery().singleResult();

Expand All @@ -443,22 +442,10 @@ public void shouldNotSetBatchIdOnJobOrJobLog_nonBatchJob() {

// HELPER

private JobEntity getSeedJob(Batch batch) {
return (JobEntity) managementService.createJobQuery().jobDefinitionId(batch.getSeedJobDefinitionId()).singleResult();
}

private JobEntity getMonitorJob(Batch batch) {
return (JobEntity) managementService.createJobQuery().jobDefinitionId(batch.getMonitorJobDefinitionId()).singleResult();
}

private List<JobEntity> getExecutionJobs(Batch batch) {
return (List<JobEntity>)(List<?>) managementService.createJobQuery().jobDefinitionId(batch.getBatchJobDefinitionId()).list();
}

private void assertProcessedJobs(Batch batch, Map<String, List<Job>> processedJobs) {
assertThat(processedJobs.get(batchRule.SEED_JOB)).extracting("batchId").containsOnly(batch.getId());
assertThat(processedJobs.get(batchRule.EXECUTION_JOBS)).extracting("batchId").containsOnly(batch.getId());
assertThat(processedJobs.get(batchRule.MONITOR_JOB)).extracting("batchId").containsOnly(batch.getId());
assertThat(processedJobs.get(BatchRule.SEED_JOB)).extracting("batchId").containsOnly(batch.getId());
assertThat(processedJobs.get(BatchRule.EXECUTION_JOBS)).extracting("batchId").containsOnly(batch.getId());
assertThat(processedJobs.get(BatchRule.MONITOR_JOB)).extracting("batchId").containsOnly(batch.getId());
}

private void assertHistoricJobLogs(Batch batch, String expectedBatchType) {
Expand Down

0 comments on commit fe8f455

Please sign in to comment.