From 604b5d2060a5788d915f131d3639ce8ba28ba444 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 25 Feb 2021 19:11:18 -0500 Subject: [PATCH] Fix all broken tests --- ...portGenerateResourceFilesStepListener.java | 6 +++++- .../uhn/fhir/jpa/bulk/job/BulkItemReader.java | 6 +++--- .../job/CreateBulkExportEntityTasklet.java | 6 +++--- .../jpa/bulk/job/GroupBulkItemReader.java | 3 +-- .../jpa/bulk/BulkDataExportSvcImplR4Test.java | 20 ++++++++++++------- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportGenerateResourceFilesStepListener.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportGenerateResourceFilesStepListener.java index 3a3d8fbbd2a..cbd7e651762 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportGenerateResourceFilesStepListener.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportGenerateResourceFilesStepListener.java @@ -48,7 +48,11 @@ public class BulkExportGenerateResourceFilesStepListener implements StepExecutio @Override public ExitStatus afterStep(StepExecution theStepExecution) { if (theStepExecution.getExitStatus().getExitCode().equals(ExitStatus.FAILED.getExitCode())) { - String jobUuid = theStepExecution.getJobExecution().getJobParameters().getString("jobUUID"); + //Try to fetch it from the parameters first, and if it doesn't exist, fetch it from the context. + String jobUuid = theStepExecution.getJobExecution().getJobParameters().getString(BulkExportJobConfig.JOB_UUID_PARAMETER); + if (jobUuid == null) { + jobUuid = theStepExecution.getJobExecution().getExecutionContext().getString(BulkExportJobConfig.JOB_UUID_PARAMETER); + } assert isNotBlank(jobUuid); String exitDescription = theStepExecution.getExitStatus().getExitDescription(); myBulkExportDaoSvc.setJobToStatus(jobUuid, BulkJobStatusEnum.ERROR, exitDescription); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkItemReader.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkItemReader.java index c2e475edf1f..175fb9cd792 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkItemReader.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkItemReader.java @@ -55,13 +55,13 @@ public class BulkItemReader implements ItemReader> { private static final Logger ourLog = Logs.getBatchTroubleshootingLog(); Iterator myPidIterator; - @Value("#{stepExecutionContext['resourceType']}") - private String myResourceType; @Value("#{jobParameters['" + BulkExportJobConfig.READ_CHUNK_PARAMETER + "']}") private Long myReadChunkSize; - @Value("#{jobParameters['"+ BulkExportJobConfig.JOB_UUID_PARAMETER+"']}") + @Value("#{jobExecutionContext['"+ BulkExportJobConfig.JOB_UUID_PARAMETER+"']}") private String myJobUUID; + @Value("#{stepExecutionContext['resourceType']}") + private String myResourceType; @Autowired private IBulkExportJobDao myBulkExportJobDao; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/CreateBulkExportEntityTasklet.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/CreateBulkExportEntityTasklet.java index e956904428e..91df88ef7cf 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/CreateBulkExportEntityTasklet.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/CreateBulkExportEntityTasklet.java @@ -46,8 +46,8 @@ public class CreateBulkExportEntityTasklet implements Tasklet { Map jobParameters = theChunkContext.getStepContext().getJobParameters(); //We can leave early if they provided us with an existing job. - if (jobParameters.containsKey("jobUUID")) { - addUUIDToJobContext(theChunkContext, (String)jobParameters.get("jobUUID")); + if (jobParameters.containsKey(BulkExportJobConfig.JOB_UUID_PARAMETER)) { + addUUIDToJobContext(theChunkContext, (String)jobParameters.get(BulkExportJobConfig.JOB_UUID_PARAMETER)); return RepeatStatus.FINISHED; } else { String resourceTypes = (String)jobParameters.get("resourceTypes"); @@ -79,6 +79,6 @@ public class CreateBulkExportEntityTasklet implements Tasklet { .getStepExecution() .getJobExecution() .getExecutionContext() - .putString("jobUUID", theJobUUID); + .putString(BulkExportJobConfig.JOB_UUID_PARAMETER, theJobUUID); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/GroupBulkItemReader.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/GroupBulkItemReader.java index e6c368f51b7..fdd3bfeff65 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/GroupBulkItemReader.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/GroupBulkItemReader.java @@ -63,10 +63,9 @@ public class GroupBulkItemReader implements ItemReader