diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoCompositionDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoCompositionDstu2.java index eabfdf27b53..cfdcd0d28f1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoCompositionDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoCompositionDstu2.java @@ -34,11 +34,8 @@ import javax.servlet.http.HttpServletRequest; public class FhirResourceDaoCompositionDstu2 extends FhirResourceDaoDstu2implements IFhirResourceDaoComposition { - @Autowired - private ISearchParamRegistry mySearchParamRegistry; - @Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { - throw new NotImplementedOperationException("$document in DSTU2 is not implemented "); + throw new NotImplementedOperationException("$document not implemented in DSTU2"); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCompositionDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCompositionDstu3.java index 1329f03b843..f1c719352b5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCompositionDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCompositionDstu3.java @@ -39,9 +39,6 @@ import java.util.Collections; public class FhirResourceDaoCompositionDstu3 extends FhirResourceDaoDstu3 implements IFhirResourceDaoComposition { - @Autowired - private ISearchParamRegistry mySearchParamRegistry; - @Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { SearchParameterMap paramMap = new SearchParameterMap(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java index 6277e1f1412..b9df3416257 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java @@ -41,9 +41,6 @@ import ca.uhn.fhir.rest.param.*; public class FhirResourceDaoPatientDstu3 extends FhirResourceDaoDstu3implements IFhirResourceDaoPatient { - @Autowired - private ISearchParamRegistry mySerarchParamRegistry; - private IBundleProvider doEverythingOperation(IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, RequestDetails theRequestDetails) { SearchParameterMap paramMap = new SearchParameterMap(); if (theCount != null) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCompositionR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCompositionR4.java index dac59427e15..6dbe159ca52 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCompositionR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCompositionR4.java @@ -22,24 +22,37 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoComposition; import ca.uhn.fhir.jpa.dao.ISearchParamRegistry; +import ca.uhn.fhir.jpa.dao.SearchParameterMap; +import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.param.DateRangeParam; +import ca.uhn.fhir.rest.param.StringParam; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.r4.model.Composition; import org.springframework.beans.factory.annotation.Autowired; import javax.servlet.http.HttpServletRequest; +import java.util.Collections; public class FhirResourceDaoCompositionR4 extends FhirResourceDaoR4implements IFhirResourceDaoComposition { - @Autowired - private ISearchParamRegistry mySearchParamRegistry; - @Override public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) { - return null; + SearchParameterMap paramMap = new SearchParameterMap(); + if (theCount != null) { + paramMap.setCount(theCount.getValue()); + } + paramMap.setIncludes(Collections.singleton(IResource.INCLUDE_ALL.asRecursive())); + paramMap.setSort(theSort); + paramMap.setLastUpdated(theLastUpdate); + if (theId != null) { + paramMap.add("_id", new StringParam(theId.getIdPart())); + } + IBundleProvider bundleProvider = search(paramMap); + return bundleProvider; } } + diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java index e439c993258..f88706fac71 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java @@ -41,9 +41,6 @@ import ca.uhn.fhir.rest.param.*; public class FhirResourceDaoPatientR4 extends FhirResourceDaoR4implements IFhirResourceDaoPatient { - @Autowired - private ISearchParamRegistry mySerarchParamRegistry; - private IBundleProvider doEverythingOperation(IIdType theId, IPrimitiveType theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, RequestDetails theRequestDetails) { SearchParameterMap paramMap = new SearchParameterMap(); if (theCount != null) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderCompositionDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderCompositionDstu3.java index b7dc9c99b12..f5623a553ab 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderCompositionDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderCompositionDstu3.java @@ -80,14 +80,7 @@ public class BaseJpaResourceProviderCompositionDstu3 extends JpaResourceProvider boolean foundCompositionResource = false; Bundle bundle = new Bundle().setType(Bundle.BundleType.DOCUMENT); for (IBaseResource resource : resourceList) { - bundle.addEntry(new Bundle.BundleEntryComponent().setResource((Resource) resource)); - if (((Resource) resource).getResourceType() == ResourceType.Composition) { - if (foundCompositionResource == true) { - OperationOutcome operationOutcome = new OperationOutcome().addIssue(new OperationOutcome.OperationOutcomeIssueComponent().setSeverity(OperationOutcome.IssueSeverity.ERROR).setCode(OperationOutcome.IssueType.PROCESSING)); - throw new InvalidRequestException("$document can only be applied to a single Composition Resource", operationOutcome); - } - foundCompositionResource = true; - } + bundle.addEntry(new Bundle.BundleEntryComponent().setResource((Resource) resource)); } return bundle; } finally { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseJpaResourceProviderCompositionR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseJpaResourceProviderCompositionR4.java index 53e26d3c75d..b5ff5272c1e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseJpaResourceProviderCompositionR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseJpaResourceProviderCompositionR4.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.jpa.dao.IFhirResourceDaoComposition; -import ca.uhn.fhir.jpa.provider.dstu3.JpaResourceProviderDstu3; import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.valueset.BundleTypeEnum; import ca.uhn.fhir.rest.annotation.IdParam; @@ -14,9 +13,10 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.param.DateRangeParam; import org.hl7.fhir.instance.model.api.IBaseBundle; -import org.hl7.fhir.r4.model.Composition; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.UnsignedIntType; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.*; + +import java.util.List; /* @@ -43,36 +43,44 @@ public class BaseJpaResourceProviderCompositionR4 extends JpaResourceProviderR4< /** * Composition/123/$document + * * @param theRequestDetails */ //@formatter:off - @Operation(name = "document", idempotent = true, bundleType=BundleTypeEnum.SEARCHSET) + @Operation(name = "document", idempotent = true, bundleType=BundleTypeEnum.DOCUMENT) public IBaseBundle getDocumentForComposition( javax.servlet.http.HttpServletRequest theServletRequest, @IdParam IdType theId, - - @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") + + @Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.") @OperationParam(name = Constants.PARAM_COUNT) UnsignedIntType theCount, - + @Description(shortDefinition="Only return resources which were last updated as specified by the given range") - @OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1) + @OperationParam(name = Constants.PARAM_LASTUPDATED, min=0, max=1) DateRangeParam theLastUpdated, @Sort - SortSpec theSortSpec, - + SortSpec theSortSpec, + RequestDetails theRequestDetails ) { //@formatter:on startRequest(theServletRequest); try { - ((IFhirResourceDaoComposition) getDao()).getDocumentForComposition(theServletRequest, theId, theCount, theLastUpdated, theSortSpec, theRequestDetails); - return null; + IBundleProvider bundleProvider = ((IFhirResourceDaoComposition) getDao()).getDocumentForComposition(theServletRequest, theId, theCount, theLastUpdated, theSortSpec, theRequestDetails); + List resourceList = bundleProvider.getResources(0, bundleProvider.size()); + + boolean foundCompositionResource = false; + Bundle bundle = new Bundle().setType(Bundle.BundleType.DOCUMENT); + for (IBaseResource resource : resourceList) { + bundle.addEntry(new Bundle.BundleEntryComponent().setResource((Resource) resource)); + } + return bundle; } finally { endRequest(theServletRequest); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/CompositionDocumentDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/CompositionDocumentDstu3Test.java index b4a1f7feccc..5d0269999b1 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/CompositionDocumentDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/CompositionDocumentDstu3Test.java @@ -93,14 +93,10 @@ public class CompositionDocumentDstu3Test extends BaseResourceProviderDstu3Test composition.addSection().addEntry(new Reference(obsId)); } compId = ourClient.create().resource(composition).execute().getId().toUnqualifiedVersionless().getValue(); - - Composition composition2 = new Composition(); - composition.setSubject(new Reference(patId)); } @Test public void testDocumentBundleReturnedCorrect() throws IOException { - // myDaoConfig.setEverythingIncludesFetchPageSize(1); String theUrl = ourServerBase + "/" + compId + "/$document?_format=json"; Bundle bundle = fetchBundle(theUrl, EncodingEnum.JSON); @@ -123,16 +119,11 @@ public class CompositionDocumentDstu3Test extends BaseResourceProviderDstu3Test private Bundle fetchBundle(String theUrl, EncodingEnum theEncoding) throws IOException, ClientProtocolException { Bundle bundle; HttpGet get = new HttpGet(theUrl); - CloseableHttpResponse resp = ourHttpClient.execute(get); - try { - // assertEquals(theEncoding.getResourceContentTypeNonLegacy(), resp.getFirstHeader(ca.uhn.fhir.rest.api.Constants.HEADER_CONTENT_TYPE).getValue().replaceAll(";.*", "")); - String resourceString = IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8); - System.out.println(resourceString); - bundle = theEncoding.newParser(myFhirCtx).parseResource(Bundle.class, resourceString); - } finally { - IOUtils.closeQuietly(resp); - } + try (CloseableHttpResponse resp = ourHttpClient.execute(get)) { + String resourceString = IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8); + bundle = theEncoding.newParser(myFhirCtx).parseResource(Bundle.class, resourceString); + } return bundle; } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java index bf31760e130..7b3830cd9d2 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java @@ -47,11 +47,11 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource public void testBlockUpdatingPatientUserDoesnNotHaveAccessTo() { Patient pt1 = new Patient(); pt1.setActive(true); - final IIdType pid1 = myClient.create().resource(pt1).execute().getId().toUnqualifiedVersionless(); + final IIdType pid1 = ourClient.create().resource(pt1).execute().getId().toUnqualifiedVersionless(); Patient pt2 = new Patient(); pt2.setActive(false); - final IIdType pid2 = myClient.create().resource(pt2).execute().getId().toUnqualifiedVersionless(); + final IIdType pid2 = ourClient.create().resource(pt2).execute().getId().toUnqualifiedVersionless(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -65,7 +65,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource Observation obs = new Observation(); obs.setStatus(ObservationStatus.FINAL); obs.setSubject(new Reference(pid1)); - IIdType oid = myClient.create().resource(obs).execute().getId().toUnqualified(); + IIdType oid = ourClient.create().resource(obs).execute().getId().toUnqualified(); unregisterInterceptors(); @@ -89,7 +89,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource obs.setSubject(new Reference(pid2)); try { - myClient.update().resource(obs).execute(); + ourClient.update().resource(obs).execute(); fail(); } catch (ForbiddenOperationException e) { // good @@ -103,7 +103,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource Patient patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - final MethodOutcome output1 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); + final MethodOutcome output1 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -121,7 +121,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource patient.setId(output1.getId().toUnqualifiedVersionless()); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - MethodOutcome output2 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); + MethodOutcome output2 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); assertEquals(output1.getId().getIdPart(), output2.getId().getIdPart()); @@ -129,7 +129,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); try { - myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|101").execute(); + ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|101").execute(); fail(); } catch (ForbiddenOperationException e) { assertEquals("HTTP 403 Forbidden: Access denied by default policy (no applicable rules)", e.getMessage()); @@ -140,7 +140,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); try { - myClient.update().resource(patient).execute(); + ourClient.update().resource(patient).execute(); fail(); } catch (ForbiddenOperationException e) { assertEquals("HTTP 403 Forbidden: Access denied by default policy (no applicable rules)", e.getMessage()); @@ -158,17 +158,17 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource patient.setId("Patient/A"); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - IIdType id = myClient.update().resource(patient).execute().getId(); + IIdType id = ourClient.update().resource(patient).execute().getId(); Observation obs = new Observation(); obs.setId("Observation/B"); obs.getSubject().setReference("Patient/A"); - myClient.update().resource(obs).execute(); + ourClient.update().resource(obs).execute(); obs = new Observation(); obs.setId("Observation/C"); obs.setStatus(ObservationStatus.FINAL); - myClient.update().resource(obs).execute(); + ourClient.update().resource(obs).execute(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -181,17 +181,17 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource } }); - myClient.delete().resourceById(new IdType("Observation/B")).execute(); + ourClient.delete().resourceById(new IdType("Observation/B")).execute(); try { - myClient.read().resource(Observation.class).withId("Observation/B").execute(); + ourClient.read().resource(Observation.class).withId("Observation/B").execute(); fail(); } catch (ResourceGoneException e) { // good } try { - myClient.delete().resourceById(new IdType("Observation/C")).execute(); + ourClient.delete().resourceById(new IdType("Observation/C")).execute(); fail(); } catch (ForbiddenOperationException e) { // good @@ -207,16 +207,16 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource Patient patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - final IIdType id = myClient.create().resource(patient).execute().getId(); + final IIdType id = ourClient.create().resource(patient).execute().getId(); Observation obsInCompartment = new Observation(); obsInCompartment.setStatus(ObservationStatus.FINAL); obsInCompartment.getSubject().setReferenceElement(id.toUnqualifiedVersionless()); - IIdType obsInCompartmentId = myClient.create().resource(obsInCompartment).execute().getId().toUnqualifiedVersionless(); + IIdType obsInCompartmentId = ourClient.create().resource(obsInCompartment).execute().getId().toUnqualifiedVersionless(); Observation obsNotInCompartment = new Observation(); obsNotInCompartment.setStatus(ObservationStatus.FINAL); - IIdType obsNotInCompartmentId = myClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless(); + IIdType obsNotInCompartmentId = ourClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -229,10 +229,10 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource } }); - myClient.delete().resourceById(obsInCompartmentId.toUnqualifiedVersionless()).execute(); + ourClient.delete().resourceById(obsInCompartmentId.toUnqualifiedVersionless()).execute(); try { - myClient.delete().resourceById(obsNotInCompartmentId.toUnqualifiedVersionless()).execute(); + ourClient.delete().resourceById(obsNotInCompartmentId.toUnqualifiedVersionless()).execute(); fail(); } catch (ForbiddenOperationException e) { // good @@ -258,16 +258,16 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource Patient patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - IIdType id = myClient.create().resource(patient).execute().getId(); + IIdType id = ourClient.create().resource(patient).execute().getId(); try { - myClient.delete().resourceById(id.toUnqualifiedVersionless()).execute(); + ourClient.delete().resourceById(id.toUnqualifiedVersionless()).execute(); fail(); } catch (ForbiddenOperationException e) { // good } - patient = myClient.read().resource(Patient.class).withId(id.toUnqualifiedVersionless()).execute(); + patient = ourClient.read().resource(Patient.class).withId(id.toUnqualifiedVersionless()).execute(); assertEquals(id.getValue(), patient.getId()); } @@ -371,7 +371,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource o.getSubject().setResource(p); request.addEntry().setResource(o).getRequest().setMethod(Bundle.HTTPVerb.POST); - Bundle resp = myClient.transaction().withBundle(request).execute(); + Bundle resp = ourClient.transaction().withBundle(request).execute(); assertEquals(2, resp.getEntry().size()); @@ -458,7 +458,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource .setMethod(Bundle.HTTPVerb.POST); - Bundle resp = myClient.transaction().withBundle(bundle).execute(); + Bundle resp = ourClient.transaction().withBundle(bundle).execute(); assertEquals(3, resp.getEntry().size()); } @@ -467,21 +467,21 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource public void testPatchWithinCompartment() { Patient pt1 = new Patient(); pt1.setActive(true); - final IIdType pid1 = myClient.create().resource(pt1).execute().getId().toUnqualifiedVersionless(); + final IIdType pid1 = ourClient.create().resource(pt1).execute().getId().toUnqualifiedVersionless(); Observation obs1 = new Observation(); obs1.setStatus(ObservationStatus.FINAL); obs1.setSubject(new Reference(pid1)); - IIdType oid1 = myClient.create().resource(obs1).execute().getId().toUnqualified(); + IIdType oid1 = ourClient.create().resource(obs1).execute().getId().toUnqualified(); Patient pt2 = new Patient(); pt2.setActive(false); - final IIdType pid2 = myClient.create().resource(pt2).execute().getId().toUnqualifiedVersionless(); + final IIdType pid2 = ourClient.create().resource(pt2).execute().getId().toUnqualifiedVersionless(); Observation obs2 = new Observation(); obs2.setStatus(ObservationStatus.FINAL); obs2.setSubject(new Reference(pid2)); - IIdType oid2 = myClient.create().resource(obs2).execute().getId().toUnqualified(); + IIdType oid2 = ourClient.create().resource(obs2).execute().getId().toUnqualified(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -499,18 +499,18 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource " ]"; // Allowed - myClient.patch().withBody(patchBody).withId(oid1).execute(); - obs1 = myClient.read().resource(Observation.class).withId(oid1.toUnqualifiedVersionless()).execute(); + ourClient.patch().withBody(patchBody).withId(oid1).execute(); + obs1 = ourClient.read().resource(Observation.class).withId(oid1.toUnqualifiedVersionless()).execute(); assertEquals(ObservationStatus.AMENDED, obs1.getStatus()); // Denied try { - myClient.patch().withBody(patchBody).withId(oid2).execute(); + ourClient.patch().withBody(patchBody).withId(oid2).execute(); fail(); } catch (ForbiddenOperationException e) { // good } - obs2 = myClient.read().resource(Observation.class).withId(oid2.toUnqualifiedVersionless()).execute(); + obs2 = ourClient.read().resource(Observation.class).withId(oid2.toUnqualifiedVersionless()).execute(); assertEquals(ObservationStatus.FINAL, obs2.getStatus()); } @@ -520,14 +520,14 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource @Test public void testReadingObservationAccessRight() { Practitioner practitioner1 = new Practitioner(); - final IIdType practitionerId1 = myClient.create().resource(practitioner1).execute().getId().toUnqualifiedVersionless(); + final IIdType practitionerId1 = ourClient.create().resource(practitioner1).execute().getId().toUnqualifiedVersionless(); Practitioner practitioner2 = new Practitioner(); - final IIdType practitionerId2 = myClient.create().resource(practitioner2).execute().getId().toUnqualifiedVersionless(); + final IIdType practitionerId2 = ourClient.create().resource(practitioner2).execute().getId().toUnqualifiedVersionless(); Patient patient = new Patient(); patient.setActive(true); - final IIdType patientId = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); + final IIdType patientId = ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -553,19 +553,19 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource obs1.setStatus(ObservationStatus.FINAL); obs1.setPerformer( Arrays.asList(new Reference(practitionerId1), new Reference(practitionerId2))); - IIdType oid1 = myClient.create().resource(obs1).execute().getId().toUnqualified(); + IIdType oid1 = ourClient.create().resource(obs1).execute().getId().toUnqualified(); // Observation with practitioner1 and practitioner1 as the Performer -> should have the read access - myClient.read().resource(Observation.class).withId(oid1).execute(); + ourClient.read().resource(Observation.class).withId(oid1).execute(); Observation obs2 = new Observation(); obs2.setStatus(ObservationStatus.FINAL); obs2.setSubject(new Reference(patientId)); - IIdType oid2 = myClient.create().resource(obs2).execute().getId().toUnqualified(); + IIdType oid2 = ourClient.create().resource(obs2).execute().getId().toUnqualified(); // Observation with patient as the subject -> read access should be blocked try { - myClient.read().resource(Observation.class).withId(oid2).execute(); + ourClient.read().resource(Observation.class).withId(oid2).execute(); fail(); } catch (ForbiddenOperationException e) { // good diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java index 91c5aba4e89..6554d92c31a 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java @@ -8,7 +8,6 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.subscription.resthook.SubscriptionRestHookInterceptor; import ca.uhn.fhir.jpa.util.ResourceCountCache; -import ca.uhn.fhir.jpa.util.SingleItemLoadingCache; import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainR4; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.parser.StrictErrorHandler; @@ -44,7 +43,6 @@ import org.springframework.web.servlet.DispatcherServlet; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.concurrent.TimeUnit; import static org.apache.commons.lang3.StringUtils.isNotBlank; @@ -52,7 +50,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test { protected static JpaValidationSupportChainR4 myValidationSupport; - protected IGenericClient myClient; + protected IGenericClient ourClient; protected static CloseableHttpClient ourHttpClient; protected static int ourPort; protected static RestfulServer ourRestServer; @@ -169,9 +167,9 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test { ourRestServer.setPagingProvider(ourPagingProvider); - myClient = myFhirCtx.newRestfulGenericClient(ourServerBase); + ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase); if (shouldLogClient()) { - myClient.registerInterceptor(new LoggingInterceptor()); + ourClient.registerInterceptor(new LoggingInterceptor()); } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/CompositionDocumentR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/CompositionDocumentR4Test.java new file mode 100644 index 00000000000..15278e50b31 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/CompositionDocumentR4Test.java @@ -0,0 +1,143 @@ +package ca.uhn.fhir.jpa.provider.r4; + +import ca.uhn.fhir.jpa.dao.DaoConfig; +import ca.uhn.fhir.parser.StrictErrorHandler; +import ca.uhn.fhir.rest.api.EncodingEnum; +import ca.uhn.fhir.util.TestUtil; +import com.google.common.base.Charsets; +import org.apache.commons.io.IOUtils; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; + +import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.codesystems.EncounterStatus; +import org.hl7.fhir.r4.model.codesystems.ObservationStatus; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasItems; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; + +public class CompositionDocumentR4Test extends BaseResourceProviderR4Test { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CompositionDocumentR4Test.class); + private String orgId; + private String patId; + private List myObsIds; + private String encId; + private String listId; + private String compId; + + @Before + public void beforeDisableResultReuse() { + myDaoConfig.setReuseCachedSearchResultsForMillis(null); + } + + @Override + @After + public void after() throws Exception { + super.after(); + + myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + } + + @Override + public void before() throws Exception { + super.before(); + myFhirCtx.setParserErrorHandler(new StrictErrorHandler()); + + myDaoConfig.setAllowMultipleDelete(true); + + Organization org = new Organization(); + org.setName("an org"); + orgId = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless().getValue(); + ourLog.info("OrgId: {}", orgId); + + Patient patient = new Patient(); + patient.getManagingOrganization().setReference(orgId); + patId = ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless().getValue(); + + Encounter enc = new Encounter(); + enc.setStatus(Encounter.EncounterStatus.ARRIVED); + enc.getSubject().setReference(patId); + enc.getServiceProvider().setReference(orgId); + encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless().getValue(); + + ListResource listResource = new ListResource(); + + ArrayList myObs = new ArrayList<>(); + myObsIds = new ArrayList(); + for (int i = 0; i < 5; i++) { + Observation obs = new Observation(); + obs.getSubject().setReference(patId); + obs.setStatus(Observation.ObservationStatus.FINAL); + String obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue(); + listResource.addEntry(new ListResource.ListEntryComponent().setItem(new Reference(obs))); + myObs.add(obs); + myObsIds.add(obsId); + } + + listId = ourClient.create().resource(listResource).execute().getId().toUnqualifiedVersionless().getValue(); + + Composition composition = new Composition(); + composition.setSubject(new Reference(patId)); + composition.addSection().addEntry(new Reference(patId)); + composition.addSection().addEntry(new Reference(orgId)); + composition.addSection().addEntry(new Reference(encId)); + composition.addSection().addEntry(new Reference(listId)); + + for (String obsId : myObsIds) { + composition.addSection().addEntry(new Reference(obsId)); + } + compId = ourClient.create().resource(composition).execute().getId().toUnqualifiedVersionless().getValue(); + } + + @Test + public void testDocumentBundleReturnedCorrect() throws IOException { + + String theUrl = ourServerBase + "/" + compId + "/$document?_format=json"; + Bundle bundle = fetchBundle(theUrl, EncodingEnum.JSON); + + assertNull(bundle.getLink("next")); + + Set actual = new HashSet<>(); + for (Bundle.BundleEntryComponent nextEntry : bundle.getEntry()) { + actual.add(nextEntry.getResource().getIdElement().toUnqualifiedVersionless().getValue()); + } + + ourLog.info("Found IDs: {}", actual); + assertThat(actual, hasItem(compId)); + assertThat(actual, hasItem(patId)); + assertThat(actual, hasItem(orgId)); + assertThat(actual, hasItem(encId)); + assertThat(actual, hasItem(listId)); + assertThat(actual, hasItems(myObsIds.toArray(new String[0]))); + } + + private Bundle fetchBundle(String theUrl, EncodingEnum theEncoding) throws IOException, ClientProtocolException { + Bundle bundle; + HttpGet get = new HttpGet(theUrl); + + try (CloseableHttpResponse resp = ourHttpClient.execute(get)) { + String resourceString = IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8); + bundle = theEncoding.newParser(myFhirCtx).parseResource(Bundle.class, resourceString); + } + return bundle; + } + + @AfterClass + public static void afterClassClearContext() { + TestUtil.clearAllStaticFieldsForUnitTest(); + } +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java index 7842f99a75d..4524251c522 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java @@ -85,13 +85,13 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { p.addName() .addGiven("GivenOnly1") .addGiven("GivenOnly2"); - myPatientId0 = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + myPatientId0 = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); p = new Patient(); p.addName() .addGiven("GivenOnlyB1") .addGiven("GivenOnlyB2"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java index 37b45783b2b..ba0db38b0e9 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java @@ -57,41 +57,41 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test { Organization org = new Organization(); org.setName("an org"); - orgId = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless().getValue(); + orgId = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless().getValue(); ourLog.info("OrgId: {}", orgId); Patient patient = new Patient(); patient.getManagingOrganization().setReference(orgId); - patId = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless().getValue(); + patId = ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless().getValue(); Patient patient2 = new Patient(); patient2.getManagingOrganization().setReference(orgId); - myWrongPatId = myClient.create().resource(patient2).execute().getId().toUnqualifiedVersionless().getValue(); + myWrongPatId = ourClient.create().resource(patient2).execute().getId().toUnqualifiedVersionless().getValue(); Encounter enc1 = new Encounter(); enc1.setStatus(EncounterStatus.CANCELLED); enc1.getSubject().setReference(patId); enc1.getServiceProvider().setReference(orgId); - encId1 = myClient.create().resource(enc1).execute().getId().toUnqualifiedVersionless().getValue(); + encId1 = ourClient.create().resource(enc1).execute().getId().toUnqualifiedVersionless().getValue(); Encounter enc2 = new Encounter(); enc2.setStatus(EncounterStatus.ARRIVED); enc2.getSubject().setReference(patId); enc2.getServiceProvider().setReference(orgId); - encId2 = myClient.create().resource(enc2).execute().getId().toUnqualifiedVersionless().getValue(); + encId2 = ourClient.create().resource(enc2).execute().getId().toUnqualifiedVersionless().getValue(); Encounter wrongEnc1 = new Encounter(); wrongEnc1.setStatus(EncounterStatus.ARRIVED); wrongEnc1.getSubject().setReference(myWrongPatId); wrongEnc1.getServiceProvider().setReference(orgId); - myWrongEnc1 = myClient.create().resource(wrongEnc1).execute().getId().toUnqualifiedVersionless().getValue(); + myWrongEnc1 = ourClient.create().resource(wrongEnc1).execute().getId().toUnqualifiedVersionless().getValue(); myObsIds = new ArrayList(); for (int i = 0; i < 20; i++) { Observation obs = new Observation(); obs.getSubject().setReference(patId); obs.setStatus(ObservationStatus.FINAL); - String obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue(); + String obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue(); myObsIds.add(obsId); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java index 6267a23ee74..19e36cdb5a3 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java @@ -80,7 +80,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide sp.setTitle("Foo Param"); try { - myClient.create().resource(sp).execute(); + ourClient.create().resource(sp).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: SearchParameter.status is missing or invalid", e.getMessage()); @@ -91,7 +91,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide public void testConformanceOverrideAllowed() { myDaoConfig.setDefaultSearchParamsCanBeOverridden(true); - CapabilityStatement conformance = myClient + CapabilityStatement conformance = ourClient .fetchConformance() .ofType(CapabilityStatement.class) .execute(); @@ -143,7 +143,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide } }); - conformance = myClient + conformance = ourClient .fetchConformance() .ofType(CapabilityStatement.class) .execute(); @@ -161,7 +161,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide public void testConformanceOverrideNotAllowed() { myDaoConfig.setDefaultSearchParamsCanBeOverridden(false); - CapabilityStatement conformance = myClient + CapabilityStatement conformance = ourClient .fetchConformance() .ofType(CapabilityStatement.class) .execute(); @@ -197,7 +197,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide mySearchParamRegsitry.forceRefresh(); - conformance = myClient + conformance = ourClient .fetchConformance() .ofType(CapabilityStatement.class) .execute(); @@ -301,7 +301,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(eyeColourSp)); - myClient + ourClient .create() .resource(eyeColourSp) .execute(); @@ -320,7 +320,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide p2.addExtension().setUrl("http://acme.org/eyecolour").setValue(new CodeType("green")); IIdType p2id = myPatientDao.create(p2).getId().toUnqualifiedVersionless(); - Bundle bundle = myClient + Bundle bundle = ourClient .search() .forResource(Patient.class) .where(new TokenClientParam("eyecolour").exactly().code("blue")) @@ -367,7 +367,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide List foundResources; Bundle result; - result = myClient + result = ourClient .search() .forResource(Observation.class) .where(new ReferenceClientParam("foo").hasChainedProperty(Patient.GENDER.exactly().code("male"))) @@ -407,7 +407,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide List foundResources; Bundle result; - result = myClient + result = ourClient .search() .forResource(Patient.class) .where(new TokenClientParam("foo").exactly().code("male")) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderExpungeR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderExpungeR4Test.java index 4f6722b09f1..337cdda4c47 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderExpungeR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderExpungeR4Test.java @@ -139,7 +139,7 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(input)); - Parameters output = myClient + Parameters output = ourClient .operation() .onInstance(myTwoVersionPatientId) .named("expunge") @@ -179,7 +179,7 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { .setValue(new BooleanType(true)); try { - myClient + ourClient .operation() .onInstance(myTwoVersionPatientId) .named("expunge") @@ -212,7 +212,7 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(input)); - Parameters output = myClient + Parameters output = ourClient .operation() .onServer() .named("expunge") @@ -251,7 +251,7 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(input)); - Parameters output = myClient + Parameters output = ourClient .operation() .onType(Patient.class) .named("expunge") @@ -297,7 +297,7 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(input)); - Parameters output = myClient + Parameters output = ourClient .operation() .onInstanceVersion(myTwoVersionPatientId.withVersion("1")) .named("expunge") diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java index 0c784920341..9aea53e49d3 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java @@ -241,7 +241,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes Organization org = new Organization(); org.setName("orgName"); - IIdType orgId = myClient.create().resource(org).execute().getId().toUnqualified(); + IIdType orgId = ourClient.create().resource(org).execute().getId().toUnqualified(); assertNotNull(orgId.getVersionIdPartAsLong()); resetServerInterceptor(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java index 98a613849c2..ee1e4b81477 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java @@ -72,7 +72,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro qr1.setStatus(QuestionnaireResponseStatus.COMPLETED); qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123)); try { - myClient.create().resource(qr1).execute(); + ourClient.create().resource(qr1).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.toString(), containsString("Answer value must be of type string")); @@ -95,7 +95,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro qr1.setStatus(QuestionnaireResponseStatus.COMPLETED); qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123)); try { - myClient.create().resource(qr1).execute(); + ourClient.create().resource(qr1).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.toString(), containsString("Answer value must be of type string")); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java index 6ea92ae282a..075ed457670 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java @@ -34,9 +34,9 @@ public class ResourceProviderR4BundleTest extends BaseResourceProviderR4Test { composition.setTitle("Visit Summary"); bundle.addEntry().setFullUrl("http://foo").setResource(composition); - IIdType id = myClient.create().resource(bundle).execute().getId(); + IIdType id = ourClient.create().resource(bundle).execute().getId(); - Bundle retBundle = myClient.read().resource(Bundle.class).withId(id).execute(); + Bundle retBundle = ourClient.read().resource(Bundle.class).withId(id).execute(); ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(retBundle)); assertEquals("http://foo", bundle.getEntry().get(0).getFullUrl()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java index 9ffb2e4c623..1792f9fe300 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java @@ -35,7 +35,7 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); myDaoConfig.setCacheControlNoStoreMaxResultsUpperLimit(new DaoConfig().getCacheControlNoStoreMaxResultsUpperLimit()); - myClient.unregisterInterceptor(myCapturingInterceptor); + ourClient.unregisterInterceptor(myCapturingInterceptor); } @Override @@ -45,7 +45,7 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); myCapturingInterceptor = new CapturingInterceptor(); - myClient.registerInterceptor(myCapturingInterceptor); + ourClient.registerInterceptor(myCapturingInterceptor); } @Test @@ -53,9 +53,9 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { Patient pt1 = new Patient(); pt1.addName().setFamily("FAM"); - myClient.create().resource(pt1).execute(); + ourClient.create().resource(pt1).execute(); - Bundle results = myClient + Bundle results = ourClient .search() .forResource("Patient") .where(Patient.FAMILY.matches().value("FAM")) @@ -68,9 +68,9 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { Patient pt2 = new Patient(); pt2.addName().setFamily("FAM"); - myClient.create().resource(pt2).execute(); + ourClient.create().resource(pt2).execute(); - results = myClient + results = ourClient .search() .forResource("Patient") .where(Patient.FAMILY.matches().value("FAM")) @@ -89,10 +89,10 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { for (int i = 0; i < 10; i++) { Patient pt1 = new Patient(); pt1.addName().setFamily("FAM" + i); - myClient.create().resource(pt1).execute(); + ourClient.create().resource(pt1).execute(); } - Bundle results = myClient + Bundle results = ourClient .search() .forResource("Patient") .where(Patient.FAMILY.matches().value("FAM")) @@ -109,7 +109,7 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { public void testCacheNoStoreMaxResultsWithIllegalValue() throws IOException { myDaoConfig.setCacheControlNoStoreMaxResultsUpperLimit(123); try { - myClient + ourClient .search() .forResource("Patient") .where(Patient.FAMILY.matches().value("FAM")) @@ -127,18 +127,18 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { Patient pt1 = new Patient(); pt1.addName().setFamily("FAM"); - myClient.create().resource(pt1).execute(); + ourClient.create().resource(pt1).execute(); - Bundle results = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); + Bundle results = ourClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); assertEquals(1, results.getEntry().size()); assertEquals(1, mySearchEntityDao.count()); assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); Patient pt2 = new Patient(); pt2.addName().setFamily("FAM"); - myClient.create().resource(pt2).execute(); + ourClient.create().resource(pt2).execute(); - results = myClient + results = ourClient .search() .forResource("Patient") .where(Patient.FAMILY.matches().value("FAM")) @@ -156,11 +156,11 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { Patient pt1 = new Patient(); pt1.addName().setFamily("FAM"); - myClient.create().resource(pt1).execute(); + ourClient.create().resource(pt1).execute(); Date beforeFirst = new Date(); - Bundle results1 = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); + Bundle results1 = ourClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); assertEquals(1, results1.getEntry().size()); assertEquals(1, mySearchEntityDao.count()); assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); @@ -170,9 +170,9 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { Patient pt2 = new Patient(); pt2.addName().setFamily("FAM"); - myClient.create().resource(pt2).execute(); + ourClient.create().resource(pt2).execute(); - Bundle results2 = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); + Bundle results2 = ourClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); assertEquals(1, results2.getEntry().size()); assertEquals(1, mySearchEntityDao.count()); assertEquals("HIT from " + ourServerBase, myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE).get(0)); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java index a54963a5f6f..9b04ff87ed2 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java @@ -40,7 +40,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOnExternalCode() { ResourceProviderR4ValueSetTest.createExternalCs(myCodeSystemDao, myResourceTableDao, myTermSvc, mySrd); - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -59,7 +59,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).getValue().booleanValue()); // With HTTP GET - respParam = myClient + respParam = ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -82,7 +82,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test @Test public void testLookupOperationByCodeAndSystemBuiltInCode() { - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -105,7 +105,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByCodeAndSystemBuiltInNonexistantCode() { //@formatter:off try { - myClient + ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -122,7 +122,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test @Test public void testLookupOperationByCodeAndSystemUserDefinedCode() { //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -146,7 +146,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByCodeAndSystemUserDefinedNonExistantCode() { //@formatter:off try { - myClient + ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -163,7 +163,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test @Test public void testLookupOperationByCoding() { //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -186,7 +186,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByInvalidCombination() { //@formatter:off try { - myClient + ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -205,7 +205,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByInvalidCombination2() { //@formatter:off try { - myClient + ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -223,7 +223,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByInvalidCombination3() { //@formatter:off try { - myClient + ourClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -240,7 +240,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test // @Ignore public void testLookupOperationForBuiltInCode() { //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(CodeSystem.class) .named("lookup") diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ConceptMapTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ConceptMapTest.java index 904b248e682..66472d5a114 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ConceptMapTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ConceptMapTest.java @@ -34,7 +34,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test public void testStoreExistingTermConceptMapAndChildren() { ConceptMap conceptMap = createConceptMap(); - MethodOutcome methodOutcome = myClient + MethodOutcome methodOutcome = ourClient .update() .resource(conceptMap) .conditional() @@ -50,7 +50,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ConceptMap conceptMap = createConceptMap(); conceptMap.getGroupFirstRep().getElementFirstRep().setCode("UPDATED_CODE"); - MethodOutcome methodOutcome = myClient + MethodOutcome methodOutcome = ourClient .update() .resource(conceptMap) .conditional() @@ -74,7 +74,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -132,7 +132,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -177,7 +177,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -210,7 +210,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -288,7 +288,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -341,7 +341,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -432,7 +432,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -511,7 +511,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -562,7 +562,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -627,7 +627,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -678,7 +678,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -741,7 +741,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -818,7 +818,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -889,7 +889,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onInstance(myConceptMapId) .named("translate") @@ -970,7 +970,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1016,7 +1016,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1051,7 +1051,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1117,7 +1117,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1187,7 +1187,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1280,7 +1280,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1347,7 +1347,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1414,7 +1414,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1467,7 +1467,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1518,7 +1518,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1583,7 +1583,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onType(ConceptMap.class) .named("translate") @@ -1641,7 +1641,7 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test ourLog.info("Request Parameters:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams)); - Parameters respParams = myClient + Parameters respParams = ourClient .operation() .onInstance(myConceptMapId) .named("translate") diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java index 4e8c699d7d2..aef42f50e99 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java @@ -96,7 +96,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(false); mySearchCoordinatorSvcRaw.cancelAllActiveSearches(); - myClient.unregisterInterceptor(myCapturingInterceptor); + ourClient.unregisterInterceptor(myCapturingInterceptor); } @Override @@ -105,7 +105,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myFhirCtx.setParserErrorHandler(new StrictErrorHandler()); myDaoConfig.setAllowMultipleDelete(true); - myClient.registerInterceptor(myCapturingInterceptor); + ourClient.registerInterceptor(myCapturingInterceptor); } @Test @@ -115,15 +115,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p.addName().setFamily("FAM").addGiven("GIV"); IIdType id = myPatientDao.create(p).getId(); - myClient.read().resource("Patient").withId(id.toUnqualifiedVersionless()).execute(); + ourClient.read().resource("Patient").withId(id.toUnqualifiedVersionless()).execute(); - myClient + ourClient .delete() .resourceConditionalByUrl("Patient?family=FAM&given=giv") .execute(); try { - myClient.read().resource("Patient").withId(id.toUnqualifiedVersionless()).execute(); + ourClient.read().resource("Patient").withId(id.toUnqualifiedVersionless()).execute(); fail(); } catch (ResourceGoneException e) { // good @@ -164,12 +164,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void saveAndRetrieveBasicResource() throws IOException { String input = IOUtils.toString(getClass().getResourceAsStream("/basic-stu3.xml"), StandardCharsets.UTF_8); - String respString = myClient.transaction().withBundle(input).prettyPrint().execute(); + String respString = ourClient.transaction().withBundle(input).prettyPrint().execute(); ourLog.info(respString); Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, respString); IdType id = new IdType(bundle.getEntry().get(0).getResponse().getLocation()); - Basic basic = myClient.read().resource(Basic.class).withId(id).execute(); + Basic basic = ourClient.read().resource(Basic.class).withId(id).execute(); List exts = basic.getExtensionsByUrl("http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/DateID"); assertEquals(1, exts.size()); } @@ -217,7 +217,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testBundleCreate() throws Exception { - IGenericClient client = myClient; + IGenericClient client = ourClient; String resBody = IOUtils.toString(ResourceProviderR4Test.class.getResource("/r4/document-father.json"), StandardCharsets.UTF_8); IIdType id = client.create().resource(resBody).execute().getId(); @@ -231,7 +231,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testBundleCreateWithTypeTransaction() throws Exception { - IGenericClient client = myClient; + IGenericClient client = ourClient; String resBody = IOUtils.toString(ResourceProviderR4Test.class.getResource("/r4/document-father.json"), StandardCharsets.UTF_8); resBody = resBody.replace("\"type\": \"document\"", "\"type\": \"transaction\""); @@ -249,10 +249,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { subs.setStatus(SubscriptionStatus.ACTIVE); subs.getChannel().setType(SubscriptionChannelType.WEBSOCKET); subs.setCriteria("Observation?"); - IIdType id = myClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); + IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); //@formatter:off - Bundle resp = myClient + Bundle resp = ourClient .search() .forResource(Subscription.class) .where(Subscription.TYPE.exactly().code(SubscriptionChannelType.WEBSOCKET.toCode())) @@ -264,7 +264,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(resp), contains(id)); //@formatter:off - resp = myClient + resp = ourClient .search() .forResource(Subscription.class) .where(Subscription.TYPE.exactly().systemAndCode(SubscriptionChannelType.WEBSOCKET.getSystem(), SubscriptionChannelType.WEBSOCKET.toCode())) @@ -276,7 +276,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(resp), contains(id)); //@formatter:off - resp = myClient + resp = ourClient .search() .forResource(Subscription.class) .where(Subscription.TYPE.exactly().systemAndCode(SubscriptionChannelType.WEBSOCKET.getSystem(), SubscriptionChannelType.WEBSOCKET.toCode())) @@ -297,13 +297,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("rpdstu2_testCountParam_01"); resources.add(org); } - myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - Bundle found = myClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(10).returnBundle(Bundle.class).execute(); + Bundle found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(10).returnBundle(Bundle.class).execute(); assertEquals(100, found.getTotal()); assertEquals(10, found.getEntry().size()); - found = myClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(999).returnBundle(Bundle.class).execute(); + found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(999).returnBundle(Bundle.class).execute(); assertEquals(100, found.getTotal()); assertEquals(50, found.getEntry().size()); @@ -319,9 +319,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { binary.setContent(arr); binary.setContentType("dansk"); - IIdType resource = myClient.create().resource(binary).execute().getId(); + IIdType resource = ourClient.create().resource(binary).execute().getId(); - Binary fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); + Binary fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); assertEquals("1", fromDB.getIdElement().getVersionIdPart()); arr[ 0 ] = 2; @@ -335,7 +335,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IOUtils.closeQuietly(resp); } - fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); + fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); assertEquals("2", fromDB.getIdElement().getVersionIdPart()); arr[ 0 ] = 3; @@ -351,7 +351,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IOUtils.closeQuietly(resp); } - fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); + fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); assertEquals("3", fromDB.getIdElement().getVersionIdPart()); // Now an update with the wrong ID in the body @@ -368,7 +368,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IOUtils.closeQuietly(resp); } - fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); + fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); assertEquals("3", fromDB.getIdElement().getVersionIdPart()); } @@ -380,7 +380,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testCreateBundle() throws IOException { String input = IOUtils.toString(getClass().getResourceAsStream("/bryn-bundle.json"), StandardCharsets.UTF_8); Validate.notNull(input); - myClient.create().resource(input).execute().getResource(); + ourClient.create().resource(input).execute().getResource(); } @Test @@ -389,13 +389,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - MethodOutcome output1 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); + MethodOutcome output1 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - MethodOutcome output2 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); + MethodOutcome output2 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); assertEquals(output1.getId().getIdPart(), output2.getId().getIdPart()); } @@ -411,7 +411,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { // Missing status, which is mandatory Observation obs = new Observation(); obs.addIdentifier().setSystem("urn:foo").setValue("bar"); - IBaseResource outcome = myClient.create().resource(obs).execute().getOperationOutcome(); + IBaseResource outcome = ourClient.create().resource(obs).execute().getOperationOutcome(); String encodedOo = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome); ourLog.info(encodedOo); @@ -419,7 +419,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(encodedOo, containsString("Successfully created resource \\\"Observation/")); interceptor.setAddValidationResultsToResponseOperationOutcome(false); - outcome = myClient.create().resource(obs).execute().getOperationOutcome(); + outcome = ourClient.create().resource(obs).execute().getOperationOutcome(); encodedOo = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome); ourLog.info(encodedOo); assertThat(encodedOo, not(containsString("cvc-complex-type.2.4.b"))); @@ -436,15 +436,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { CodeSystem cs = new CodeSystem(); cs.setUrl("http://urn/system"); cs.addConcept().setCode("code0"); - myClient.create().resource(cs).execute(); + ourClient.create().resource(cs).execute(); ValueSet options = new ValueSet(); options.getCompose().addInclude().setSystem("http://urn/system"); - IIdType optId = myClient.create().resource(options).execute().getId(); + IIdType optId = ourClient.create().resource(options).execute().getId(); Questionnaire q = new Questionnaire(); q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.CHOICE).setOptions((optId.getValue())); - IIdType qId = myClient.create().resource(q).execute().getId(); + IIdType qId = ourClient.create().resource(q).execute().getId(); QuestionnaireResponse qa; @@ -453,7 +453,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { qa = new QuestionnaireResponse(); qa.setQuestionnaire(qId.toUnqualifiedVersionless().getValue()); qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("urn:system").setCode("code0")); - myClient.create().resource(qa).execute(); + ourClient.create().resource(qa).execute(); // Bad code @@ -461,7 +461,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { qa.setQuestionnaire(qId.toUnqualifiedVersionless().getValue()); qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("urn:system").setCode("code1")); try { - myClient.create().resource(qa).execute(); + ourClient.create().resource(qa).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Question with linkId[link0]")); @@ -537,7 +537,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } // //@formatter:off -// IIdType id3 = myClient +// IIdType id3 = ourClient // .update() // .resource(pt) // .conditionalByUrl("Patient?identifier=http://general-hospital.co.uk/Identifiers|09832345234543876876") @@ -597,7 +597,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p.addName().setFamily(methodName); p.setId(methodName); - IIdType optId = myClient.update().resource(p).execute().getId(); + IIdType optId = ourClient.update().resource(p).execute().getId(); assertEquals(methodName, optId.getIdPart()); assertEquals("1", optId.getVersionIdPart()); } @@ -606,12 +606,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testDeepChaining() { Location l1 = new Location(); l1.getNameElement().setValue("testDeepChainingL1"); - IIdType l1id = myClient.create().resource(l1).execute().getId(); + IIdType l1id = ourClient.create().resource(l1).execute().getId(); Location l2 = new Location(); l2.getNameElement().setValue("testDeepChainingL2"); l2.getPartOf().setReferenceElement(l1id.toVersionless().toUnqualified()); - IIdType l2id = myClient.create().resource(l2).execute().getId(); + IIdType l2id = ourClient.create().resource(l2).execute().getId(); Encounter e1 = new Encounter(); e1.addIdentifier().setSystem("urn:foo").setValue("testDeepChainingE1"); @@ -619,10 +619,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { EncounterLocationComponent location = e1.addLocation(); location.getLocation().setReferenceElement(l2id.toUnqualifiedVersionless()); location.setPeriod(new Period().setStart(new Date(), TemporalPrecisionEnum.SECOND).setEnd(new Date(), TemporalPrecisionEnum.SECOND)); - IIdType e1id = myClient.create().resource(e1).execute().getId(); + IIdType e1id = ourClient.create().resource(e1).execute().getId(); //@formatter:off - Bundle res = myClient.search() + Bundle res = ourClient.search() .forResource(Encounter.class) .where(Encounter.IDENTIFIER.exactly().systemAndCode("urn:foo", "testDeepChainingE1")) .include(Encounter.INCLUDE_LOCATION.asRecursive()) @@ -655,7 +655,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { try { //@formatter:off - myClient + ourClient .delete() .resourceConditionalByType(Patient.class) .where(Patient.IDENTIFIER.exactly().code(methodName)) @@ -668,13 +668,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } // Not deleted yet.. - myClient.read().resource("Patient").withId(id1).execute(); - myClient.read().resource("Patient").withId(id2).execute(); + ourClient.read().resource("Patient").withId(id1).execute(); + ourClient.read().resource("Patient").withId(id2).execute(); myDaoConfig.setAllowMultipleDelete(true); //@formatter:off - IBaseOperationOutcome response = myClient + IBaseOperationOutcome response = ourClient .delete() .resourceConditionalByType(Patient.class) .where(Patient.IDENTIFIER.exactly().code(methodName)) @@ -686,13 +686,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(encoded, containsString( " ids = toUnqualifiedVersionlessIds(b); assertThat(ids, containsInAnyOrder(patientId, encId, orgId1, orgId2, orgId1parent, locPId, locCId, obsId, devId)); @@ -1017,52 +1017,52 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org1parent = new Organization(); org1parent.setId("org1parent"); org1parent.setName(methodName + "1parent"); - IIdType orgId1parent = myClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1parent = ourClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); Organization org1 = new Organization(); org1.setName(methodName + "1"); org1.getPartOf().setReferenceElement(orgId1parent); - IIdType orgId1 = myClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1 = ourClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); Patient p = new Patient(); p.addName().setFamily(methodName); p.getManagingOrganization().setReferenceElement(orgId1); - IIdType patientId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType patientId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); Organization org2 = new Organization(); org2.setName(methodName + "1"); - IIdType orgId2 = myClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); + IIdType orgId2 = ourClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); Device dev = new Device(); dev.setModel(methodName); dev.getOwner().setReferenceElement(orgId2); - IIdType devId = myClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); + IIdType devId = ourClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); Location locParent = new Location(); locParent.setName(methodName + "Parent"); - IIdType locPId = myClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless(); + IIdType locPId = ourClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless(); Location locChild = new Location(); locChild.setName(methodName); locChild.getPartOf().setReferenceElement(locPId); - IIdType locCId = myClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless(); + IIdType locCId = ourClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless(); Encounter encU = new Encounter(); encU.addIdentifier().setValue(methodName); - IIdType encUId = myClient.create().resource(encU).execute().getId().toUnqualifiedVersionless(); + IIdType encUId = ourClient.create().resource(encU).execute().getId().toUnqualifiedVersionless(); Encounter enc = new Encounter(); enc.getSubject().setReferenceElement(patientId); enc.addLocation().getLocation().setReferenceElement(locCId); - IIdType encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); + IIdType encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); Observation obs = new Observation(); obs.getSubject().setReferenceElement(patientId); obs.getDevice().setReferenceElement(devId); obs.getContext().setReferenceElement(encId); - IIdType obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); + IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); - Parameters output = myClient.operation().onType(Encounter.class).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = ourClient.operation().onType(Encounter.class).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); List ids = toUnqualifiedVersionlessIds(b); assertThat(ids, containsInAnyOrder(patientId, encUId, encId, orgId1, orgId2, orgId1parent, locPId, locCId, obsId, devId)); @@ -1117,7 +1117,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { param.addAnd(new StringOrListParam().addOr(new StringParam("obsvalue1"))); //@formatter:off - Parameters response = myClient + Parameters response = ourClient .operation() .onInstance(ptId1) .named("everything") @@ -1139,7 +1139,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IParser parser = myFhirCtx.newJsonParser(); b = parser.parseResource(Bundle.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/r4/bug147-bundle.json"))); - Bundle resp = myClient.transaction().withBundle(b).execute(); + Bundle resp = ourClient.transaction().withBundle(b).execute(); List ids = new ArrayList(); for (BundleEntryComponent next : resp.getEntry()) { IdType toAdd = new IdType(next.getResponse().getLocation()).toUnqualifiedVersionless(); @@ -1151,7 +1151,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals("Patient", patientId.getResourceType()); { - Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); b = (Bundle) output.getParameter().get(0).getResource(); ids = new ArrayList(); @@ -1172,7 +1172,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { { Parameters input = new Parameters(); input.addParameter().setName(Constants.PARAM_COUNT).setValue(new UnsignedIntType(100)); - Parameters output = myClient.operation().onInstance(patientId).named("everything").withParameters(input).execute(); + Parameters output = ourClient.operation().onInstance(patientId).named("everything").withParameters(input).execute(); b = (Bundle) output.getParameter().get(0).getResource(); ids = new ArrayList(); @@ -1210,7 +1210,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mo.setMedication(new Reference(medId)); IIdType moId = myMedicationRequestDao.create(mo, mySrd).getId().toUnqualifiedVersionless(); - Parameters output = myClient.operation().onInstance(patId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = ourClient.operation().onInstance(patId).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); List ids = toUnqualifiedVersionlessIds(b); ourLog.info(ids.toString()); @@ -1231,14 +1231,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { c.getSubject().setReference("Patient/1"); b.addEntry().setResource(c).getRequest().setMethod(HTTPVerb.POST); - Bundle resp = myClient.transaction().withBundle(b).execute(); + Bundle resp = ourClient.transaction().withBundle(b).execute(); ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(resp)); IdType patientId = new IdType(resp.getEntry().get(0).getResponse().getLocation()); assertEquals("Patient", patientId.getResourceType()); - Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); b = (Bundle) output.getParameter().get(0).getResource(); List ids = new ArrayList(); @@ -1259,37 +1259,37 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org1parent = new Organization(); org1parent.setId("org1parent"); org1parent.setName(methodName + "1parent"); - IIdType orgId1parent = myClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1parent = ourClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); Organization org1 = new Organization(); org1.setName(methodName + "1"); org1.getPartOf().setReferenceElement(orgId1parent); - IIdType orgId1 = myClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1 = ourClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); Patient p = new Patient(); p.addName().setFamily(methodName); p.getManagingOrganization().setReferenceElement(orgId1); - IIdType patientId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType patientId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); Organization org2 = new Organization(); org2.setName(methodName + "1"); - IIdType orgId2 = myClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); + IIdType orgId2 = ourClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); Device dev = new Device(); dev.setModel(methodName); dev.getOwner().setReferenceElement(orgId2); - IIdType devId = myClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); + IIdType devId = ourClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); Observation obs = new Observation(); obs.getSubject().setReferenceElement(patientId); obs.getDevice().setReferenceElement(devId); - IIdType obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); + IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); Encounter enc = new Encounter(); enc.getSubject().setReferenceElement(patientId); - IIdType encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); + IIdType encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); - Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); List ids = toUnqualifiedVersionlessIds(b); assertThat(ids, containsInAnyOrder(patientId, devId, obsId, encId, orgId1, orgId2, orgId1parent)); @@ -1303,32 +1303,32 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization o1 = new Organization(); o1.setName(methodName + "1"); - IIdType o1Id = myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); + IIdType o1Id = ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); Organization o2 = new Organization(); o2.setName(methodName + "2"); - IIdType o2Id = myClient.create().resource(o2).execute().getId().toUnqualifiedVersionless(); + IIdType o2Id = ourClient.create().resource(o2).execute().getId().toUnqualifiedVersionless(); Patient p1 = new Patient(); p1.addName().setFamily(methodName + "1"); p1.getManagingOrganization().setReferenceElement(o1Id); - IIdType p1Id = myClient.create().resource(p1).execute().getId().toUnqualifiedVersionless(); + IIdType p1Id = ourClient.create().resource(p1).execute().getId().toUnqualifiedVersionless(); Patient p2 = new Patient(); p2.addName().setFamily(methodName + "2"); p2.getManagingOrganization().setReferenceElement(o2Id); - IIdType p2Id = myClient.create().resource(p2).execute().getId().toUnqualifiedVersionless(); + IIdType p2Id = ourClient.create().resource(p2).execute().getId().toUnqualifiedVersionless(); Condition c1 = new Condition(); c1.getSubject().setReferenceElement(p1Id); - IIdType c1Id = myClient.create().resource(c1).execute().getId().toUnqualifiedVersionless(); + IIdType c1Id = ourClient.create().resource(c1).execute().getId().toUnqualifiedVersionless(); Condition c2 = new Condition(); c2.getSubject().setReferenceElement(p2Id); - IIdType c2Id = myClient.create().resource(c2).execute().getId().toUnqualifiedVersionless(); + IIdType c2Id = ourClient.create().resource(c2).execute().getId().toUnqualifiedVersionless(); Condition c3 = new Condition(); c3.addIdentifier().setValue(methodName + "3"); - IIdType c3Id = myClient.create().resource(c3).execute().getId().toUnqualifiedVersionless(); + IIdType c3Id = ourClient.create().resource(c3).execute().getId().toUnqualifiedVersionless(); - Parameters output = myClient.operation().onType(Patient.class).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = ourClient.operation().onType(Patient.class).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); assertEquals(BundleType.SEARCHSET, b.getType()); @@ -1345,7 +1345,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org = new Organization(); org.setName(methodName); - IIdType oId = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); + IIdType oId = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); long time1 = System.currentTimeMillis(); Thread.sleep(10); @@ -1353,7 +1353,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p = new Patient(); p.addName().setFamily(methodName); p.getManagingOrganization().setReferenceElement(oId); - IIdType pId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType pId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); long time2 = System.currentTimeMillis(); Thread.sleep(10); @@ -1361,7 +1361,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Condition c = new Condition(); c.getCode().setText(methodName); c.getSubject().setReferenceElement(pId); - IIdType cId = myClient.create().resource(c).execute().getId().toUnqualifiedVersionless(); + IIdType cId = ourClient.create().resource(c).execute().getId().toUnqualifiedVersionless(); Thread.sleep(10); long time3 = System.currentTimeMillis(); @@ -1455,7 +1455,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mySystemDao.transaction(mySrd, inputBundle); - Bundle responseBundle = myClient + Bundle responseBundle = ourClient .operation() .onInstance(new IdType("Patient/A161443")) .named("everything") @@ -1483,7 +1483,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } String nextUrl = responseBundle.getLink("next").getUrl(); - responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); + responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); for (int i = 0; i < responseBundle.getEntry().size(); i++) { for (BundleEntryComponent nextEntry : responseBundle.getEntry()) { idsSet.add(nextEntry.getResource().getIdElement().toUnqualifiedVersionless().getValue()); @@ -1491,7 +1491,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } nextUrl = responseBundle.getLink("next").getUrl(); - responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); + responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); for (int i = 0; i < responseBundle.getEntry().size(); i++) { for (BundleEntryComponent nextEntry : responseBundle.getEntry()) { idsSet.add(nextEntry.getResource().getIdElement().toUnqualifiedVersionless().getValue()); @@ -1517,16 +1517,16 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testEverythingWithLargeSet2() { Patient p = new Patient(); p.setActive(true); - IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); for (int i = 1; i < 77; i++) { Observation obs = new Observation(); obs.setId("A" + StringUtils.leftPad(Integer.toString(i), 2, '0')); obs.setSubject(new Reference(id)); - myClient.update().resource(obs).execute(); + ourClient.update().resource(obs).execute(); } - Bundle responseBundle = myClient.operation().onInstance(id).named("everything").withParameter(Parameters.class, "_count", new IntegerType(50)).useHttpGet().returnResourceType(Bundle.class) + Bundle responseBundle = ourClient.operation().onInstance(id).named("everything").withParameter(Parameters.class, "_count", new IntegerType(50)).useHttpGet().returnResourceType(Bundle.class) .execute(); TreeSet ids = new TreeSet(); @@ -1541,7 +1541,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { BundleLinkComponent nextLink = responseBundle.getLink("next"); while (nextLink != null) { String nextUrl = nextLink.getUrl(); - responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); + responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); for (int i = 0; i < responseBundle.getEntry().size(); i++) { for (BundleEntryComponent nextEntry : responseBundle.getEntry()) { ids.add(nextEntry.getResource().getIdElement().getIdPart()); @@ -1563,11 +1563,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testEverythingWithOnlyPatient() { Patient p = new Patient(); p.setActive(true); - IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); myFhirCtx.getRestfulClientFactory().setSocketTimeout(300 * 1000); - Bundle response = myClient + Bundle response = ourClient .operation() .onInstance(id) .named("everything") @@ -1658,18 +1658,18 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p = new Patient(); p.setId("FOO"); p.addName().setFamily("FAMILY"); - myClient.update().resource(p).execute(); + ourClient.update().resource(p).execute(); p = new Patient(); p.setId("BAR"); p.addName().setFamily("HELLO"); - myClient.update().resource(p).execute(); + ourClient.update().resource(p).execute(); Observation o = new Observation(); o.setId("BAZ"); o.getSubject().setReference("Patient/FOO"); o.getCode().setText("GOODBYE"); - myClient.update().resource(o).execute(); + ourClient.update().resource(o).execute(); List ids = searchAndReturnUnqualifiedVersionlessIdValues(ourServerBase + "/Patient/FOO/$everything?_content=White"); assertThat(ids, contains("Patient/FOO")); @@ -1686,18 +1686,18 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p = new Patient(); p.setId("FOO"); p.addName().setFamily("FAMILY"); - myClient.update().resource(p).execute(); + ourClient.update().resource(p).execute(); p = new Patient(); p.setId("BAR"); p.addName().setFamily("HELLO"); - myClient.update().resource(p).execute(); + ourClient.update().resource(p).execute(); Observation o = new Observation(); o.setId("BAZ"); o.getSubject().setReference("Patient/FOO"); o.getCode().setText("GOODBYE"); - myClient.update().resource(o).execute(); + ourClient.update().resource(o).execute(); List ids = searchAndReturnUnqualifiedVersionlessIdValues(ourServerBase + "/Patient?_id=FOO&_content=family"); assertThat(ids, contains("Patient/FOO")); @@ -1712,7 +1712,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient pt = new Patient(); pt.addName().setFamily(methodName); - myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); + ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); myResourceCountsCache.clear(); myResourceCountsCache.update(); @@ -1831,12 +1831,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient patient = new Patient(); patient.addName().setFamily(methodName); - IIdType id = myClient.create().resource(patient).execute().getId().toVersionless(); - myClient.delete().resourceById(id).execute(); + IIdType id = ourClient.create().resource(patient).execute().getId().toVersionless(); + ourClient.delete().resourceById(id).execute(); patient.setId(id); - myClient.update().resource(patient).execute(); + ourClient.update().resource(patient).execute(); - Bundle history = myClient.history().onInstance(id).andReturnBundle(Bundle.class).prettyPrint().summaryMode(SummaryEnum.DATA).execute(); + Bundle history = ourClient.history().onInstance(id).andReturnBundle(Bundle.class).prettyPrint().summaryMode(SummaryEnum.DATA).execute(); assertEquals(3, history.getEntry().size()); assertEquals(id.withVersion("3").getValue(), history.getEntry().get(0).getResource().getId()); assertEquals(1, ((Patient) history.getEntry().get(0).getResource()).getName().size()); @@ -1860,25 +1860,25 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { // private void delete(String theResourceType, String theParamName, String theParamValue) { // Bundle resources; // do { - // IQuery forResource = myClient.search().forResource(theResourceType); + // IQuery forResource = ourClient.search().forResource(theResourceType); // if (theParamName != null) { // forResource = forResource.where(new StringClientParam(theParamName).matches().value(theParamValue)); // } // resources = forResource.execute(); // for (IResource next : resources.toListOfResources()) { // ourLog.info("Deleting resource: {}", next.getId()); - // myClient.delete().resource(next).execute(); + // ourClient.delete().resource(next).execute(); // } // } while (resources.size() > 0); // } // // private void deleteToken(String theResourceType, String theParamName, String theParamSystem, String theParamValue) // { - // Bundle resources = myClient.search().forResource(theResourceType).where(new + // Bundle resources = ourClient.search().forResource(theResourceType).where(new // TokenClientParam(theParamName).exactly().systemAndCode(theParamSystem, theParamValue)).execute(); // for (IResource next : resources.toListOfResources()) { // ourLog.info("Deleting resource: {}", next.getId()); - // myClient.delete().resource(next).execute(); + // ourClient.delete().resource(next).execute(); // } // } @@ -1976,7 +1976,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { */ @Test public void testImagingStudyResources() throws Exception { - IGenericClient client = myClient; + IGenericClient client = ourClient; int initialSize = client.search().forResource(ImagingStudy.class).returnBundle(Bundle.class).execute().getEntry().size(); @@ -2005,7 +2005,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myPatientDao.create(pt); } - Bundle bundle = myClient + Bundle bundle = ourClient .search() .forResource(Patient.class) .include(Patient.INCLUDE_ORGANIZATION) @@ -2028,9 +2028,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/Organization/123"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); - Bundle b = myClient.search().forResource("Patient").include(Patient.INCLUDE_ORGANIZATION).returnBundle(Bundle.class).execute(); + Bundle b = ourClient.search().forResource("Patient").include(Patient.INCLUDE_ORGANIZATION).returnBundle(Bundle.class).execute(); assertEquals(1, b.getEntry().size()); } @@ -2038,7 +2038,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testMetaOperationWithNoMetaParameter() throws Exception { Patient p = new Patient(); p.addName().setFamily("testMetaAddInvalid"); - IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); //@formatter:off String input = "\n" + @@ -2084,19 +2084,19 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient pt = new Patient(); pt.addName().setFamily(methodName); - IIdType id = myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); + IIdType id = ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); - Meta meta = myClient.meta().get(Meta.class).fromResource(id).execute(); + Meta meta = ourClient.meta().get(Meta.class).fromResource(id).execute(); assertEquals(0, meta.getTag().size()); Meta inMeta = new Meta(); inMeta.addTag().setSystem("urn:system1").setCode("urn:code1"); - meta = myClient.meta().add().onResource(id).meta(inMeta).execute(); + meta = ourClient.meta().add().onResource(id).meta(inMeta).execute(); assertEquals(1, meta.getTag().size()); inMeta = new Meta(); inMeta.addTag().setSystem("urn:system1").setCode("urn:code1"); - meta = myClient.meta().delete().onResource(id).meta(inMeta).execute(); + meta = ourClient.meta().delete().onResource(id).meta(inMeta).execute(); assertEquals(0, meta.getTag().size()); } @@ -2122,9 +2122,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { StructureDefinition p = new StructureDefinition(); p.setAbstract(true); p.setUrl("http://example.com/foo"); - IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); - Bundle resp = myClient + Bundle resp = ourClient .search() .forResource(StructureDefinition.class) .where(StructureDefinition.URL.matches().value("http://example.com/foo")) @@ -2151,7 +2151,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10); mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true); - Bundle response = myClient + Bundle response = ourClient .operation() .onInstance(new IdType(pid)) .named("everything") @@ -2169,7 +2169,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { // Load page 2 String nextUrl = response.getLink("next").getUrl(); - response = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); + response = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); assertEquals(10, response.getEntry().size()); if (response.getTotalElement().getValueAsString() != null) { @@ -2181,7 +2181,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Thread.sleep(2000); nextUrl = response.getLink("next").getUrl(); - response = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); + response = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); assertEquals(1, response.getEntry().size()); assertEquals("21", response.getTotalElement().getValueAsString()); @@ -2208,7 +2208,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10); mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true); - Bundle response = myClient + Bundle response = ourClient .operation() .onInstance(new IdType(pid)) .named("everything") @@ -2296,7 +2296,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { response.close(); } - Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); + Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); assertEquals("2", newPt.getIdElement().getVersionIdPart()); assertEquals(false, newPt.getActive()); } @@ -2327,7 +2327,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { response.close(); } - Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); + Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); assertEquals("1", newPt.getIdElement().getVersionIdPart()); assertEquals(true, newPt.getActive()); } @@ -2358,7 +2358,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { response.close(); } - Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); + Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); assertEquals("2", newPt.getIdElement().getVersionIdPart()); assertEquals(false, newPt.getActive()); } @@ -2389,7 +2389,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { response.close(); } - Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); + Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); assertEquals("2", newPt.getIdElement().getVersionIdPart()); assertEquals(false, newPt.getActive()); } @@ -2398,25 +2398,25 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testPreserveVersionsOnAuditEvent() { Organization org = new Organization(); org.setName("ORG"); - IIdType orgId = myClient.create().resource(org).execute().getId(); + IIdType orgId = ourClient.create().resource(org).execute().getId(); assertEquals("1", orgId.getVersionIdPart()); Patient patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.getManagingOrganization().setReference(orgId.toUnqualified().getValue()); - IIdType patientId = myClient.create().resource(patient).execute().getId(); + IIdType patientId = ourClient.create().resource(patient).execute().getId(); assertEquals("1", patientId.getVersionIdPart()); AuditEvent ae = new org.hl7.fhir.r4.model.AuditEvent(); ae.addEntity().getReference().setReference(patientId.toUnqualified().getValue()); - IIdType aeId = myClient.create().resource(ae).execute().getId(); + IIdType aeId = ourClient.create().resource(ae).execute().getId(); assertEquals("1", aeId.getVersionIdPart()); - patient = myClient.read().resource(Patient.class).withId(patientId).execute(); + patient = ourClient.read().resource(Patient.class).withId(patientId).execute(); assertTrue(patient.getManagingOrganization().getReferenceElement().hasIdPart()); assertFalse(patient.getManagingOrganization().getReferenceElement().hasVersionIdPart()); - ae = myClient.read().resource(AuditEvent.class).withId(aeId).execute(); + ae = ourClient.read().resource(AuditEvent.class).withId(aeId).execute(); assertTrue(ae.getEntityFirstRep().getReference().getReferenceElement().hasIdPart()); assertTrue(ae.getEntityFirstRep().getReference().getReferenceElement().hasVersionIdPart()); @@ -2427,7 +2427,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { */ @Test public void testProcedureRequestResources() { - IGenericClient client = myClient; + IGenericClient client = ourClient; int initialSize = client.search().forResource(ServiceRequest.class).returnBundle(Bundle.class).execute().getEntry().size(); @@ -2451,19 +2451,19 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { pat = new Patient(); pat.addIdentifier().setSystem("urn:system").setValue("testReadAllInstancesOfType_01"); - myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); + ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); pat = new Patient(); pat.addIdentifier().setSystem("urn:system").setValue("testReadAllInstancesOfType_02"); - myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); + ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); { - Bundle returned = myClient.search().forResource(Patient.class).encodedXml().returnBundle(Bundle.class).execute(); + Bundle returned = ourClient.search().forResource(Patient.class).encodedXml().returnBundle(Bundle.class).execute(); assertThat(returned.getEntry().size(), greaterThan(1)); assertEquals(BundleType.SEARCHSET, returned.getType()); } { - Bundle returned = myClient.search().forResource(Patient.class).encodedJson().returnBundle(Bundle.class).execute(); + Bundle returned = ourClient.search().forResource(Patient.class).encodedJson().returnBundle(Bundle.class).execute(); assertThat(returned.getEntry().size(), greaterThan(1)); } } @@ -2472,11 +2472,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testRetrieveMissingVersionsDoesntCrashHistory() { Patient p1 = new Patient(); p1.setActive(true); - final IIdType id1 = myClient.create().resource(p1).execute().getId(); + final IIdType id1 = ourClient.create().resource(p1).execute().getId(); Patient p2 = new Patient(); p2.setActive(false); - IIdType id2 = myClient.create().resource(p2).execute().getId(); + IIdType id2 = ourClient.create().resource(p2).execute().getId(); new TransactionTemplate(myTxManager).execute(new TransactionCallbackWithoutResult() { @Override @@ -2486,7 +2486,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } }); - Bundle bundle = myClient.history().onServer().andReturnBundle(Bundle.class).execute(); + Bundle bundle = ourClient.history().onServer().andReturnBundle(Bundle.class).execute(); assertEquals(1, bundle.getTotal()); assertEquals(1, bundle.getEntry().size()); assertEquals(id2.getIdPart(), bundle.getEntry().get(0).getResource().getIdElement().getIdPart()); @@ -2496,11 +2496,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testRetrieveMissingVersionsDoesntCrashSearch() { Patient p1 = new Patient(); p1.setActive(true); - final IIdType id1 = myClient.create().resource(p1).execute().getId(); + final IIdType id1 = ourClient.create().resource(p1).execute().getId(); Patient p2 = new Patient(); p2.setActive(false); - IIdType id2 = myClient.create().resource(p2).execute().getId(); + IIdType id2 = ourClient.create().resource(p2).execute().getId(); new TransactionTemplate(myTxManager).execute(new TransactionCallbackWithoutResult() { @Override @@ -2510,7 +2510,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } }); - Bundle bundle = myClient.search().forResource("Patient").returnBundle(Bundle.class).execute(); + Bundle bundle = ourClient.search().forResource("Patient").returnBundle(Bundle.class).execute(); assertEquals(2, bundle.getTotal()); assertEquals(1, bundle.getEntry().size()); assertEquals(id2.getIdPart(), bundle.getEntry().get(0).getResource().getIdElement().getIdPart()); @@ -2523,9 +2523,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.getText().getDiv().setValueAsString("
HELLO WORLD
"); p1.addIdentifier().setSystem("urn:system").setValue("testSaveAndRetrieveExistingNarrative01"); - IIdType newId = myClient.create().resource(p1).encodedJson().execute().getId(); + IIdType newId = ourClient.create().resource(p1).encodedJson().execute().getId(); - Patient actual = myClient.read().resource(Patient.class).withId(newId).encodedJson().execute(); + Patient actual = ourClient.read().resource(Patient.class).withId(newId).encodedJson().execute(); assertEquals("
HELLO WORLD
", actual.getText().getDiv().getValueAsString()); } @@ -2536,9 +2536,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.getText().getDiv().setValueAsString("
HELLO WORLD
"); p1.addIdentifier().setSystem("urn:system").setValue("testSaveAndRetrieveExistingNarrative01"); - IIdType newId = myClient.create().resource(p1).encodedXml().execute().getId(); + IIdType newId = ourClient.create().resource(p1).encodedXml().execute().getId(); - Patient actual = myClient.read().resource(Patient.class).withId(newId).encodedXml().execute(); + Patient actual = ourClient.read().resource(Patient.class).withId(newId).encodedXml().execute(); assertEquals("
HELLO WORLD
", actual.getText().getDiv().getValueAsString()); } @@ -2551,9 +2551,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { .setUrl("http://foo") .setValue(new Reference("Practitioner/A")); - myClient.update().resource(nextPatient).execute(); + ourClient.update().resource(nextPatient).execute(); - Patient p = myClient.read().resource(Patient.class).withId("B").execute(); + Patient p = ourClient.read().resource(Patient.class).withId("B").execute(); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p); ourLog.info(encoded); @@ -2571,13 +2571,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.getManagingOrganization().setResource(o1); - IIdType newId = myClient.create().resource(p1).execute().getId(); + IIdType newId = ourClient.create().resource(p1).execute().getId(); - Patient actual = myClient.read(Patient.class, new UriDt(newId.getValue())); + Patient actual = ourClient.read(Patient.class, new UriDt(newId.getValue())); assertEquals(1, actual.getContained().size()); //@formatter:off - Bundle b = myClient + Bundle b = ourClient .search() .forResource("Patient") .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system:rpdstu2", "testSaveAndRetrieveWithContained01")) @@ -2595,9 +2595,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.getText().setDivAsString("
IdentifiertestSearchByResourceChain01
"); p1.addIdentifier().setSystem("urn:system").setValue("testSearchByResourceChain01"); - IdType newId = (IdType) myClient.create().resource(p1).execute().getId(); + IdType newId = (IdType) ourClient.create().resource(p1).execute().getId(); - Patient actual = myClient.read(Patient.class, newId.getIdPart()); + Patient actual = ourClient.read(Patient.class, newId.getIdPart()); assertThat(actual.getText().getDiv().getValueAsString(), containsString("IdentifiertestSearchByResourceChain01")); } @@ -2663,7 +2663,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Bundle found; - found = myClient + found = ourClient .search() .forResource(Patient.class) .where(BaseResource.RES_ID.exactly().systemAndValues(null, id1.getIdPart(), id2.getIdPart())) @@ -2672,7 +2672,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2)); - found = myClient + found = ourClient .search() .forResource(Patient.class) .where(BaseResource.RES_ID.exactly().systemAndValues(null, Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO"))) @@ -2681,7 +2681,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2)); - found = myClient + found = ourClient .search() .forResource(Patient.class) .where(BaseResource.RES_ID.exactly().systemAndCode(null, id1.getIdPart())) @@ -2690,7 +2690,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1)); - found = myClient + found = ourClient .search() .forResource(Patient.class) .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart())) @@ -2700,7 +2700,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1)); - found = myClient + found = ourClient .search() .forResource(Patient.class) .where(BaseResource.RES_ID.exactly().codes(Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO"))) @@ -2710,7 +2710,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1)); - found = myClient + found = ourClient .search() .forResource(Patient.class) .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart(), "FOOO")) @@ -2719,7 +2719,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2)); - found = myClient + found = ourClient .search() .forResource(Patient.class) .where(BaseResource.RES_ID.exactly().codes("FOOO")) @@ -2735,15 +2735,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testSearchByIdentifier01"); p1.addName().setFamily("testSearchByIdentifierFamily01").addGiven("testSearchByIdentifierGiven01"); - IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId(); + IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId(); Patient p2 = new Patient(); p2.addIdentifier().setSystem("urn:system").setValue("testSearchByIdentifier02"); p2.addName().setFamily("testSearchByIdentifierFamily01").addGiven("testSearchByIdentifierGiven02"); - myClient.create().resource(p2).execute().getId(); + ourClient.create().resource(p2).execute().getId(); //@formatter:off - Bundle actual = myClient + Bundle actual = ourClient .search() .forResource(Patient.class) .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testSearchByIdentifier01")) @@ -2764,10 +2764,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setValue("testSearchByIdentifierWithoutSystem01"); - IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId(); + IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId(); //@formatter:off - Bundle actual = myClient + Bundle actual = ourClient .search() .forResource(Patient.class) .where(Patient.IDENTIFIER.exactly().systemAndCode(null, "testSearchByIdentifierWithoutSystem01")) @@ -2787,7 +2787,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p = new Patient(); p.addName().setFamily(methodName + "1"); - IIdType pid1 = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType pid1 = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); Thread.sleep(10); long time1 = System.currentTimeMillis(); @@ -2795,7 +2795,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p2 = new Patient(); p2.addName().setFamily(methodName + "2"); - IIdType pid2 = myClient.create().resource(p2).execute().getId().toUnqualifiedVersionless(); + IIdType pid2 = ourClient.create().resource(p2).execute().getId().toUnqualifiedVersionless(); HttpGet get = new HttpGet(ourServerBase + "/Patient?_lastUpdated=lt" + new InstantType(new Date(time1)).getValueAsString()); CloseableHttpResponse response = ourHttpClient.execute(get); @@ -2835,12 +2835,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p2 = new Patient(); p2.setId("P2"); p2.addName().setFamily("P2"); - myClient.update().resource(p2).execute().getId().toUnqualifiedVersionless(); + ourClient.update().resource(p2).execute().getId().toUnqualifiedVersionless(); Practitioner pract = new Practitioner(); pract.setId("PRAC"); pract.addName().setFamily("PRACT"); - myClient.update().resource(pract).execute().getId().toUnqualifiedVersionless(); + ourClient.update().resource(pract).execute().getId().toUnqualifiedVersionless(); Encounter enc = new Encounter(); enc.setId("E2"); @@ -2848,7 +2848,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { enc.setPeriod(new Period().setStart(new Date()).setEnd(new Date())); enc.getSubject().setReference("Patient/P2"); enc.addParticipant().getIndividual().setReference("Practitioner/PRAC"); - myClient.update().resource(enc).execute().getId().toUnqualifiedVersionless(); + ourClient.update().resource(enc).execute().getId().toUnqualifiedVersionless(); HttpGet get = new HttpGet(ourServerBase + "/Encounter?patient=P2&date=ge2017-01-01&_include:recurse=Encounter:practitioner&_lastUpdated=ge2017-11-10"); CloseableHttpResponse response = ourHttpClient.execute(get); @@ -2884,25 +2884,25 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSearchByReferenceIds() { Organization o1 = new Organization(); o1.setName("testSearchByResourceChainName01"); - IIdType o1id = myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); + IIdType o1id = ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); Organization o2 = new Organization(); o2.setName("testSearchByResourceChainName02"); - IIdType o2id = myClient.create().resource(o2).execute().getId().toUnqualifiedVersionless(); + IIdType o2id = ourClient.create().resource(o2).execute().getId().toUnqualifiedVersionless(); Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testSearchByReferenceIds01"); p1.addName().setFamily("testSearchByReferenceIdsFamily01").addGiven("testSearchByReferenceIdsGiven01"); p1.setManagingOrganization(new Reference(o1id.toUnqualifiedVersionless())); - IIdType p1Id = myClient.create().resource(p1).execute().getId(); + IIdType p1Id = ourClient.create().resource(p1).execute().getId(); Patient p2 = new Patient(); p2.addIdentifier().setSystem("urn:system").setValue("testSearchByReferenceIds02"); p2.addName().setFamily("testSearchByReferenceIdsFamily02").addGiven("testSearchByReferenceIdsGiven02"); p2.setManagingOrganization(new Reference(o2id.toUnqualifiedVersionless())); - IIdType p2Id = myClient.create().resource(p2).execute().getId(); + IIdType p2Id = ourClient.create().resource(p2).execute().getId(); //@formatter:off - Bundle actual = myClient.search() + Bundle actual = ourClient.search() .forResource(Patient.class) .where(Patient.ORGANIZATION.hasAnyOfIds(Arrays.asList(o1id.getIdPart(), o2id.getIdPart()))) .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); @@ -2922,16 +2922,16 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization o1 = new Organization(); o1.setName("testSearchByResourceChainName01"); - IdType o1id = (IdType) myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); + IdType o1id = (IdType) ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testSearchByResourceChain01"); p1.addName().setFamily("testSearchByResourceChainFamily01").addGiven("testSearchByResourceChainGiven01"); p1.setManagingOrganization(new Reference(o1id.toUnqualifiedVersionless())); - IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId(); + IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId(); //@formatter:off - Bundle actual = myClient.search() + Bundle actual = ourClient.search() .forResource(Patient.class) .where(Patient.ORGANIZATION.hasId(o1id.getIdPart())) .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); @@ -2940,7 +2940,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart()); //@formatter:off - actual = myClient.search() + actual = ourClient.search() .forResource(Patient.class) .where(Patient.ORGANIZATION.hasId(o1id.getValue())) .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); @@ -2985,14 +2985,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient patient = new Patient(); patient.addIdentifier().setSystem("urn:system").setValue("001"); patient.addName().setFamily(methodName).addGiven("Joe"); - id1a = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); + id1a = ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); } IIdType id1b; { Patient patient = new Patient(); patient.addIdentifier().setSystem("urn:system").setValue("002"); patient.addName().setFamily(methodName + "XXXX").addGiven("Joe"); - id1b = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); + id1b = ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); } Thread.sleep(1100); @@ -3004,12 +3004,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient patient = new Patient(); patient.addIdentifier().setSystem("urn:system").setValue("002"); patient.addName().setFamily(methodName).addGiven("John"); - id2 = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); + id2 = ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); } { //@formatter:off - Bundle found = myClient.search() + Bundle found = ourClient.search() .forResource(Patient.class) .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) .returnBundle(Bundle.class) @@ -3020,7 +3020,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } { //@formatter:off - Bundle found = myClient.search() + Bundle found = ourClient.search() .forResource(Patient.class) .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) .lastUpdated(new DateRangeParam(beforeAny, null)) @@ -3032,7 +3032,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } { //@formatter:off - Bundle found = myClient.search() + Bundle found = ourClient.search() .forResource(Patient.class) .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) .lastUpdated(new DateRangeParam(beforeR2, null)) @@ -3045,7 +3045,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } { //@formatter:off - Bundle found = myClient.search() + Bundle found = ourClient.search() .forResource(Patient.class) .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) .lastUpdated(new DateRangeParam(beforeAny, beforeR2)) @@ -3058,7 +3058,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } { //@formatter:off - Bundle found = myClient.search() + Bundle found = ourClient.search() .forResource(Patient.class) .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) .lastUpdated(new DateRangeParam(null, beforeR2)) @@ -3143,7 +3143,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { List linkNext = Lists.newArrayList(); for (int i = 0; i < 100; i++) { - Bundle bundle = myClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("testSearchPagingKeepsOldSearches")).count(5).returnBundle(Bundle.class).execute(); + Bundle bundle = ourClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("testSearchPagingKeepsOldSearches")).count(5).returnBundle(Bundle.class).execute(); assertTrue(isNotBlank(bundle.getLink("next").getUrl())); assertEquals(5, bundle.getEntry().size()); linkNext.add(bundle.getLink("next").getUrl()); @@ -3152,7 +3152,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { int index = 0; for (String nextLink : linkNext) { ourLog.info("Fetching index {}", index++); - Bundle b = myClient.fetchResourceFromUrl(Bundle.class, nextLink); + Bundle b = ourClient.fetchResourceFromUrl(Bundle.class, nextLink); assertEquals(5, b.getEntry().size()); } } @@ -3176,7 +3176,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Thread.sleep(1); //@formatter:off - Bundle found = myClient + Bundle found = ourClient .search() .forResource(Patient.class) .prettyPrint() @@ -3205,11 +3205,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("HELLO"); resources.add(org); } - myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); myDaoConfig.setReuseCachedSearchResultsForMillis(1000L); - Bundle result1 = myClient + Bundle result1 = ourClient .search() .forResource("Organization") .returnBundle(Bundle.class) @@ -3217,7 +3217,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { final String uuid1 = toSearchUuidFromLinkNext(result1); - Bundle result2 = myClient + Bundle result2 = ourClient .search() .forResource("Organization") .returnBundle(Bundle.class) @@ -3236,11 +3236,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("HELLO"); resources.add(org); } - myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); myDaoConfig.setReuseCachedSearchResultsForMillis(null); - Bundle result1 = myClient + Bundle result1 = ourClient .search() .forResource("Organization") .where(Organization.NAME.matches().value("HELLO")) @@ -3250,7 +3250,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { final String uuid1 = toSearchUuidFromLinkNext(result1); - Bundle result2 = myClient + Bundle result2 = ourClient .search() .forResource("Organization") .where(Organization.NAME.matches().value("HELLO")) @@ -3260,7 +3260,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { final String uuid2 = toSearchUuidFromLinkNext(result2); - Bundle result3 = myClient + Bundle result3 = ourClient .search() .forResource("Organization") .where(Organization.NAME.matches().value("HELLO")) @@ -3282,11 +3282,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("HELLO"); resources.add(org); } - myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); myDaoConfig.setReuseCachedSearchResultsForMillis(1000L); - Bundle result1 = myClient + Bundle result1 = ourClient .search() .forResource("Organization") .where(Organization.NAME.matches().value("HELLO")) @@ -3303,7 +3303,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { }); Date lastReturned1 = search1.getSearchLastReturned(); - Bundle result2 = myClient + Bundle result2 = ourClient .search() .forResource("Organization") .where(Organization.NAME.matches().value("HELLO")) @@ -3324,7 +3324,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Thread.sleep(1500); - Bundle result3 = myClient + Bundle result3 = ourClient .search() .forResource("Organization") .where(Organization.NAME.matches().value("HELLO")) @@ -3346,11 +3346,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("HELLO"); resources.add(org); } - myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); myDaoConfig.setReuseCachedSearchResultsForMillis(100000L); - Bundle result1 = myClient + Bundle result1 = ourClient .search() .forResource("Organization") .returnBundle(Bundle.class) @@ -3365,7 +3365,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { }); Date lastReturned1 = search1.getSearchLastReturned(); - Bundle result2 = myClient + Bundle result2 = ourClient .search() .forResource("Organization") .returnBundle(Bundle.class) @@ -3393,9 +3393,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient patient = new Patient(); patient.addIdentifier().setSystem("urn:system2").setValue("testSearchTokenParam002"); patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2"); - myClient.create().resource(patient).execute(); + ourClient.create().resource(patient).execute(); - Bundle response = myClient + Bundle response = ourClient .search() .forResource(Patient.class) .returnBundle(Bundle.class) @@ -3403,14 +3403,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { patient = (Patient) response.getEntry().get(0).getResource(); - myClient + ourClient .meta() .add() .onResource(patient.getIdElement()) .meta(new Meta().addTag("http://system", "tag1", "display")) .execute(); - response = myClient + response = ourClient .search() .forResource(Patient.class) .returnBundle(Bundle.class) @@ -3439,7 +3439,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2"); myPatientDao.create(patient, mySrd); - Bundle response = myClient + Bundle response = ourClient .search() .forResource(Patient.class) .where(Patient.IDENTIFIER.hasSystemWithAnyCode("urn:system")) @@ -3457,14 +3457,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { for (int i = 0; i < 10; i++) { Patient pat = new Patient(); pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i); - myClient.create().resource(pat).execute(); + ourClient.create().resource(pat).execute(); } StopWatch sw = new StopWatch(); ourLog.info("** About to search with count of 1"); - Bundle found = myClient + Bundle found = ourClient .search() .forResource(Patient.class) .returnBundle(Bundle.class) @@ -3500,12 +3500,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { for (int i = 0; i < 10; i++) { Patient pat = new Patient(); pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i); - myClient.create().resource(pat).execute(); + ourClient.create().resource(pat).execute(); } StopWatch sw = new StopWatch(); - Bundle found = myClient + Bundle found = ourClient .search() .forResource(Patient.class) .returnBundle(Bundle.class) @@ -3528,12 +3528,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { for (int i = 0; i < 10; i++) { Patient pat = new Patient(); pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i); - myClient.create().resource(pat).execute(); + ourClient.create().resource(pat).execute(); } StopWatch sw = new StopWatch(); - Bundle found = myClient + Bundle found = ourClient .search() .forResource(Patient.class) .returnBundle(Bundle.class) @@ -3559,7 +3559,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Observation obs = new Observation(); obs.setStatus(ObservationStatus.FINAL); obs.getCode().addCoding().setSystem("foo").setCode("bar"); - myClient.create().resource(obs).execute(); + ourClient.create().resource(obs).execute(); testSearchWithEmptyParameter("/Observation?value-quantity="); testSearchWithEmptyParameter("/Observation?code=bar&value-quantity="); @@ -3583,14 +3583,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSearchWithInclude() { Organization org = new Organization(); org.addIdentifier().setSystem("urn:system:rpdstu2").setValue("testSearchWithInclude01"); - IdType orgId = (IdType) myClient.create().resource(org).prettyPrint().encodedXml().execute().getId(); + IdType orgId = (IdType) ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId(); Patient pat = new Patient(); pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("testSearchWithInclude02"); pat.getManagingOrganization().setReferenceElement(orgId.toUnqualifiedVersionless()); - myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); + ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); - Bundle found = myClient + Bundle found = ourClient .search() .forResource(Patient.class) .where(Patient.IDENTIFIER.exactly().systemAndIdentifier("urn:system:rpdstu2", "testSearchWithInclude02")) @@ -3609,7 +3609,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test() public void testSearchWithInvalidNumberPrefix() { try { - myClient + ourClient .search() .forResource(ImmunizationRecommendation.class) .where(ImmunizationRecommendation.DOSE_NUMBER.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100)) @@ -3629,7 +3629,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myObservationDao.create(o, mySrd); try { //@formatter:off - myClient + ourClient .search() .forResource(Observation.class) .where(Observation.VALUE_QUANTITY.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100).andNoUnits()) @@ -3649,7 +3649,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { o.getCode().setText("testSearchWithInvalidSort"); myObservationDao.create(o, mySrd); //@formatter:off - myClient + ourClient .search() .forResource(Observation.class) .sort().ascending(Observation.CODE_VALUE_QUANTITY) // composite sort not supported yet @@ -3666,13 +3666,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { String methodName = "testSearchWithMissing"; Organization org = new Organization(); - IIdType deletedIdMissingTrue = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); - myClient.delete().resourceById(deletedIdMissingTrue).execute(); + IIdType deletedIdMissingTrue = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); + ourClient.delete().resourceById(deletedIdMissingTrue).execute(); org = new Organization(); org.setName("Help I'm a Bug"); - IIdType deletedIdMissingFalse = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); - myClient.delete().resourceById(deletedIdMissingFalse).execute(); + IIdType deletedIdMissingFalse = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); + ourClient.delete().resourceById(deletedIdMissingFalse).execute(); List resources = new ArrayList<>(); for (int i = 0; i < 20; i++) { @@ -3680,20 +3680,20 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName(methodName + "_0" + i); resources.add(org); } - myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); org = new Organization(); org.addIdentifier().setSystem("urn:system:rpdstu2").setValue(methodName + "01"); org.setName(methodName + "name"); - IIdType orgNotMissing = myClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless(); + IIdType orgNotMissing = ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless(); org = new Organization(); org.addIdentifier().setSystem("urn:system:rpdstu2").setValue(methodName + "01"); - IIdType orgMissing = myClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless(); + IIdType orgMissing = ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless(); { //@formatter:off - Bundle found = myClient + Bundle found = ourClient .search() .forResource(Organization.class) .where(Organization.NAME.isMissing(false)) @@ -3712,7 +3712,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } //@formatter:off - Bundle found = myClient + Bundle found = ourClient .search() .forResource(Organization.class) .where(Organization.NAME.isMissing(true)) @@ -3800,7 +3800,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Observation obs = new Observation(); obs.getCode().setText("THIS_IS_THE_TEXT"); obs.getCode().addCoding().setSystem("SYSTEM").setCode("CODE").setDisplay("THIS_IS_THE_DISPLAY"); - myClient.create().resource(obs).execute(); + ourClient.create().resource(obs).execute(); testSearchReturnsResults("/Observation?code%3Atext=THIS_IS_THE_TEXT"); testSearchReturnsResults("/Observation?code%3Atext=THIS_IS_THE_"); @@ -3813,25 +3813,25 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSelfReferentialInclude() { Location loc1 = new Location(); loc1.setName("loc1"); - IIdType loc1id = myClient.create().resource(loc1).execute().getId().toUnqualifiedVersionless(); + IIdType loc1id = ourClient.create().resource(loc1).execute().getId().toUnqualifiedVersionless(); Location loc2 = new Location(); loc2.setName("loc2"); - IIdType loc2id = myClient.create().resource(loc2).execute().getId().toUnqualifiedVersionless(); + IIdType loc2id = ourClient.create().resource(loc2).execute().getId().toUnqualifiedVersionless(); loc1 = new Location(); loc1.setId(loc1id); loc1.setName("loc1"); loc1.getPartOf().setReference(loc2id.getValue()); - myClient.update().resource(loc1).execute().getId().toUnqualifiedVersionless(); + ourClient.update().resource(loc1).execute().getId().toUnqualifiedVersionless(); loc2 = new Location(); loc2.setId(loc2id); loc2.setName("loc2"); loc2.getPartOf().setReference(loc1id.getValue()); - myClient.update().resource(loc2).execute().getId().toUnqualifiedVersionless(); + ourClient.update().resource(loc2).execute().getId().toUnqualifiedVersionless(); - IBaseBundle result = myClient + IBaseBundle result = ourClient .search() .forResource(Location.class) .where(Location.NAME.matches().value("loc1")) @@ -3844,25 +3844,25 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSelfReferentialRevInclude() { Location loc1 = new Location(); loc1.setName("loc1"); - IIdType loc1id = myClient.create().resource(loc1).execute().getId().toUnqualifiedVersionless(); + IIdType loc1id = ourClient.create().resource(loc1).execute().getId().toUnqualifiedVersionless(); Location loc2 = new Location(); loc2.setName("loc2"); - IIdType loc2id = myClient.create().resource(loc2).execute().getId().toUnqualifiedVersionless(); + IIdType loc2id = ourClient.create().resource(loc2).execute().getId().toUnqualifiedVersionless(); loc1 = new Location(); loc1.setId(loc1id); loc1.setName("loc1"); loc1.getPartOf().setReference(loc2id.getValue()); - myClient.update().resource(loc1).execute().getId().toUnqualifiedVersionless(); + ourClient.update().resource(loc1).execute().getId().toUnqualifiedVersionless(); loc2 = new Location(); loc2.setId(loc2id); loc2.setName("loc2"); loc2.getPartOf().setReference(loc1id.getValue()); - myClient.update().resource(loc2).execute().getId().toUnqualifiedVersionless(); + ourClient.update().resource(loc2).execute().getId().toUnqualifiedVersionless(); - IBaseBundle result = myClient + IBaseBundle result = ourClient .search() .forResource(Location.class) .where(Location.NAME.matches().value("loc1")) @@ -3876,15 +3876,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p = new Patient(); p.setId("p"); p.setActive(true); - myClient.update().resource(p).execute(); + ourClient.update().resource(p).execute(); CarePlan cp = new CarePlan(); cp.setId("cp"); cp.getSubject().setResource(p); cp.addActivity().getDetail().getCode().addCoding().setSystem("FOO").setCode("BAR"); - myClient.update().resource(cp).execute(); + ourClient.update().resource(cp).execute(); - Bundle b = myClient + Bundle b = ourClient .search() .forResource(CarePlan.class) .where(CarePlan.ACTIVITY_CODE.exactly().systemAndCode("FOO", "BAR")) @@ -3907,89 +3907,89 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Daniel").setFamily("Adams"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Aaron").setFamily("Alexis"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Carol").setFamily("Allen"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Ruth").setFamily("Black"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Brian").setFamily("Brooks"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Susan").setFamily("Clark"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Amy").setFamily("Clark"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Anthony").setFamily("Coleman"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Steven").setFamily("Coleman"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Lisa").setFamily("Coleman"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Ruth").setFamily("Cook"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Betty").setFamily("Davis"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Joshua").setFamily("Diaz"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Brian").setFamily("Gracia"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Stephan").setFamily("Graham"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Sarah").setFamily("Graham"); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); - Bundle resp = myClient + Bundle resp = ourClient .search() .forResource(Patient.class) .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", methodName)) @@ -4031,7 +4031,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org = new Organization(); org.setName("測試醫院"); org.addIdentifier().setSystem("urn:system").setValue("testStoreUtf8Characters_01"); - IdType orgId = (IdType) myClient.create().resource(org).prettyPrint().encodedXml().execute().getId(); + IdType orgId = (IdType) ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId(); // Read back directly from the DAO { @@ -4042,7 +4042,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } // Read back through the HTTP API { - Organization returned = myClient.read(Organization.class, orgId.getIdPart()); + Organization returned = ourClient.read(Organization.class, orgId.getIdPart()); String val = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(returned); ourLog.info(val); assertThat(val, containsString("")); @@ -4072,7 +4072,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.setManagingOrganization(new Reference("Organization/99999999999")); try { - myClient.create().resource(p1).execute().getId(); + ourClient.create().resource(p1).execute().getId(); fail(); } catch (InvalidRequestException e) { assertThat(e.getMessage(), containsString("Organization/99999999999")); @@ -4158,7 +4158,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsInvalidTypes"); p1.addName().setFamily("Tester").addGiven("testUpdateRejectsInvalidTypes"); - IdType p1id = (IdType) myClient.create().resource(p1).execute().getId(); + IdType p1id = (IdType) ourClient.create().resource(p1).execute().getId(); // Try to update with the wrong ID in the resource body p1.setId("FOO"); @@ -4219,20 +4219,20 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsInvalidTypes"); p1.addName().setFamily("Tester").addGiven("testUpdateRejectsInvalidTypes"); - IdType p1id = (IdType) myClient.create().resource(p1).execute().getId(); + IdType p1id = (IdType) ourClient.create().resource(p1).execute().getId(); Organization p2 = new Organization(); p2.setId(p1id.getIdPart()); p2.getNameElement().setValue("testUpdateRejectsInvalidTypes"); try { - myClient.update().resource(p2).withId("Organization/" + p1id.getIdPart()).execute(); + ourClient.update().resource(p2).withId("Organization/" + p1id.getIdPart()).execute(); fail(); } catch (UnprocessableEntityException e) { // good } try { - myClient.update().resource(p2).withId("Patient/" + p1id.getIdPart()).execute(); + ourClient.update().resource(p2).withId("Patient/" + p1id.getIdPart()).execute(); fail(); } catch (UnprocessableEntityException e) { // good @@ -4408,14 +4408,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2"); - MethodOutcome outcome = myClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute(); + MethodOutcome outcome = ourClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute(); assertEquals(true, outcome.getCreated().booleanValue()); IdType p1Id = (IdType) outcome.getId(); assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2/_history")); //@formatter:off - Bundle actual = myClient + Bundle actual = ourClient .search() .forResource(Patient.class) .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2")) @@ -4436,7 +4436,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient pt = new Patient(); pt.addName().setFamily(methodName); - IIdType id = myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); + IIdType id = ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); pt.addName().setFamily("FAM2"); pt.setId(id.toUnqualifiedVersionless()); @@ -4501,12 +4501,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { String input = IOUtils.toString(getClass().getResourceAsStream("/dstu3-person.json"), StandardCharsets.UTF_8); try { - MethodOutcome resp = myClient.update().resource(input).withId("Patient/PERSON1").execute(); + MethodOutcome resp = ourClient.update().resource(input).withId("Patient/PERSON1").execute(); } catch (InvalidRequestException e) { assertEquals("", e.getMessage()); } - MethodOutcome resp = myClient.update().resource(input).withId("Person/PERSON1").execute(); + MethodOutcome resp = ourClient.update().resource(input).withId("Person/PERSON1").execute(); assertEquals("Person/PERSON1/_history/1", resp.getId().toUnqualified().getValue()); } @@ -4715,10 +4715,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testValueSetExpandOperation() throws IOException { CodeSystem cs = myFhirCtx.newXmlParser().parseResource(CodeSystem.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/extensional-case-3-cs.xml"))); - myClient.create().resource(cs).execute(); + ourClient.create().resource(cs).execute(); ValueSet upload = myFhirCtx.newXmlParser().parseResource(ValueSet.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/extensional-case-3-vs.xml"))); - IIdType vsid = myClient.create().resource(upload).execute().getId().toUnqualifiedVersionless(); + IIdType vsid = ourClient.create().resource(upload).execute().getId().toUnqualifiedVersionless(); HttpGet get = new HttpGet(ourServerBase + "/ValueSet/" + vsid.getIdPart() + "/$expand"); CloseableHttpResponse response = ourHttpClient.execute(get); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java index df5af636f79..29e8e0f549d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java @@ -121,7 +121,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { @Test public void testExpandById() throws IOException { //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onInstance(myExtensionalVsId) .named("expand") @@ -152,7 +152,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { public void testExpandByIdWithFilter() throws IOException { //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onInstance(myExtensionalVsId) .named("expand") @@ -170,7 +170,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { @Test public void testExpandByUrl() { - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(ValueSet.class) .named("expand") @@ -190,7 +190,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { public void testExpandByValueSet() throws IOException { ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml"); - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(ValueSet.class) .named("expand") @@ -213,7 +213,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { assertNotNull(myLocalValueSetId); //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(ValueSet.class) .named("expand") @@ -235,7 +235,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { myLocalVs.setId(""); //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(ValueSet.class) .named("expand") @@ -257,7 +257,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { public void testExpandInvalidParams() throws IOException { //@formatter:off try { - myClient + ourClient .operation() .onType(ValueSet.class) .named("expand") @@ -272,7 +272,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { //@formatter:off try { ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/r4/extensional-case-r4.xml"); - myClient + ourClient .operation() .onType(ValueSet.class) .named("expand") @@ -288,7 +288,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { //@formatter:off try { ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/r4/extensional-case.xml"); - myClient + ourClient .operation() .onInstance(myExtensionalVsId) .named("expand") @@ -309,7 +309,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { assertNotNull(myLocalValueSetId); //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onInstance(myLocalValueSetId) .named("expand") @@ -330,7 +330,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { assertNotNull(myLocalValueSetId); //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onInstance(myLocalValueSetId) .named("expand") @@ -354,7 +354,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { assertNotNull(myLocalValueSetId); //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(ValueSet.class) .named("expand") @@ -379,7 +379,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { //@formatter:off try { - myClient + ourClient .operation() .onInstance(myLocalValueSetId) .named("expand") @@ -419,7 +419,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { @Test public void testValidateCodeOperationByCodeAndSystemInstance() { //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onInstance(myExtensionalVsId) .named("validate-code") @@ -437,7 +437,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { @Test public void testValidateCodeOperationByCodeAndSystemType() { //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(ValueSet.class) .named("validate-code") @@ -454,7 +454,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { @Test public void testValiedateCodeAgainstBuiltInSystem() { - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onType(ValueSet.class) .named("validate-code") diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ServerR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ServerR4Test.java index ca9766e73f3..d80dd679964 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ServerR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ServerR4Test.java @@ -65,7 +65,7 @@ public class ServerR4Test extends BaseResourceProviderR4Test { public void testMetadataIncludesResourceCounts() { Patient p = new Patient(); p.setActive(true); - myClient.create().resource(p).execute(); + ourClient.create().resource(p).execute(); /* * Initial fetch after a clear should return @@ -73,7 +73,7 @@ public class ServerR4Test extends BaseResourceProviderR4Test { */ ourResourceCountsCache.clear(); - CapabilityStatement capabilityStatement = myClient + CapabilityStatement capabilityStatement = ourClient .capabilities() .ofType(CapabilityStatement.class) .execute(); @@ -95,7 +95,7 @@ public class ServerR4Test extends BaseResourceProviderR4Test { */ ourResourceCountsCache.update(); - capabilityStatement = myClient + capabilityStatement = ourClient .capabilities() .ofType(CapabilityStatement.class) .execute(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java index 998e8250a57..8334a1d3bd8 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java @@ -56,7 +56,7 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test { } //@formatter:off - IClientExecutable, Bundle> search = myClient + IClientExecutable, Bundle> search = ourClient .search() .forResource(Patient.class) .where(Patient.NAME.matches().value("Everything")) @@ -74,12 +74,12 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test { String nextLinkUrl = nextLink.getUrl(); assertThat(nextLinkUrl, not(blankOrNullString())); - Bundle resp2 = myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); + Bundle resp2 = ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp2)); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); - myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); + ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); Thread.sleep(20); myDaoConfig.setExpireSearchResultsAfterMillis(10); @@ -87,7 +87,7 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test { myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); try { - myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); + ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); fail(); } catch (ResourceGoneException e) { assertThat(e.getMessage(), containsString("does not exist and may have expired")); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java index 8724c3fdffa..eac3edd6280 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java @@ -57,7 +57,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.getChannel().setEndpoint("http://localhost:8888"); subs.setCriteria("Observation?identifier=123"); try { - myClient.create().resource(subs).execute(); + ourClient.create().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server")); @@ -65,14 +65,14 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.setId("ABC"); try { - myClient.update().resource(subs).execute(); + ourClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server")); } subs.setStatus(SubscriptionStatus.REQUESTED); - myClient.update().resource(subs).execute(); + ourClient.update().resource(subs).execute(); } @Test @@ -84,7 +84,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.setStatus(SubscriptionStatus.ACTIVE); subs.setCriteria("Observation?identifier=123"); try { - myClient.create().resource(subs).execute(); + ourClient.create().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage()); @@ -92,7 +92,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.setId("ABC"); try { - myClient.update().resource(subs).execute(); + ourClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage()); @@ -109,13 +109,13 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.getChannel().setEndpoint("http://localhost:8888"); subs.setStatus(SubscriptionStatus.REQUESTED); subs.setCriteria("Observation?identifier=123"); - IIdType id = myClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); + IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); subs.setId(id); try { subs.setStatus(SubscriptionStatus.ACTIVE); - myClient.update().resource(subs).execute(); + ourClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: Subscription.status can not be changed from 'requested' to 'active'", e.getMessage()); @@ -123,7 +123,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { try { subs.setStatus((SubscriptionStatus) null); - myClient.update().resource(subs).execute(); + ourClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server")); @@ -141,12 +141,12 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.getChannel().setEndpoint("http://localhost:8888"); subs.setCriteria("Observation?identifier=123"); subs.setStatus(SubscriptionStatus.REQUESTED); - IIdType id = myClient.create().resource(subs).execute().getId(); + IIdType id = ourClient.create().resource(subs).execute().getId(); subs.setId(id); try { subs.setStatus(SubscriptionStatus.ACTIVE); - myClient.update().resource(subs).execute(); + ourClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: Subscription.status can not be changed from 'requested' to 'active'", e.getMessage()); @@ -154,14 +154,14 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { try { subs.setStatus((SubscriptionStatus) null); - myClient.update().resource(subs).execute(); + ourClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server")); } subs.setStatus(SubscriptionStatus.OFF); - myClient.update().resource(subs).execute(); + ourClient.update().resource(subs).execute(); } @AfterClass diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java index ddb99e5f82a..a58a970dbc2 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java @@ -47,7 +47,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes //@formatter:off try { - myClient + ourClient .operation() .onServer() .named("upload-external-code-system") @@ -66,7 +66,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes byte[] packageBytes = TerminologyUploaderProviderDstu3Test.createLoincZip(); //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onServer() .named("upload-external-code-system") @@ -86,7 +86,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes */ //@formatter:off - respParam = myClient + respParam = ourClient .operation() .onServer() .named("upload-external-code-system") @@ -104,7 +104,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes public void testUploadMissingPackage() throws Exception { //@formatter:off try { - myClient + ourClient .operation() .onServer() .named("upload-external-code-system") @@ -123,7 +123,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes //@formatter:off try { - myClient + ourClient .operation() .onServer() .named("upload-external-code-system") @@ -141,7 +141,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes byte[] packageBytes = createSctZip(); //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onServer() .named("upload-external-code-system") @@ -167,7 +167,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes fos.close(); //@formatter:off - Parameters respParam = myClient + Parameters respParam = ourClient .operation() .onServer() .named("upload-external-code-system") diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java index 121debf6f37..851f28a3dbf 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java @@ -61,7 +61,7 @@ public class PagingMultinodeProviderR4Test extends BaseResourceProviderR4Test { mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10); mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true); - found = myClient + found = ourClient .search() .forResource(Patient.class) .sort().ascending(Patient.SP_FAMILY) @@ -70,19 +70,19 @@ public class PagingMultinodeProviderR4Test extends BaseResourceProviderR4Test { .execute(); assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A000", "Patient/A001", "Patient/A002", "Patient/A003", "Patient/A004", "Patient/A005", "Patient/A006", "Patient/A007", "Patient/A008", "Patient/A009")); - found = myClient + found = ourClient .loadPage() .next(found) .execute(); assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A010", "Patient/A011", "Patient/A012", "Patient/A013", "Patient/A014", "Patient/A015", "Patient/A016", "Patient/A017", "Patient/A018", "Patient/A019")); - found = myClient + found = ourClient .loadPage() .next(found) .execute(); assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A020", "Patient/A021", "Patient/A022", "Patient/A023", "Patient/A024", "Patient/A025", "Patient/A026", "Patient/A027", "Patient/A028", "Patient/A029")); - found = myClient + found = ourClient .loadPage() .next(found) .execute(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java index ad9eaacd2d4..c859ad33ef1 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java @@ -66,7 +66,7 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc channel.setPayload(thePayload); channel.setEndpoint(theEndpoint); - MethodOutcome methodOutcome = myClient.create().resource(subscription).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); subscription.setId(methodOutcome.getId().getIdPart()); waitForQueueToDrain(); @@ -83,7 +83,7 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome = myClient.create().resource(observation).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(observation).execute(); String observationId = methodOutcome.getId().getIdPart(); observation.setId(observationId); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java index 4de1ab758ac..de191913c62 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java @@ -2,7 +2,6 @@ package ca.uhn.fhir.jpa.subscription.r4; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2; import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.subscription.RestHookTestDstu2Test; import ca.uhn.fhir.jpa.util.JpaConstants; @@ -55,14 +54,14 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { for (IIdType next : mySubscriptionIds) { IIdType nextId = next.toUnqualifiedVersionless(); ourLog.info("Deleting: {}", nextId); - myClient.delete().resourceById(nextId).execute(); + ourClient.delete().resourceById(nextId).execute(); } mySubscriptionIds.clear(); myDaoConfig.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); - myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); - myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); + ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); + ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); @@ -93,7 +92,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { channel.setPayload(thePayload); channel.setEndpoint(theEndpoint); - MethodOutcome methodOutcome = myClient.create().resource(subscription).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); subscription.setId(methodOutcome.getId().getIdPart()); mySubscriptionIds.add(methodOutcome.getId()); @@ -111,7 +110,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome = myClient.create().resource(observation).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(observation).execute(); String observationId = methodOutcome.getId().getIdPart(); observation.setId(observationId); @@ -160,7 +159,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { // Send an update with no changes obs.setId(obs.getIdElement().toUnqualifiedVersionless()); - myClient.update().resource(obs).execute(); + ourClient.update().resource(obs).execute(); // Should be no further deliveries Thread.sleep(1000); @@ -189,7 +188,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { subscription1 .getChannel() .addExtension(JpaConstants.EXT_SUBSCRIPTION_RESTHOOK_DELIVER_LATEST_VERSION, new BooleanType("true")); - myClient.update().resource(subscription1).execute(); + ourClient.update().resource(subscription1).execute(); waitForQueueToDrain(); Observation observation1 = sendObservation(code, "SNOMED-CT"); @@ -226,11 +225,11 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { assertEquals("1", ourUpdatedObservations.get(0).getIdElement().getVersionIdPart()); - Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId()); + Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); Assert.assertNotNull(subscriptionTemp); subscriptionTemp.setCriteria(criteria1); - myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); waitForQueueToDrain(); Observation observation2 = sendObservation(code, "SNOMED-CT"); @@ -240,7 +239,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(0, ourCreatedObservations); waitForSize(3, ourUpdatedObservations); - myClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute(); + ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute(); waitForQueueToDrain(); Observation observationTemp3 = sendObservation(code, "SNOMED-CT"); @@ -250,27 +249,27 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3 = myClient.read(Observation.class, observationTemp3.getId()); + Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept = new CodeableConcept(); observation3.setCode(codeableConcept); Coding coding = codeableConcept.addCoding(); coding.setCode(code + "111"); coding.setSystem("SNOMED-CT"); - myClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); + ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); // Should see no subscription notification waitForQueueToDrain(); waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3a = myClient.read(Observation.class, observationTemp3.getId()); + Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept1 = new CodeableConcept(); observation3a.setCode(codeableConcept1); Coding coding1 = codeableConcept1.addCoding(); coding1.setCode(code); coding1.setSystem("SNOMED-CT"); - myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); + ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); // Should see only one subscription notification waitForQueueToDrain(); @@ -301,10 +300,10 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(1, ourUpdatedObservations); assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0)); - Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId()); + Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); Assert.assertNotNull(subscriptionTemp); subscriptionTemp.setCriteria(criteria1); - myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); waitForQueueToDrain(); Observation observation2 = sendObservation(code, "SNOMED-CT"); @@ -314,7 +313,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(0, ourCreatedObservations); waitForSize(3, ourUpdatedObservations); - myClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute(); + ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute(); Observation observationTemp3 = sendObservation(code, "SNOMED-CT"); @@ -323,27 +322,27 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3 = myClient.read(Observation.class, observationTemp3.getId()); + Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept = new CodeableConcept(); observation3.setCode(codeableConcept); Coding coding = codeableConcept.addCoding(); coding.setCode(code + "111"); coding.setSystem("SNOMED-CT"); - myClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); + ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); // Should see no subscription notification waitForQueueToDrain(); waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3a = myClient.read(Observation.class, observationTemp3.getId()); + Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept1 = new CodeableConcept(); observation3a.setCode(codeableConcept1); Coding coding1 = codeableConcept1.addCoding(); coding1.setCode(code); coding1.setSystem("SNOMED-CT"); - myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); + ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); // Should see only one subscription notification waitForQueueToDrain(); @@ -403,7 +402,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { subscription.getChannel().addHeader("X-Foo: FOO"); subscription.getChannel().addHeader("X-Bar: BAR"); subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED); - myClient.update().resource(subscription).execute(); + ourClient.update().resource(subscription).execute(); waitForQueueToDrain(); sendObservation(code, "SNOMED-CT"); @@ -434,7 +433,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { // Disable subscription.setStatus(Subscription.SubscriptionStatus.OFF); - myClient.update().resource(subscription).execute(); + ourClient.update().resource(subscription).execute(); waitForQueueToDrain(); // Send another object diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java index 32e418e82a8..56560a12a6e 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java @@ -44,7 +44,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base public void afterUnregisterRestHookListener() { myDaoConfig.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); - myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); + ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); ourLog.info("Done deleting all subscriptions"); myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); @@ -74,7 +74,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base channel.setEndpoint(endpoint); subscription.setChannel(channel); - MethodOutcome methodOutcome = myClient.create().resource(subscription).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); subscription.setId(methodOutcome.getId().getIdPart()); waitForQueueToDrain(); @@ -99,7 +99,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome = myClient.create().resource(observation).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(observation).execute(); String observationId = methodOutcome.getId().getIdPart(); observation.setId(observationId); @@ -127,11 +127,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(1, ourUpdatedObservations); - Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId()); + Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); Assert.assertNotNull(subscriptionTemp); subscriptionTemp.setCriteria(criteria1); - myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); Observation observation2 = sendObservation(code, "SNOMED-CT"); @@ -141,7 +141,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(3, ourUpdatedObservations); - myClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute(); + ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute(); Observation observationTemp3 = sendObservation(code, "SNOMED-CT"); @@ -150,27 +150,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3 = myClient.read(Observation.class, observationTemp3.getId()); + Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept = new CodeableConcept(); observation3.setCode(codeableConcept); Coding coding = codeableConcept.addCoding(); coding.setCode(code + "111"); coding.setSystem("SNOMED-CT"); - myClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); + ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); // Should see no subscription notification Thread.sleep(500); waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3a = myClient.read(Observation.class, observationTemp3.getId()); + Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept1 = new CodeableConcept(); observation3a.setCode(codeableConcept1); Coding coding1 = codeableConcept1.addCoding(); coding1.setCode(code); coding1.setSystem("SNOMED-CT"); - myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); + ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); // Should see only one subscription notification Thread.sleep(500); @@ -200,11 +200,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(1, ourUpdatedObservations); - Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId()); + Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); Assert.assertNotNull(subscriptionTemp); subscriptionTemp.setCriteria(criteria1); - myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); Observation observation2 = sendObservation(code, "SNOMED-CT"); @@ -214,7 +214,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(3, ourUpdatedObservations); - myClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute(); + ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute(); Observation observationTemp3 = sendObservation(code, "SNOMED-CT"); @@ -223,27 +223,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3 = myClient.read(Observation.class, observationTemp3.getId()); + Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept = new CodeableConcept(); observation3.setCode(codeableConcept); Coding coding = codeableConcept.addCoding(); coding.setCode(code + "111"); coding.setSystem("SNOMED-CT"); - myClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); + ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); // Should see no subscription notification waitForQueueToDrain(); waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3a = myClient.read(Observation.class, observationTemp3.getId()); + Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept1 = new CodeableConcept(); observation3a.setCode(codeableConcept1); Coding coding1 = codeableConcept1.addCoding(); coding1.setCode(code); coding1.setSystem("SNOMED-CT"); - myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); + ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); // Should see only one subscription notification waitForQueueToDrain(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java index d32b823f680..2a0eae5a583 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java @@ -52,14 +52,14 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes @After public void afterUnregisterRestHookListener() { for (IIdType next : mySubscriptionIds) { - myClient.delete().resourceById(next).execute(); + ourClient.delete().resourceById(next).execute(); } mySubscriptionIds.clear(); myDaoConfig.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); - myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); - myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); + ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); + ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); @@ -83,7 +83,7 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes */ Patient patient = FhirR4Util.getPatient(); - MethodOutcome methodOutcome = myClient.create().resource(patient).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(patient).execute(); myPatientId = methodOutcome.getId().getIdPart(); /* @@ -114,7 +114,7 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes channel.setPayload("application/json"); subscription.setChannel(channel); - methodOutcome = myClient.create().resource(subscription).execute(); + methodOutcome = ourClient.create().resource(subscription).execute(); mySubscriptionId = methodOutcome.getId().getIdPart(); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java index 316c9caeba3..dfe9b283c9f 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java @@ -49,7 +49,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { */ Patient patient = FhirR4Util.getPatient(); - MethodOutcome methodOutcome = myClient.create().resource(patient).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(patient).execute(); myPatientId = methodOutcome.getId().getIdPart(); /* @@ -66,7 +66,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { channel.setPayload("application/json"); subscription.setChannel(channel); - methodOutcome = myClient.create().resource(subscription).execute(); + methodOutcome = ourClient.create().resource(subscription).execute(); mySubscriptionId = methodOutcome.getId().getIdPart(); /* @@ -105,7 +105,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { observation.setSubject(reference); observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute(); + MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute(); String observationId = methodOutcome2.getId().getIdPart(); observation.setId(observationId); @@ -129,7 +129,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { observation.setSubject(reference); observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute(); + MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute(); String observationId = methodOutcome2.getId().getIdPart(); observation.setId(observationId); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java index 90a973e69e6..4aca0fcc419 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java @@ -72,7 +72,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes */ Patient patient = FhirR4Util.getPatient(); - MethodOutcome methodOutcome = myClient.create().resource(patient).execute(); + MethodOutcome methodOutcome = ourClient.create().resource(patient).execute(); myPatientId = methodOutcome.getId().getIdPart(); /* @@ -89,7 +89,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes channel.setPayload("application/json"); subscription.setChannel(channel); - methodOutcome = myClient.create().resource(subscription).execute(); + methodOutcome = ourClient.create().resource(subscription).execute(); mySubscriptionId = methodOutcome.getId().getIdPart(); /* @@ -122,7 +122,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes observation.setSubject(reference); observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute(); + MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute(); String observationId = methodOutcome2.getId().getIdPart(); observation.setId(observationId); @@ -146,7 +146,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes observation.setSubject(reference); observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute(); + MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute(); String observationId = methodOutcome2.getId().getIdPart(); observation.setId(observationId);