added R4 document operation & merge master

This commit is contained in:
patrick-werner 2018-07-11 16:21:13 +02:00
parent 68772f1e3a
commit b275d20aba
34 changed files with 710 additions and 577 deletions

View File

@ -34,11 +34,8 @@ import javax.servlet.http.HttpServletRequest;
public class FhirResourceDaoCompositionDstu2 extends FhirResourceDaoDstu2<Composition>implements IFhirResourceDaoComposition<Composition> {
@Autowired
private ISearchParamRegistry mySearchParamRegistry;
@Override
public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) {
throw new NotImplementedOperationException("$document in DSTU2 is not implemented ");
throw new NotImplementedOperationException("$document not implemented in DSTU2");
}
}

View File

@ -39,9 +39,6 @@ import java.util.Collections;
public class FhirResourceDaoCompositionDstu3 extends FhirResourceDaoDstu3<Composition> implements IFhirResourceDaoComposition<Composition> {
@Autowired
private ISearchParamRegistry mySearchParamRegistry;
@Override
public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdate, SortSpec theSort, RequestDetails theRequestDetails) {
SearchParameterMap paramMap = new SearchParameterMap();

View File

@ -41,9 +41,6 @@ import ca.uhn.fhir.rest.param.*;
public class FhirResourceDaoPatientDstu3 extends FhirResourceDaoDstu3<Patient>implements IFhirResourceDaoPatient<Patient> {
@Autowired
private ISearchParamRegistry mySerarchParamRegistry;
private IBundleProvider doEverythingOperation(IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, RequestDetails theRequestDetails) {
SearchParameterMap paramMap = new SearchParameterMap();
if (theCount != null) {

View File

@ -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 FhirResourceDaoR4<Composition>implements IFhirResourceDaoComposition<Composition> {
@Autowired
private ISearchParamRegistry mySearchParamRegistry;
@Override
public IBundleProvider getDocumentForComposition(HttpServletRequest theServletRequest, IIdType theId, IPrimitiveType<Integer> 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;
}
}

View File

@ -41,9 +41,6 @@ import ca.uhn.fhir.rest.param.*;
public class FhirResourceDaoPatientR4 extends FhirResourceDaoR4<Patient>implements IFhirResourceDaoPatient<Patient> {
@Autowired
private ISearchParamRegistry mySerarchParamRegistry;
private IBundleProvider doEverythingOperation(IIdType theId, IPrimitiveType<Integer> theCount, DateRangeParam theLastUpdated, SortSpec theSort, StringAndListParam theContent, StringAndListParam theNarrative, RequestDetails theRequestDetails) {
SearchParameterMap paramMap = new SearchParameterMap();
if (theCount != null) {

View File

@ -81,13 +81,6 @@ public class BaseJpaResourceProviderCompositionDstu3 extends JpaResourceProvider
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;
}
}
return bundle;
} finally {

View File

@ -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,10 +43,11 @@ 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,
@ -71,8 +72,15 @@ public class BaseJpaResourceProviderCompositionR4 extends JpaResourceProviderR4<
startRequest(theServletRequest);
try {
((IFhirResourceDaoComposition<Composition>) getDao()).getDocumentForComposition(theServletRequest, theId, theCount, theLastUpdated, theSortSpec, theRequestDetails);
return null;
IBundleProvider bundleProvider = ((IFhirResourceDaoComposition<Composition>) getDao()).getDocumentForComposition(theServletRequest, theId, theCount, theLastUpdated, theSortSpec, theRequestDetails);
List<IBaseResource> 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);
}

View File

@ -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;
}

View File

@ -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

View File

@ -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());
}
}

View File

@ -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<String> 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<Observation> myObs = new ArrayList<>();
myObsIds = new ArrayList<String>();
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<String> 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();
}
}

View File

@ -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();
}

View File

@ -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<String>();
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);
}

View File

@ -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<String> 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<String> foundResources;
Bundle result;
result = myClient
result = ourClient
.search()
.forResource(Patient.class)
.where(new TokenClientParam("foo").exactly().code("male"))

View File

@ -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")

View File

@ -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();

View File

@ -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"));

View File

@ -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());

View File

@ -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));

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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();

View File

@ -56,7 +56,7 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test {
}
//@formatter:off
IClientExecutable<IQuery<Bundle>, Bundle> search = myClient
IClientExecutable<IQuery<Bundle>, 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"));

View File

@ -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

View File

@ -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")

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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();

View File

@ -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();
}

View File

@ -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);

View File

@ -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);