4084 error segment of bulk export job poll status is missing (#4085)

* changelog

* Change serialization rules

* Always populate error field even if no errors
This commit is contained in:
Tadgh 2022-09-26 18:16:33 -07:00 committed by GitHub
parent 96b92153f6
commit f06f9dc90a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 4084
jira: SMILE-5220
title: "Previously, the `error` segment of the `$poll-export-status` operation was missing. This has now been added."

View File

@ -89,14 +89,17 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
String expectedOriginalUrl = myClient.getServerBase() + "/$export?_type=Patient"; String expectedOriginalUrl = myClient.getServerBase() + "/$export?_type=Patient";
try (CloseableHttpResponse status = ourHttpClient.execute(statusGet)) { try (CloseableHttpResponse status = ourHttpClient.execute(statusGet)) {
String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(responseContent); ourLog.info(responseContent);
BulkExportResponseJson result = JsonUtil.deserialize(responseContent, BulkExportResponseJson.class); BulkExportResponseJson result = JsonUtil.deserialize(responseContent, BulkExportResponseJson.class);
assertThat(result.getRequest(), is(equalTo(expectedOriginalUrl))); assertThat(result.getRequest(), is(equalTo(expectedOriginalUrl)));
assertThat(result.getRequiresAccessToken(), is(equalTo(true))); assertThat(result.getRequiresAccessToken(), is(equalTo(true)));
assertThat(result.getTransactionTime(), is(notNullValue())); assertThat(result.getTransactionTime(), is(notNullValue()));
assertThat(result.getError(), is(empty()));
assertThat(result.getOutput(), is(not(empty()))); assertThat(result.getOutput(), is(not(empty())));
//We assert specifically on content as the deserialized version will "helpfully" fill in missing fields.
assertThat(responseContent, containsString("\"error\" : [ ]"));
} }
} }
} }

View File

@ -49,8 +49,13 @@ public class BulkExportResponseJson {
private Boolean myRequiresAccessToken; private Boolean myRequiresAccessToken;
@JsonProperty("output") @JsonProperty("output")
private List<Output> myOutput; private List<Output> myOutput;
/*
* Note that we override the include here as ONC regulations require that we actually serialize the empty error array.
*/
@JsonInclude
@JsonProperty("error") @JsonProperty("error")
private List<Output> myError; private List<Output> myError = new ArrayList<>();
@JsonProperty("message") @JsonProperty("message")
private String myMsg; private String myMsg;