Skip to content

Commit 69f79f8

Browse files
issue 3058 touchstone conformance fix for response bundle entry id (#3060)
* issue 3058 touchstone conformance fix for response bundle entry id Signed-off-by: Robin Arnold <robin.arnold@ibm.com> * issue 3058 fix fhir-server unit test for new delete response Signed-off-by: Robin Arnold <robin.arnold@ibm.com> * fix another test ReindexOperationPhase2Test.verifyFoundBySearch was using the entry id that we removed. It should be using the resource id instead. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com> Co-authored-by: Lee Surprenant <lmsurpre@us.ibm.com>
1 parent 62707c3 commit 69f79f8

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

fhir-server-spi/src/main/java/com/ibm/fhir/server/spi/operation/FHIRResourceHelpers.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ FHIRRestOperationResponse doPatch(String type, String id, FHIRPatch patch, Strin
273273
* the resource type associated with the Resource to be deleted
274274
* @param id
275275
* the id of the Resource to be deleted
276+
* @param searchQueryString
277+
* a search query associated with a conditional delete request (mutually exclusive with id)
276278
* @return a FHIRRestOperationResponse that contains the results of the operation
277279
* @throws Exception
278280
*/

fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationPhase2Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private void verifyFoundBySearch(String code, String id, String value) {
216216
assertEquals(response.getStatus(), Status.OK.getStatusCode());
217217
Bundle bundle = response.readEntity(Bundle.class);
218218
assertFalse(bundle.getEntry().isEmpty());
219-
assertEquals(bundle.getEntry().get(0).getId(), id);
219+
assertEquals(bundle.getEntry().get(0).getResource().getId(), id);
220220
}
221221

222222
@Test(groups = {"reindex"}, dependsOnMethods = {})

fhir-server/src/main/java/com/ibm/fhir/server/util/FHIRRestHelper.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -864,18 +864,6 @@ private void checkIdAndMeta(Resource resource) throws FHIRPersistenceException {
864864
}
865865
}
866866

867-
/**
868-
* Performs a 'delete' operation on the specified resource.
869-
*
870-
* @param type
871-
* the resource type associated with the Resource to be deleted
872-
* @param id
873-
* the id of the Resource to be deleted
874-
* @param requestProperties
875-
* additional request properties which supplement the HTTP headers associated with this request
876-
* @return a FHIRRestOperationResponse that contains the results of the operation
877-
* @throws Exception
878-
*/
879867
@Override
880868
public FHIRRestOperationResponse doDelete(String type, String id, String searchQueryString) throws Exception {
881869
log.entering(this.getClass().getName(), "doDelete");
@@ -1012,7 +1000,7 @@ public FHIRRestOperationResponse doDelete(String type, String id, String searchQ
10121000
.details(CodeableConcept.builder()
10131001
.text(string("Deleted " + responseBundle.getEntry().size() + " " + type + " resource(s) " +
10141002
"with the following id(s): " +
1015-
responseBundle.getEntry().stream().map(Bundle.Entry::getId).collect(Collectors.joining(","))))
1003+
responseBundle.getEntry().stream().map(e -> e.getResource().getId()).collect(Collectors.joining(","))))
10161004
.build())
10171005
.build());
10181006

@@ -2116,7 +2104,7 @@ Bundle createSearchResponseBundle(List<Resource> resources, FHIRSearchContext se
21162104
Entry.Builder entryBuilder = Entry.builder();
21172105
if (resource != null) {
21182106
if (resource.getId() != null) {
2119-
entryBuilder.id(resource.getId());
2107+
// do not set the entryBuilder.id value for response bundle
21202108
entryBuilder.fullUrl(Uri.of(getRequestBaseUri(type) + "/" + resource.getClass().getSimpleName() + "/" + resource.getId()));
21212109
} else {
21222110
String msg = "A resource with no id was found.";

fhir-server/src/test/java/com/ibm/fhir/server/test/InteractionValidationConfigTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,8 +1414,8 @@ public void testDeleteValidSpecificResourceType() throws Exception {
14141414
FHIRRestOperationResponse response = helper.doDelete("Patient", "1", null);
14151415
List<Issue> issues = response.getOperationOutcome().getIssue();
14161416
assertEquals(issues.size(), 1);
1417-
assertEquals("Deleted 1 Patient resource(s) with the following id(s): 1",
1418-
issues.get(0).getDetails().getText().getValue());
1417+
assertEquals(issues.get(0).getDetails().getText().getValue(),
1418+
"Deleted 1 Patient resource(s) with the following id(s): test");
14191419
assertEquals(IssueSeverity.INFORMATION, issues.get(0).getSeverity());
14201420
assertEquals(IssueType.INFORMATIONAL, issues.get(0).getCode());
14211421
} catch (FHIROperationException e) {
@@ -1437,8 +1437,8 @@ public void testDeleteValidGenericResourceType() throws Exception {
14371437
FHIRRestOperationResponse response = helper.doDelete("Encounter", "1", null);
14381438
List<Issue> issues = response.getOperationOutcome().getIssue();
14391439
assertEquals(issues.size(), 1);
1440-
assertEquals("Deleted 1 Encounter resource(s) with the following id(s): 1",
1441-
issues.get(0).getDetails().getText().getValue());
1440+
assertEquals(issues.get(0).getDetails().getText().getValue(),
1441+
"Deleted 1 Encounter resource(s) with the following id(s): test");
14421442
assertEquals(IssueSeverity.INFORMATION, issues.get(0).getSeverity());
14431443
assertEquals(IssueType.INFORMATIONAL, issues.get(0).getCode());
14441444
} catch (FHIROperationException e) {
@@ -1460,10 +1460,9 @@ public void testDeleteValidAnyResourceType() throws Exception {
14601460
FHIRRestOperationResponse response = helper.doDelete("Encounter", "1", null);
14611461
List<Issue> issues = response.getOperationOutcome().getIssue();
14621462
assertEquals(issues.size(), 1);
1463-
assertEquals("Deleted 1 Encounter resource(s) with the following id(s): 1",
1464-
issues.get(0).getDetails().getText().getValue());
1465-
assertEquals(IssueSeverity.INFORMATION, issues.get(0).getSeverity());
1466-
assertEquals(IssueType.INFORMATIONAL, issues.get(0).getCode());
1463+
assertEquals(issues.get(0).getDetails().getText().getValue(), "Deleted 1 Encounter resource(s) with the following id(s): test");
1464+
assertEquals(issues.get(0).getSeverity(), IssueSeverity.INFORMATION);
1465+
assertEquals(issues.get(0).getCode(), IssueType.INFORMATIONAL);
14671466
} catch (FHIROperationException e) {
14681467
fail();
14691468
}

0 commit comments

Comments
 (0)