Add test, changelog, and implementation (#3981)

This commit is contained in:
Tadgh 2022-09-01 11:00:48 -07:00 committed by GitHub
parent 68c343902a
commit 9fd0addec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
type: fix
issue: 3980
jira: SMILE-5053
title: "A regression was introduced in 6.1.0 which caused bulk export jobs to not default to the correct output format when the `_outputFormat` parameter was omitted.
This behaviour has been fixed, and if omitted, will now default to the only legal value `application/fhir+ndjson`."

View File

@ -175,6 +175,28 @@ public class BulkDataExportProviderTest {
assertTrue(params.getFilters().contains(filter));
}
@Test
public void testOmittingOutputFormatDefaultsToNdjson() throws IOException {
when(myJobRunner.startNewJob(any()))
.thenReturn(createJobStartResponse());
InstantType now = InstantType.now();
Parameters input = new Parameters();
HttpPost post = new HttpPost("http://localhost:" + myPort + "/" + JpaConstants.OPERATION_EXPORT);
post.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RESPOND_ASYNC);
post.setEntity(new ResourceEntity(myCtx, input));
try (CloseableHttpResponse response = myClient.execute(post)) {
assertEquals(202, response.getStatusLine().getStatusCode());
}
BulkExportParameters params = verifyJobStart();
assertEquals(Constants.CT_FHIR_NDJSON, params.getOutputFormat());
}
@Test
public void testSuccessfulInitiateBulkRequest_Get() throws IOException {
when(myJobRunner.startNewJob(any())).thenReturn(createJobStartResponse());

View File

@ -365,7 +365,7 @@ public class BulkDataExportProvider {
}
private BulkDataExportOptions buildBulkDataExportOptions(IPrimitiveType<String> theOutputFormat, IPrimitiveType<String> theType, IPrimitiveType<Date> theSince, List<IPrimitiveType<String>> theTypeFilter, BulkDataExportOptions.ExportStyle theExportStyle) {
String outputFormat = theOutputFormat != null ? theOutputFormat.getValueAsString() : null;
String outputFormat = theOutputFormat != null ? theOutputFormat.getValueAsString() : Constants.CT_FHIR_NDJSON;
Set<String> resourceTypes = null;
if (theType != null) {