Skip to content

Commit

Permalink
Issue #2513 - address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Schroeder <mschroed@us.ibm.com>
  • Loading branch information
michaelwschroeder committed Nov 9, 2021
1 parent 6649a77 commit 9ecfc64
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void loadBundle1() throws Exception {
String resource = "Bundle-uscore-mo3.json";
WebTarget target = getWebTarget();

// re-purposing search result bundle - update fields to create valid request bundle
Bundle bundle = USCoreExamplesUtil.readLocalJSONResource("311", resource);
List<Bundle.Entry> entries = bundle.getEntry();
List<Bundle.Entry> output = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void loadResources() throws Exception {
String resource = "Bundle-66c8856b-ba11-4876-8aa8-467aad8c11a2.json";
WebTarget target = getWebTarget();

// re-purposing search result bundle - update fields to create valid request bundle
Bundle bundle = USCoreExamplesUtil.readLocalJSONResource("311", resource);
List<Bundle.Entry> entries = bundle.getEntry();
List<Bundle.Entry> output = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void loadBundle1() throws Exception {
String resource = "Bundle-uscore-mo3.json";
WebTarget target = getWebTarget();

// re-purposing search result bundle - update fields to create valid request bundle
Bundle bundle = USCoreExamplesUtil.readLocalJSONResource("400", resource);
List<Bundle.Entry> entries = bundle.getEntry();
List<Bundle.Entry> output = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void loadResources() throws Exception {
String resource = "Bundle-66c8856b-ba11-4876-8aa8-467aad8c11a2.json";
WebTarget target = getWebTarget();

// re-purposing search result bundle - update fields to create valid request bundle
Bundle bundle = USCoreExamplesUtil.readLocalJSONResource("400", resource);
List<Bundle.Entry> entries = bundle.getEntry();
List<Bundle.Entry> output = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ private Map<Integer, Entry> validateBundle(Bundle bundle) throws Exception {

// Verify that the fullUrl field is not a version specific reference
// (Bundle constraint bdl-8) and that the fullUrl field + resource.meta.versionId
// is unique for 'batch' or 'transaction' type bundles (Bundle constraint bdl-7) Resource resource = requestEntry.getResource();
// is unique for 'batch' or 'transaction' type bundles (Bundle constraint bdl-7)
Resource resource = requestEntry.getResource();
if (fullUrl != null) {
if (fullUrl.contains("/_history/")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

import java.util.List;

import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.ibm.fhir.config.FHIRConfiguration;
import com.ibm.fhir.config.FHIRRequestContext;
import com.ibm.fhir.core.HTTPReturnPreference;
import com.ibm.fhir.exception.FHIRException;
Expand All @@ -41,7 +39,6 @@
import com.ibm.fhir.model.type.code.NarrativeStatus;
import com.ibm.fhir.model.type.code.SearchEntryMode;
import com.ibm.fhir.persistence.FHIRPersistence;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.util.FHIRRestHelper;

public class BundleValidationTest {
Expand All @@ -51,19 +48,10 @@ public class BundleValidationTest {

@BeforeClass
void setup() throws FHIRException {
FHIRConfiguration.setConfigHome("src/test/resources");
FHIRRequestContext.get().setTenantId("default");
FHIRRegistry.getInstance().addProvider(new MockRegistryResourceProvider());
persistence = new MockPersistenceImpl();
helper = new FHIRRestHelper(persistence);
}

@AfterClass
void tearDown() throws FHIRException {
FHIRConfiguration.setConfigHome("");
FHIRRequestContext.get().setTenantId("default");
}

/**
* Test no bundle.
*/
Expand Down Expand Up @@ -618,7 +606,6 @@ public void testMultipleErrors() throws Exception {
helper.doBundle(requestBundle, false);
fail();
} catch (FHIROperationException e) {
// Validate results
// Validate results
List<Issue> issues = e.getIssues();
assertEquals(issues.size(), 3);
Expand Down

0 comments on commit 9ecfc64

Please sign in to comment.