Post release HAPI FHIR cleanup (#4266)

* POST release deferred cleanup

* Fixes

* One more test fix

* Test fixes

* Test fixes

* Test cleanup

* Test fixes

* Fixes

* ValueSet cleanup

* Test fix

* Test fixes

* Fixes

* Test fixes

* Fixed

* Test fixes

* Test fixes

* Test fixes

* Test fixes

* Test fixc

* Build fix

* Fix merge artifact

* Build fix

* Work on tests

* Test fixes

* Work

* Fixes

* Changelog fix

* Add changelog

* Test fix

* Test fixes

* Fixes

* Test fixes

* Test fixes

* Test fixes

* Test fix

* Tests

* Bumps

* Fixes

* Add errorprone

* Drop bz2 bins

* POM fix

* Build fix

* Update

* Test fix

* Fix tests

* Add changelog

* Test fix

* Avoid intermittent

Co-authored-by: James Agnew <james@jamess-mbp.lan>
This commit is contained in:
James Agnew 2022-11-09 13:28:00 -05:00 committed by GitHub
parent 145f22c3df
commit f50d350f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
96 changed files with 2027 additions and 1910 deletions

View File

@ -80,7 +80,7 @@ public class RuntimeChildChoiceDefinition extends BaseRuntimeDeclaredChildDefini
@Override
public BaseRuntimeElementDefinition<?> getChildByName(String theName) {
assert myNameToChildDefinition.containsKey(theName);
assert myNameToChildDefinition.containsKey(theName) : "Can't find child '" + theName + "' in names: " + myNameToChildDefinition.keySet();
return myNameToChildDefinition.get(theName);
}

View File

@ -0,0 +1,5 @@
---
type: add
issue: 4266
title: "The JPA server can now handle indexing search parameters of type `token` and `reference` where
the value is a CodeableReference (a new datatype added in R5)."

View File

@ -0,0 +1,5 @@
---
type: add
issue: 4266
title: "The JPA server can now handle indexing search parameters of type `number` where the value
is a Range, e.g. RiskAssessment.probability."

View File

@ -90,7 +90,7 @@ public class ResourceProviderR4ElasticTest extends BaseResourceProviderR4Test {
createObservationWithCode(mean_blood_pressure);
// when
HttpGet expandQuery = new HttpGet(ourServerBase + "/ValueSet/$expand?contextDirection=existing&context=Observation.code:text&filter=pressure");
HttpGet expandQuery = new HttpGet(myServerBase + "/ValueSet/$expand?contextDirection=existing&context=Observation.code:text&filter=pressure");
try (CloseableHttpResponse response = BaseResourceProviderR4Test.ourHttpClient.execute(expandQuery)) {
// then
@ -167,7 +167,7 @@ public class ResourceProviderR4ElasticTest extends BaseResourceProviderR4Test {
Coding blood_count = new Coding("http://loinc.org", "789-8", "Erythrocytes in Blood by Automated count for code: " + (index + 1));
createObservationWithCode(blood_count);
});
HttpGet countQuery = new HttpGet(ourServerBase + "/Observation?code=789-8&_count=5&_total=accurate");
HttpGet countQuery = new HttpGet(myServerBase + "/Observation?code=789-8&_count=5&_total=accurate");
myCaptureQueriesListener.clear();
try (CloseableHttpResponse response = BaseResourceProviderR4Test.ourHttpClient.execute(countQuery)) {
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
@ -188,7 +188,7 @@ public class ResourceProviderR4ElasticTest extends BaseResourceProviderR4Test {
Coding blood_count = new Coding("http://loinc.org", "789-8", "Erythrocytes in Blood by Automated count for code: " + (index + 1));
createObservationWithCode(blood_count);
});
HttpGet countQuery = new HttpGet(ourServerBase + "/Observation?code=789-8&_count=0");
HttpGet countQuery = new HttpGet(myServerBase + "/Observation?code=789-8&_count=0");
myCaptureQueriesListener.clear();
try (CloseableHttpResponse response = BaseResourceProviderR4Test.ourHttpClient.execute(countQuery)) {
myCaptureQueriesListener.logSelectQueriesForCurrentThread();

View File

@ -155,6 +155,8 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
private BaseRuntimeChildDefinition myCodingDisplayValueChild;
private BaseRuntimeChildDefinition myContactPointSystemValueChild;
private BaseRuntimeChildDefinition myPatientCommunicationLanguageValueChild;
private BaseRuntimeChildDefinition myCodeableReferenceConcept;
private BaseRuntimeChildDefinition myCodeableReferenceReference;
/**
* Constructor
@ -435,8 +437,9 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
};
}
private void addUnexpectedDatatypeWarning(SearchParamSet<?> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
theParams.addWarning("Search param " + theSearchParam.getName() + " is of unexpected datatype: " + theValue.getClass());
private void addUnexpectedDatatypeWarning(SearchParamSet<?> theParams, RuntimeSearchParam theSearchParam, IBase theValue, String thePath) {
String typeDesc = myContext.getElementDefinition(theValue.getClass()).getName();
theParams.addWarning("Search param " + theSearchParam.getBase() + "#" + theSearchParam.getName() + " is unable to index value of type " + typeDesc + " as a " + theSearchParam.getParamType().name() + " at path: " + thePath);
}
@Override
@ -458,7 +461,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
addUri_Uri(resourceType, params, searchParam, value);
break;
default:
addUnexpectedDatatypeWarning(params, searchParam, value);
addUnexpectedDatatypeWarning(params, searchParam, value, path);
break;
}
};
@ -505,8 +508,11 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
case "decimal":
addNumber_Decimal(resourceType, params, searchParam, value);
break;
case "Range":
addNumber_Range(resourceType, params, searchParam, value);
break;
default:
addUnexpectedDatatypeWarning(params, searchParam, value);
addUnexpectedDatatypeWarning(params, searchParam, value, path);
break;
}
};
@ -559,7 +565,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
addQuantity_Range(resourceType, params, searchParam, value);
break;
default:
addUnexpectedDatatypeWarning(params, searchParam, value);
addUnexpectedDatatypeWarning(params, searchParam, value, path);
break;
}
};
@ -585,7 +591,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
addQuantity_RangeNormalized(resourceType, params, searchParam, value);
break;
default:
addUnexpectedDatatypeWarning(params, searchParam, value);
addUnexpectedDatatypeWarning(params, searchParam, value, path);
break;
}
};
@ -626,8 +632,11 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
case "Range":
addString_Range(resourceType, params, searchParam, value);
break;
case "Period":
// Condition.onset[x] can have a Period - Ignored for now
break;
default:
addUnexpectedDatatypeWarning(params, searchParam, value);
addUnexpectedDatatypeWarning(params, searchParam, value, path);
break;
}
};
@ -891,6 +900,11 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
createTokenIndexIfNotBlankAndAdd(theResourceType, theParams, theSearchParam, system, value);
}
private void addToken_CodeableReference(String theResourceType, Set<BaseResourceIndexedSearchParam> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
Optional<IBase> conceptOpt = myCodeableReferenceConcept.getAccessor().getFirstValueOrNull(theValue);
conceptOpt.ifPresent(concept -> addToken_CodeableConcept(theResourceType, theParams, theSearchParam, concept));
}
private void addToken_PatientCommunication(String theResourceType, Set<BaseResourceIndexedSearchParam> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
List<IBase> values = myPatientCommunicationLanguageValueChild.getAccessor().getValues(theValue);
for (IBase next : values) {
@ -992,6 +1006,16 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
}
}
@SuppressWarnings("unchecked")
private void addNumber_Range(String theResourceType, Set<ResourceIndexedSearchParamNumber> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
Optional<IBase> low = myRangeLowValueChild.getAccessor().getFirstValueOrNull(theValue);
low.ifPresent(value -> addNumber_Quantity(theResourceType, theParams, theSearchParam, value));
Optional<IBase> high = myRangeHighValueChild.getAccessor().getFirstValueOrNull(theValue);
high.ifPresent(value -> addNumber_Quantity(theResourceType, theParams, theSearchParam, value));
}
@SuppressWarnings("unchecked")
private void addNumber_Integer(String theResourceType, Set<ResourceIndexedSearchParamNumber> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
IPrimitiveType<Integer> value = (IPrimitiveType<Integer>) theValue;
@ -1058,11 +1082,8 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
}
private void addString_Range(String theResourceType, Set<ResourceIndexedSearchParamString> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
BigDecimal value = extractValueAsBigDecimal(myRangeLowValueChild, theValue);
if (value != null) {
createStringIndexIfNotBlank(theResourceType, theParams, theSearchParam, value.toPlainString());
}
Optional<IBase> value = myRangeLowValueChild.getAccessor().getFirstValueOrNull(theValue);
value.ifPresent(t->addString_Quantity(theResourceType, theParams, theSearchParam, t));
}
private void addString_ContactPoint(String theResourceType, Set<ResourceIndexedSearchParamString> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
@ -1367,13 +1388,6 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
BaseRuntimeChildDefinition locationPositionValueChild = locationDefinition.getChildByName("position");
myLocationPositionDefinition = (BaseRuntimeElementCompositeDefinition<?>) locationPositionValueChild.getChildByName("position");
BaseRuntimeElementCompositeDefinition<?> codeSystemDefinition;
if (getContext().getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
codeSystemDefinition = getContext().getResourceDefinition("CodeSystem");
assert codeSystemDefinition != null;
myCodeSystemUrlValueChild = codeSystemDefinition.getChildByName("url");
}
BaseRuntimeElementCompositeDefinition<?> rangeDefinition = (BaseRuntimeElementCompositeDefinition<?>) getContext().getElementDefinition("Range");
myRangeLowValueChild = rangeDefinition.getChildByName("low");
myRangeHighValueChild = rangeDefinition.getChildByName("high");
@ -1385,15 +1399,6 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
myAddressCountryValueChild = addressDefinition.getChildByName("country");
myAddressPostalCodeValueChild = addressDefinition.getChildByName("postalCode");
if (getContext().getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
BaseRuntimeElementCompositeDefinition<?> capabilityStatementDefinition = getContext().getResourceDefinition("CapabilityStatement");
BaseRuntimeChildDefinition capabilityStatementRestChild = capabilityStatementDefinition.getChildByName("rest");
BaseRuntimeElementCompositeDefinition<?> capabilityStatementRestDefinition = (BaseRuntimeElementCompositeDefinition<?>) capabilityStatementRestChild.getChildByName("rest");
BaseRuntimeChildDefinition capabilityStatementRestSecurityValueChild = capabilityStatementRestDefinition.getChildByName("security");
BaseRuntimeElementCompositeDefinition<?> capabilityStatementRestSecurityDefinition = (BaseRuntimeElementCompositeDefinition<?>) capabilityStatementRestSecurityValueChild.getChildByName("security");
myCapabilityStatementRestSecurityServiceValueChild = capabilityStatementRestSecurityDefinition.getChildByName("service");
}
BaseRuntimeElementCompositeDefinition<?> periodDefinition = (BaseRuntimeElementCompositeDefinition<?>) getContext().getElementDefinition("Period");
myPeriodStartValueChild = periodDefinition.getChildByName("start");
myPeriodEndValueChild = periodDefinition.getChildByName("end");
@ -1441,6 +1446,30 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
BaseRuntimeElementCompositeDefinition<?> patientCommunicationDefinition = (BaseRuntimeElementCompositeDefinition<?>) patientCommunicationValueChild.getChildByName("communication");
myPatientCommunicationLanguageValueChild = patientCommunicationDefinition.getChildByName("language");
// DSTU3+
BaseRuntimeElementCompositeDefinition<?> codeSystemDefinition;
if (getContext().getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
codeSystemDefinition = getContext().getResourceDefinition("CodeSystem");
assert codeSystemDefinition != null;
myCodeSystemUrlValueChild = codeSystemDefinition.getChildByName("url");
BaseRuntimeElementCompositeDefinition<?> capabilityStatementDefinition = getContext().getResourceDefinition("CapabilityStatement");
BaseRuntimeChildDefinition capabilityStatementRestChild = capabilityStatementDefinition.getChildByName("rest");
BaseRuntimeElementCompositeDefinition<?> capabilityStatementRestDefinition = (BaseRuntimeElementCompositeDefinition<?>) capabilityStatementRestChild.getChildByName("rest");
BaseRuntimeChildDefinition capabilityStatementRestSecurityValueChild = capabilityStatementRestDefinition.getChildByName("security");
BaseRuntimeElementCompositeDefinition<?> capabilityStatementRestSecurityDefinition = (BaseRuntimeElementCompositeDefinition<?>) capabilityStatementRestSecurityValueChild.getChildByName("security");
myCapabilityStatementRestSecurityServiceValueChild = capabilityStatementRestSecurityDefinition.getChildByName("service");
}
// R4B+
if (getContext().getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.R4B)) {
BaseRuntimeElementCompositeDefinition<?> codeableReferenceDef = (BaseRuntimeElementCompositeDefinition<?>) getContext().getElementDefinition("CodeableReference");
myCodeableReferenceConcept = codeableReferenceDef.getChildByName("concept");
myCodeableReferenceReference = codeableReferenceDef.getChildByName("reference");
}
}
@FunctionalInterface
@ -1592,7 +1621,22 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
case "reference":
case "Reference":
IBaseReference valueRef = (IBaseReference) theValue;
extractResourceLinkFromReference(theParams, theSearchParam, thePath, theWantLocalReferences, valueRef);
break;
case "CodeableReference":
Optional<IBase> referenceOpt = myCodeableReferenceReference.getAccessor().getFirstValueOrNull(theValue);
if (referenceOpt.isPresent()) {
IBaseReference value = (IBaseReference) referenceOpt.get();
extractResourceLinkFromReference(theParams, theSearchParam, thePath, theWantLocalReferences, value);
}
break;
default:
addUnexpectedDatatypeWarning(theParams, theSearchParam, theValue, thePath);
break;
}
}
private void extractResourceLinkFromReference(SearchParamSet<PathAndRef> theParams, RuntimeSearchParam theSearchParam, String thePath, boolean theWantLocalReferences, IBaseReference valueRef) {
IIdType nextId = valueRef.getReferenceElement();
if (nextId.isEmpty() && valueRef.getResource() != null) {
nextId = valueRef.getResource().getIdElement();
@ -1601,19 +1645,12 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
if (nextId == null ||
nextId.isEmpty() ||
nextId.getValue().startsWith("urn:")) {
return;
}
if (!theWantLocalReferences) {
if (nextId.getValue().startsWith("#"))
return;
}
// Ignore placeholder references
} else if (!theWantLocalReferences && nextId.getValue().startsWith("#")) {
// Ignore local refs unless we specifically want them
} else {
myPathAndRef = new PathAndRef(theSearchParam.getName(), thePath, valueRef, false);
theParams.add(myPathAndRef);
break;
default:
addUnexpectedDatatypeWarning(theParams, theSearchParam, theValue);
break;
}
}
@ -1656,8 +1693,14 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
case "string":
// CarePlan.activitydate can be a string - ignored for now
break;
case "Quantity":
// Condition.onset[x] can have a Quantity - Ignored for now
break;
case "Range":
// Condition.onset[x] can have a Range - Ignored for now
break;
default:
addUnexpectedDatatypeWarning(theParams, theSearchParam, theValue);
addUnexpectedDatatypeWarning(theParams, theSearchParam, theValue, thePath);
break;
}
@ -1822,14 +1865,23 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
case "CodeableConcept":
addToken_CodeableConcept(myResourceTypeName, params, searchParam, value);
break;
case "CodeableReference":
addToken_CodeableReference(myResourceTypeName, params, searchParam, value);
break;
case "Coding":
addToken_Coding(myResourceTypeName, params, searchParam, value);
break;
case "ContactPoint":
addToken_ContactPoint(myResourceTypeName, params, searchParam, value);
break;
case "Range":
// Group.characteristic.value[x] can have a Range - Ignored for now
break;
case "Quantity":
// Group.characteristic.value[x] can have a Quantity - Ignored for now
break;
default:
addUnexpectedDatatypeWarning(params, searchParam, value);
addUnexpectedDatatypeWarning(params, searchParam, value, path);
break;
}
}

View File

@ -23,6 +23,7 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.StringUtil;
import ca.uhn.fhir.util.TestUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.hamcrest.Matchers;
import org.hl7.fhir.dstu3.model.Duration;
@ -184,41 +185,42 @@ public class SearchParamExtractorDstu3Test {
SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry);
extractor.start();
ArrayList<String> base = Lists.newArrayList("Patient");
{
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.STRING, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, null));
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.STRING, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, base));
Patient resource = new Patient();
ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamString> outcome = extractor.extractSearchParamStrings(resource);
assertThat(outcome.getWarnings(), Matchers.contains("Search param foo is of unexpected datatype: class org.hl7.fhir.dstu3.model.Patient"));
assertThat(outcome.getWarnings(), Matchers.contains("Search param [Patient]#foo is unable to index value of type Patient as a STRING at path: Patient"));
}
{
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.TOKEN, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, null));
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.TOKEN, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, base));
Patient resource = new Patient();
ISearchParamExtractor.SearchParamSet<BaseResourceIndexedSearchParam> outcome = extractor.extractSearchParamTokens(resource);
assertThat(outcome.getWarnings(), Matchers.contains("Search param foo is of unexpected datatype: class org.hl7.fhir.dstu3.model.Patient"));
assertThat(outcome.getWarnings(), Matchers.contains("Search param [Patient]#foo is unable to index value of type Patient as a TOKEN at path: Patient"));
}
{
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.QUANTITY, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, null));
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.QUANTITY, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, base));
Patient resource = new Patient();
ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamQuantity> outcome = extractor.extractSearchParamQuantity(resource);
assertThat(outcome.getWarnings(), Matchers.contains("Search param foo is of unexpected datatype: class org.hl7.fhir.dstu3.model.Patient"));
assertThat(outcome.getWarnings(), Matchers.contains("Search param [Patient]#foo is unable to index value of type Patient as a QUANTITY at path: Patient"));
}
{
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.DATE, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, null));
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.DATE, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, base));
Patient resource = new Patient();
ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamDate> outcome = extractor.extractSearchParamDates(resource);
assertThat(outcome.getWarnings(), Matchers.contains("Search param foo is of unexpected datatype: class org.hl7.fhir.dstu3.model.Patient"));
assertThat(outcome.getWarnings(), Matchers.contains("Search param [Patient]#foo is unable to index value of type Patient as a DATE at path: Patient"));
}
{
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.NUMBER, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, null));
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.NUMBER, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, base));
Patient resource = new Patient();
ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamNumber> outcome = extractor.extractSearchParamNumber(resource);
assertThat(outcome.getWarnings(), Matchers.contains("Search param foo is of unexpected datatype: class org.hl7.fhir.dstu3.model.Patient"));
assertThat(outcome.getWarnings(), Matchers.contains("Search param [Patient]#foo is unable to index value of type Patient as a NUMBER at path: Patient"));
}
{
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.URI, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, null));
searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "Patient", RestSearchParameterTypeEnum.URI, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, base));
Patient resource = new Patient();
ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamUri> outcome = extractor.extractSearchParamUri(resource);
assertThat(outcome.getWarnings(), Matchers.contains("Search param foo is of unexpected datatype: class org.hl7.fhir.dstu3.model.Patient"));
assertThat(outcome.getWarnings(), Matchers.contains("Search param [Patient]#foo is unable to index value of type Patient as a URI at path: Patient"));
}
}

View File

@ -15,36 +15,28 @@ import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeNarrativeDefinition;
import ca.uhn.fhir.context.RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.context.phonetic.IPhoneticEncoder;
import ca.uhn.fhir.jpa.cache.ResourceChangeResult;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistryController;
import ca.uhn.fhir.jpa.searchparam.registry.ReadOnlySearchParamCache;
import ca.uhn.fhir.rest.server.util.FhirContextSearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import com.google.common.collect.Lists;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.jupiter.api.Assertions.assertEquals;
// TODO JA Please fix this test. Expanding FhirContext.getResourceTypes() to cover all resource types broke this test.
@Disabled
@SuppressWarnings({"EnhancedSwitchMigration", "PatternVariableCanBeUsed"})
public class SearchParamExtractorMegaTest {
// TODO: JA remove unused?
private static final Logger ourLog = LoggerFactory.getLogger(SearchParamExtractorMegaTest.class);
@ -55,25 +47,35 @@ public class SearchParamExtractorMegaTest {
* and creates a resource with that path populated, just to ensure that we can index it
* without generating any warnings.
*/
@Test
public void testAllCombinations() throws Exception {
@ParameterizedTest
@MethodSource("provideContexts")
public void testAllCombinations(FhirContext theFhirContext) throws Exception {
PartitionSettings partitionSettings = new PartitionSettings();
FhirContext ctx = FhirContext.forDstu2();
ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry(ctx);
process(ctx, new SearchParamExtractorDstu2(new ModelConfig(), partitionSettings, ctx, searchParamRegistry));
ISearchParamRegistry searchParamRegistry = new FhirContextSearchParamRegistry(theFhirContext);
BaseSearchParamExtractor extractor;
switch (theFhirContext.getVersion().getVersion()) {
case DSTU2:
extractor = new SearchParamExtractorDstu2(new ModelConfig(), partitionSettings, theFhirContext, searchParamRegistry);
break;
case DSTU3:
extractor = new SearchParamExtractorDstu3(new ModelConfig(), partitionSettings, theFhirContext, searchParamRegistry);
break;
case R4:
extractor = new SearchParamExtractorR4(new ModelConfig(), partitionSettings, theFhirContext, searchParamRegistry);
break;
case R5:
extractor = new SearchParamExtractorR5(new ModelConfig(), partitionSettings, theFhirContext, searchParamRegistry);
break;
case R4B:
case DSTU2_HL7ORG:
case DSTU2_1:
default:
throw new UnsupportedOperationException();
}
ctx = FhirContext.forDstu3();
searchParamRegistry = new MySearchParamRegistry(ctx);
process(ctx, new SearchParamExtractorDstu3(new ModelConfig(), partitionSettings, ctx, searchParamRegistry));
process(theFhirContext, extractor);
ctx = FhirContext.forR4();
searchParamRegistry = new MySearchParamRegistry(ctx);
process(ctx, new SearchParamExtractorR4(new ModelConfig(), partitionSettings, ctx, searchParamRegistry));
ctx = FhirContext.forR5();
searchParamRegistry = new MySearchParamRegistry(ctx);
process(ctx, new SearchParamExtractorR5(new ModelConfig(), partitionSettings, ctx, searchParamRegistry));
}
private void process(FhirContext theCtx, BaseSearchParamExtractor theExtractor) throws Exception {
@ -82,7 +84,7 @@ public class SearchParamExtractorMegaTest {
for (String nextResourceName : theCtx.getResourceTypes()) {
RuntimeResourceDefinition resourceDefinition = theCtx.getResourceDefinition(nextResourceName);
List<BaseRuntimeElementDefinition> elementStack = new ArrayList<>();
List<BaseRuntimeElementDefinition<?>> elementStack = new ArrayList<>();
List<BaseRuntimeChildDefinition> childStack = new ArrayList<>();
processElement(theCtx, theExtractor, resourceDefinition, elementStack, childStack, indexesCounter);
@ -91,7 +93,7 @@ public class SearchParamExtractorMegaTest {
ourLog.info("Found {} indexes", indexesCounter.get());
}
private void processElement(FhirContext theCtx, BaseSearchParamExtractor theExtractor, BaseRuntimeElementDefinition theElementDef, List<BaseRuntimeElementDefinition> theElementStack, List<BaseRuntimeChildDefinition> theChildStack, AtomicInteger theIndexesCounter) throws Exception {
private void processElement(FhirContext theCtx, BaseSearchParamExtractor theExtractor, BaseRuntimeElementDefinition<?> theElementDef, List<BaseRuntimeElementDefinition<?>> theElementStack, List<BaseRuntimeChildDefinition> theChildStack, AtomicInteger theIndexesCounter) throws Exception {
if (theElementDef.getName().equals("ElementDefinition")) {
return;
}
@ -100,7 +102,7 @@ public class SearchParamExtractorMegaTest {
theElementStack.add(theElementDef);
if (theElementDef instanceof BaseRuntimeElementCompositeDefinition) {
BaseRuntimeElementCompositeDefinition<?> composite = (BaseRuntimeElementCompositeDefinition) theElementDef;
BaseRuntimeElementCompositeDefinition<?> composite = (BaseRuntimeElementCompositeDefinition<?>) theElementDef;
for (BaseRuntimeChildDefinition nextChild : composite.getChildren()) {
if (theChildStack.contains(nextChild)) {
@ -116,11 +118,11 @@ public class SearchParamExtractorMegaTest {
BaseRuntimeElementDefinition<?> def = nextChild.getChildByName(nextChild.getElementName());
processElement(theCtx, theExtractor, def, theElementStack, theChildStack, theIndexesCounter);
} else if (nextChild instanceof RuntimeChildExtension) {
// ignore extensions
ourLog.trace("Ignoring RuntimeChildExtension");
} else if (nextChild instanceof RuntimeChildContainedResources) {
// ignore extensions
ourLog.trace("Ignoring RuntimeChildContainedResources");
} else if (nextChild instanceof RuntimeChildResourceDefinition) {
// ignore extensions
ourLog.trace("Ignoring RuntimeChildResourceDefinition");
} else if (nextChild instanceof RuntimeChildChoiceDefinition) {
RuntimeChildChoiceDefinition choice = (RuntimeChildChoiceDefinition) nextChild;
for (String nextOption : choice.getValidChildNames()) {
@ -128,7 +130,7 @@ public class SearchParamExtractorMegaTest {
processElement(theCtx, theExtractor, def, theElementStack, theChildStack, theIndexesCounter);
}
} else if (nextChild instanceof RuntimeChildDirectResource) {
// ignore
ourLog.trace("Ignoring RuntimeChildDirectResource");
} else {
throw new Exception("Unexpected child type: " + nextChild.getClass());
}
@ -138,9 +140,9 @@ public class SearchParamExtractorMegaTest {
} else if (theElementDef instanceof RuntimePrimitiveDatatypeDefinition) {
handlePathToPrimitive(theCtx, theExtractor, theElementStack, theChildStack, theIndexesCounter);
} else if (theElementDef instanceof RuntimePrimitiveDatatypeNarrativeDefinition) {
// ignore
ourLog.trace("Ignoring RuntimePrimitiveDatatypeNarrativeDefinition");
} else if (theElementDef instanceof RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition) {
// ignore
ourLog.trace("Ignoring RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition");
} else {
throw new Exception("Unexpected def type: " + theElementDef.getClass());
}
@ -148,13 +150,13 @@ public class SearchParamExtractorMegaTest {
theElementStack.remove(theElementStack.size() - 1);
}
private void handlePathToPrimitive(FhirContext theCtx, BaseSearchParamExtractor theExtractor, List<BaseRuntimeElementDefinition> theElementStack, List<BaseRuntimeChildDefinition> theChildStack, AtomicInteger theIndexesCounter) {
private void handlePathToPrimitive(FhirContext theCtx, BaseSearchParamExtractor theExtractor, List<BaseRuntimeElementDefinition<?>> theElementStack, List<BaseRuntimeChildDefinition> theChildStack, AtomicInteger theIndexesCounter) {
IBase previousObject = null;
IBaseResource resource = null;
StringBuilder path = new StringBuilder(theElementStack.get(0).getName());
Object previousChildArguments = null;
for (int i = 0; i < theElementStack.size(); i++) {
BaseRuntimeElementDefinition nextElement = theElementStack.get(i);
BaseRuntimeElementDefinition<?> nextElement = theElementStack.get(i);
if (i > 0) {
previousChildArguments = theChildStack.get(i - 1).getInstanceConstructorArguments();
@ -200,111 +202,58 @@ public class SearchParamExtractorMegaTest {
break;
}
ourLog.info("Found path: {}", path);
ourLog.debug("Found path: {}", path);
ISearchParamExtractor.SearchParamSet<?> set;
set = theExtractor.extractSearchParamDates(resource);
assertEquals(0, set.getWarnings().size());
{
ISearchParamExtractor.SearchParamSet<?> set = theExtractor.extractSearchParamDates(resource);
List<String> warnings = set.getWarnings();
assertEquals(0, warnings.size(), () -> String.join("\n", warnings));
theIndexesCounter.addAndGet(set.size());
set = theExtractor.extractSearchParamNumber(resource);
assertEquals(0, set.getWarnings().size());
}
{
ISearchParamExtractor.SearchParamSet<?> set = theExtractor.extractSearchParamNumber(resource);
List<String> warnings = set.getWarnings();
// This is an R5 parameter that needs special handling
warnings.remove("Search param [Patient]#age is unable to index value of type date as a NUMBER at path: Patient.birthDate");
assertEquals(0, warnings.size(), () -> String.join("\n", warnings));
theIndexesCounter.addAndGet(set.size());
set = theExtractor.extractSearchParamStrings(resource);
assertEquals(0, set.getWarnings().size());
}
{
ISearchParamExtractor.SearchParamSet<?> set = theExtractor.extractSearchParamStrings(resource);
List<String> warnings = set.getWarnings();
assertEquals(0, warnings.size(), () -> String.join("\n", warnings));
theIndexesCounter.addAndGet(set.size());
set = theExtractor.extractSearchParamQuantity(resource);
assertEquals(0, set.getWarnings().size(), String.join("\n", set.getWarnings()));
}
{
ISearchParamExtractor.SearchParamSet<?> set = theExtractor.extractSearchParamQuantity(resource);
List<String> warnings = set.getWarnings();
assertEquals(0, warnings.size(), () -> String.join("\n", warnings));
theIndexesCounter.addAndGet(set.size());
set = theExtractor.extractSearchParamTokens(resource);
assertEquals(0, set.getWarnings().size());
}
{
ISearchParamExtractor.SearchParamSet<?> set = theExtractor.extractSearchParamTokens(resource);
List<String> warnings = set.getWarnings();
// Two invalid params in draft R5
warnings.remove("Search param [MedicationUsage]#adherence is unable to index value of type org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageAdherenceComponent as a TOKEN at path: MedicationUsage.adherence");
warnings.remove("Search param [ResearchStudy]#focus is unable to index value of type org.hl7.fhir.r5.model.ResearchStudy.ResearchStudyFocusComponent as a TOKEN at path: ResearchStudy.focus");
assertEquals(0, warnings.size(), () -> String.join("\n", warnings));
theIndexesCounter.addAndGet(set.size());
set = theExtractor.extractSearchParamUri(resource);
assertEquals(0, set.getWarnings().size());
}
{
ISearchParamExtractor.SearchParamSet<?> set = theExtractor.extractSearchParamUri(resource);
List<String> warnings = set.getWarnings();
assertEquals(0, warnings.size(), () -> String.join("\n", warnings));
theIndexesCounter.addAndGet(set.size());
}
private static class MySearchParamRegistry implements ISearchParamRegistry, ISearchParamRegistryController {
private final FhirContext myCtx;
private List<RuntimeSearchParam> myAddedSearchParams = new ArrayList<>();
private MySearchParamRegistry(FhirContext theCtx) {
myCtx = theCtx;
}
public void addSearchParam(RuntimeSearchParam... theSearchParam) {
myAddedSearchParams.clear();
for (RuntimeSearchParam next : theSearchParam) {
myAddedSearchParams.add(next);
}
}
@Override
public void forceRefresh() {
// nothing
}
@Override
public RuntimeSearchParam getActiveSearchParam(String theResourceName, String theParamName) {
throw new UnsupportedOperationException();
}
@Override
public ResourceChangeResult refreshCacheIfNecessary() {
// nothing
return new ResourceChangeResult();
}
public ReadOnlySearchParamCache getActiveSearchParams() {
throw new UnsupportedOperationException();
}
@Override
public ResourceSearchParams getActiveSearchParams(String theResourceName) {
RuntimeResourceDefinition nextResDef = myCtx.getResourceDefinition(theResourceName);
ResourceSearchParams retval = new ResourceSearchParams(theResourceName);
for (RuntimeSearchParam nextSp : nextResDef.getSearchParams()) {
retval.put(nextSp.getName(), nextSp);
}
for (RuntimeSearchParam next : myAddedSearchParams) {
retval.put(next.getName(), next);
}
return retval;
}
@Override
public List<RuntimeSearchParam> getActiveComboSearchParams(String theResourceName, Set<String> theParamNames) {
throw new UnsupportedOperationException();
}
@Nullable
@Override
public RuntimeSearchParam getActiveSearchParamByUrl(String theUrl) {
throw new UnsupportedOperationException();
}
@Override
public List<RuntimeSearchParam> getActiveComboSearchParams(String theResourceName) {
throw new UnsupportedOperationException();
}
@Override
public void requestRefresh() {
// nothing
}
@Override
public void setPhoneticEncoder(IPhoneticEncoder thePhoneticEncoder) {
// nothing
}
public static List<FhirContext> provideContexts() {
return Lists.newArrayList(
FhirContext.forDstu2Cached(),
FhirContext.forDstu3Cached(),
FhirContext.forR4Cached(),
FhirContext.forR5Cached()
);
}
}

View File

@ -1,9 +1,7 @@
package ca.uhn.fhir.jpa.provider;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.dstu2.BaseJpaDstu2Test;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.subscription.match.config.WebsocketDispatcherConfig;
import ca.uhn.fhir.model.dstu2.resource.Bundle;
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
import ca.uhn.fhir.model.dstu2.resource.Patient;
@ -19,7 +17,6 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.PlatformTransactionManager;
import java.util.ArrayList;
import java.util.List;
@ -28,25 +25,18 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
@ContextConfiguration(classes = ServerConfiguration.class)
public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test {
@RegisterExtension
protected static HttpClientExtension ourHttpClient = new HttpClientExtension();
// TODO: JA2 These are no longer static but are named like static. I'm going to
// rename them in a separate PR that only makes that change so that it's easier to review
protected int ourPort;
protected String ourServerBase;
protected IGenericClient ourClient;
@Autowired
protected PlatformTransactionManager ourTxManager;
protected int myPort;
protected String myServerBase;
protected IGenericClient myClient;
@Autowired
@RegisterExtension
protected RestfulServerExtension myServer;
@RegisterExtension
protected RestfulServerConfigurerExtension myServerConfigurer = new RestfulServerConfigurerExtension(() -> myServer)
.withServerBeforeEach(s -> {
.withServerBeforeAll(s -> {
s.registerProviders(myResourceProviders.createProviders());
s.registerProvider(mySystemProvider);
s.setDefaultResponseEncoding(EncodingEnum.XML);
@ -63,11 +53,10 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test {
DatabaseBackedPagingProvider pagingProvider = myAppCtx.getBean(DatabaseBackedPagingProvider.class);
s.setPagingProvider(pagingProvider);
}).withServerBeforeAll(s->{
// TODO: JA-2 These don't need to be static variables, should just inline all of the uses of these
ourPort = myServer.getPort();
ourServerBase = myServer.getBaseUrl();
ourClient = myServer.getFhirClient();
}).withServerBeforeEach(s -> {
myPort = myServer.getPort();
myServerBase = myServer.getBaseUrl();
myClient = myServer.getFhirClient();
});
public BaseResourceProviderDstu2Test() {

View File

@ -44,7 +44,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testValidateCodeOperationByCodeAndSystemInstance() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("validate-code")
@ -60,7 +60,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testLookupOperationByCodeAndSystem() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("lookup")
@ -80,7 +80,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
@Disabled
public void testLookupOperationForBuiltInCode() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("lookup")
@ -101,7 +101,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testLookupOperationByCoding() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("lookup")
@ -120,7 +120,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testLookupOperationByInvalidCombination() {
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("lookup")
@ -137,7 +137,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testLookupOperationByInvalidCombination2() {
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("lookup")
@ -153,7 +153,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testLookupOperationByInvalidCombination3() {
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("lookup")
@ -168,7 +168,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testExpandById() {
myCaptureQueriesListener.clear();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -198,7 +198,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
* Filter with display name
*/
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -217,7 +217,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
* Filter with code
*/
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -233,7 +233,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testExpandByIdentifier() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -256,7 +256,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
public void testExpandByValueSet() throws IOException {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-2.xml");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -287,7 +287,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
@Test
public void testExpandInvalidParams() throws IOException {
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -300,7 +300,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
try {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-2.xml");
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -314,7 +314,7 @@ public class ResourceProviderDstu2ValueSetTest extends BaseResourceProviderDstu2
try {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-2.xml");
ourClient
myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")

View File

@ -59,7 +59,7 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
subs.getChannel().setType(SubscriptionChannelTypeEnum.REST_HOOK);
subs.setCriteria("Observation?identifier=123");
try {
ourClient.create().resource(subs).execute();
myClient.create().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
@ -67,14 +67,14 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
subs.setId("ABC");
try {
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
}
subs.setStatus(SubscriptionStatusEnum.REQUESTED);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
}
@Test
@ -86,7 +86,7 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
subs.setStatus(SubscriptionStatusEnum.ACTIVE);
subs.setCriteria("Observation?identifier=123");
try {
ourClient.create().resource(subs).execute();
myClient.create().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(804) + "Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage());
@ -94,7 +94,7 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
subs.setId("ABC");
try {
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(804) + "Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage());
@ -109,7 +109,7 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
subs.getStatusElement().setValue("aaaaa");
try {
ourClient.create().resource(subs).execute();
myClient.create().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
@ -124,13 +124,13 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
subs.setStatus(SubscriptionStatusEnum.REQUESTED);
subs.setCriteria("Observation?identifier=123");
subs.getChannel().setEndpoint("http://example.com");
IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless();
IIdType id = myClient.create().resource(subs).execute().getId().toUnqualifiedVersionless();
subs.setId(id);
try {
subs.setStatus(SubscriptionStatusEnum.ACTIVE);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(802) + "Subscription.status can not be changed from 'requested' to 'active'", e.getMessage());
@ -138,7 +138,7 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
try {
subs.setStatus((SubscriptionStatusEnum) null);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
@ -153,12 +153,12 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
subs.getChannel().setType(SubscriptionChannelTypeEnum.REST_HOOK);
subs.setCriteria("Observation?identifier=123");
subs.setStatus(SubscriptionStatusEnum.REQUESTED);
IIdType id = ourClient.create().resource(subs).execute().getId();
IIdType id = myClient.create().resource(subs).execute().getId();
subs.setId(id);
try {
subs.setStatus(SubscriptionStatusEnum.ACTIVE);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(802) + "Subscription.status can not be changed from 'requested' to 'active'", e.getMessage());
@ -166,14 +166,14 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
try {
subs.setStatus((SubscriptionStatusEnum) null);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
}
subs.setStatus(SubscriptionStatusEnum.OFF);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
}
public class BaseSocket {

View File

@ -57,7 +57,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
super.after();
for (IIdType next : mySubscriptionIds) {
ourClient.delete().resourceById(next).execute();
myClient.delete().resourceById(next).execute();
}
mySubscriptionIds.clear();
mySubscriptionTestUtil.unregisterSubscriptionInterceptor();
@ -87,7 +87,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
channel.setEndpoint(endpoint);
subscription.setChannel(channel);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId().getIdPart());
mySubscriptionIds.add(methodOutcome.getId());
@ -106,7 +106,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
observation.setStatus(ObservationStatusEnum.FINAL);
MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);

View File

@ -69,14 +69,14 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
public void afterUnregisterRestHookListener() {
ourLog.info("** AFTER **");
for (IIdType next : mySubscriptionIds) {
ourClient.delete().resourceById(next).execute();
myClient.delete().resourceById(next).execute();
}
mySubscriptionIds.clear();
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@ -101,7 +101,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
private Subscription createSubscription(String criteria, String payload, String endpoint) throws InterruptedException {
Subscription subscription = newSubscription(criteria, payload, endpoint);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId().getIdPart());
mySubscriptionIds.add(methodOutcome.getId());
@ -181,12 +181,12 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
// Update subscription 2 to match as well
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
ourLog.info("Have {} updates and {} subscriptions - sending observation", ourUpdatedObservations.size(), mySubscriptionTestUtil.getActiveSubscriptionCount());
@ -197,7 +197,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
waitForSize(3, ourUpdatedObservations);
// Delete one subscription
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
myClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
waitForActivatedSubscriptionCount(1);
ourLog.info("Have {} updates and {} subscriptions - sending observation", ourUpdatedObservations.size(), mySubscriptionTestUtil.getActiveSubscriptionCount());
@ -207,21 +207,21 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept = new CodeableConceptDt();
observation3.setCode(codeableConcept);
CodingDt coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourLog.info("Have {} updates and {} subscriptions - sending observation", ourUpdatedObservations.size(), mySubscriptionTestUtil.getActiveSubscriptionCount());
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept1 = new CodeableConceptDt();
observation3a.setCode(codeableConcept1);
@ -229,7 +229,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourLog.info("Have {} updates and {} subscriptions - sending observation", ourUpdatedObservations.size(), mySubscriptionTestUtil.getActiveSubscriptionCount());
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
@ -259,11 +259,11 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@ -272,7 +272,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
myClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@ -281,27 +281,27 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept = new CodeableConceptDt();
observation3.setCode(codeableConcept);
CodingDt coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept1 = new CodeableConceptDt();
observation3a.setCode(codeableConcept1);
CodingDt coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
@ -319,7 +319,7 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test {
subscription.getStatusElement().setValueAsEnum(null);
try {
ourClient.create().resource(subscription).execute();
myClient.create().resource(subscription).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Can not process submitted Subscription - Subscription.status must be populated on this server"));

View File

@ -62,7 +62,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
ourLog.info("** AFTER **");
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@ -98,7 +98,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
channel.setEndpoint(endpoint);
subscription.setChannel(channel);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId().getIdPart());
waitForQueueToDrain();
@ -115,7 +115,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
observation.setStatus(ObservationStatusEnum.FINAL);
MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);
@ -143,11 +143,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@ -157,7 +157,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
myClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@ -166,27 +166,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept = new CodeableConceptDt();
observation3.setCode(codeableConcept);
CodingDt coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept1 = new CodeableConceptDt();
observation3a.setCode(codeableConcept1);
CodingDt coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
@ -228,11 +228,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@ -242,7 +242,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
myClient.delete().resourceById(new IdDt("Subscription/" + subscription2.getId())).execute();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@ -251,27 +251,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept = new CodeableConceptDt();
observation3.setCode(codeableConcept);
CodingDt coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConceptDt codeableConcept1 = new CodeableConceptDt();
observation3a.setCode(codeableConcept1);
CodingDt coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();

View File

@ -49,7 +49,7 @@ public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Tes
*/
Patient patient = FhirDstu2Util.getPatient();
MethodOutcome methodOutcome = ourClient.create().resource(patient).execute();
MethodOutcome methodOutcome = myClient.create().resource(patient).execute();
myPatientId = methodOutcome.getId().getIdPart();
/*
@ -66,7 +66,7 @@ public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Tes
channel.setPayload("application/json");
subscription.setChannel(channel);
methodOutcome = ourClient.create().resource(subscription).execute();
methodOutcome = myClient.create().resource(subscription).execute();
mySubscriptionId = methodOutcome.getId().getIdPart();
/*
@ -89,7 +89,7 @@ public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Tes
observation.setSubject(reference);
observation.setStatus(ObservationStatusEnum.FINAL);
MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);
@ -113,7 +113,7 @@ public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Tes
observation.setSubject(reference);
observation.setStatus(ObservationStatusEnum.FINAL);
MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);

View File

@ -68,7 +68,7 @@ public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDs
*/
Patient patient = FhirDstu2Util.getPatient();
MethodOutcome methodOutcome = ourClient.create().resource(patient).execute();
MethodOutcome methodOutcome = myClient.create().resource(patient).execute();
myPatientId = methodOutcome.getId().getIdPart();
/*
@ -85,7 +85,7 @@ public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDs
channel.setPayload("application/json");
subscription.setChannel(channel);
methodOutcome = ourClient.create().resource(subscription).execute();
methodOutcome = myClient.create().resource(subscription).execute();
mySubscriptionId = methodOutcome.getId().getIdPart();
myWebsocketClientExtension.bind(mySubscriptionId);
@ -104,7 +104,7 @@ public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDs
observation.setSubject(reference);
observation.setStatus(ObservationStatusEnum.FINAL);
MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);
@ -128,7 +128,7 @@ public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDs
observation.setSubject(reference);
observation.setStatus(ObservationStatusEnum.FINAL);
MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);

View File

@ -6,7 +6,6 @@ import ca.uhn.fhir.jpa.provider.ProcessMessageProvider;
import ca.uhn.fhir.jpa.provider.ServerConfiguration;
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
import ca.uhn.fhir.jpa.provider.TerminologyUploaderProvider;
import ca.uhn.fhir.jpa.provider.ValueSetOperationProvider;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
@ -40,23 +39,21 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
@ContextConfiguration(classes = ServerConfiguration.class)
public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test {
protected int myPort;
protected String myServerBase;
protected IGenericClient myClient;
protected RestfulServer myRestServer;
@RegisterExtension
protected static HttpClientExtension ourHttpClient = new HttpClientExtension();
// TODO: JA2 These are no longer static but are named like static. I'm going to
// rename them in a separate PR that only makes that change so that it's easier to review
protected int ourPort;
protected String ourServerBase;
protected IGenericClient ourClient;
protected RestfulServer ourRestServer;
@Autowired
@RegisterExtension
protected RestfulServerExtension myServer;
@RegisterExtension
protected RestfulServerConfigurerExtension myServerConfigurer = new RestfulServerConfigurerExtension(() -> myServer)
.withServerBeforeEach(s -> {
.withServerBeforeAll(s -> {
s.registerProviders(myResourceProviders.createProviders());
s.setDefaultResponseEncoding(EncodingEnum.XML);
s.setDefaultPrettyPrint(false);
@ -94,16 +91,15 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test {
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
s.registerInterceptor(corsInterceptor);
}).withServerBeforeAll(s -> {
// TODO: JA-2 These don't need to be static variables, should just inline all of the uses of these
ourPort = myServer.getPort();
ourServerBase = myServer.getBaseUrl();
ourClient = myServer.getFhirClient();
ourRestServer = myServer.getRestfulServer();
}).withServerBeforeEach(s -> {
myPort = myServer.getPort();
myServerBase = myServer.getBaseUrl();
myClient = myServer.getFhirClient();
myRestServer = myServer.getRestfulServer();
ourClient.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof LoggingInterceptor);
myClient.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof LoggingInterceptor);
if (shouldLogClient()) {
ourClient.registerInterceptor(new LoggingInterceptor());
myClient.registerInterceptor(new LoggingInterceptor());
}
});

View File

@ -69,18 +69,18 @@ public class CompositionDocumentDstu3Test extends BaseResourceProviderDstu3Test
Organization org = new Organization();
org.setName("an org");
orgId = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless().getValue();
orgId = myClient.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();
patId = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless().getValue();
Encounter enc = new Encounter();
enc.setStatus(EncounterStatus.ARRIVED);
enc.getSubject().setReference(patId);
enc.getServiceProvider().setReference(orgId);
encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless().getValue();
encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless().getValue();
ListResource listResource = new ListResource();
@ -90,13 +90,13 @@ public class CompositionDocumentDstu3Test extends BaseResourceProviderDstu3Test
Observation obs = new Observation();
obs.getSubject().setReference(patId);
obs.setStatus(ObservationStatus.FINAL);
String obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue();
String obsId = myClient.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();
listId = myClient.create().resource(listResource).execute().getId().toUnqualifiedVersionless().getValue();
Composition composition = new Composition();
composition.setSubject(new Reference(patId));
@ -108,13 +108,13 @@ public class CompositionDocumentDstu3Test extends BaseResourceProviderDstu3Test
for (String obsId : myObsIds) {
composition.addSection().addEntry(new Reference(obsId));
}
compId = ourClient.create().resource(composition).execute().getId().toUnqualifiedVersionless().getValue();
compId = myClient.create().resource(composition).execute().getId().toUnqualifiedVersionless().getValue();
}
@Test
public void testDocumentBundleReturnedCorrect() throws IOException {
String theUrl = ourServerBase + "/" + compId + "/$document?_format=json";
String theUrl = myServerBase + "/" + compId + "/$document?_format=json";
Bundle bundle = fetchBundle(theUrl, EncodingEnum.JSON);
bundle.getEntry().stream()

View File

@ -15,7 +15,7 @@ public class CorsDstu3Test extends BaseResourceProviderDstu3Test {
@Test
public void saveLocalOrigin() throws IOException {
HttpGet get = new HttpGet(ourServerBase + "/Patient?name=test");
HttpGet get = new HttpGet(myServerBase + "/Patient?name=test");
get.addHeader("Origin", "file://");
CloseableHttpResponse resp = ourHttpClient.execute(get);

View File

@ -26,7 +26,7 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
initTestPatients();
String query = "{name{family,given}}";
HttpGet httpGet = new HttpGet(ourServerBase + "/Patient/" + myPatientId0.getIdPart() + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
HttpGet httpGet = new HttpGet(myServerBase + "/Patient/" + myPatientId0.getIdPart() + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -48,7 +48,7 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
initTestPatients();
String query = "{PatientList(given:\"given\"){name{family,given}}}";
HttpGet httpGet = new HttpGet(ourServerBase + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
HttpGet httpGet = new HttpGet(myServerBase + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -80,13 +80,13 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test {
p.addName()
.addGiven("GivenOnly1")
.addGiven("GivenOnly2");
myPatientId0 = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
myPatientId0 = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
p = new Patient();
p.addName()
.addGiven("GivenOnlyB1")
.addGiven("GivenOnlyB2");
ourClient.create().resource(p).execute();
myClient.create().resource(p).execute();
}

View File

@ -72,43 +72,43 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test {
myOrg = new Organization();
myOrg.setName("an org");
myOrgId = ourClient.create().resource(myOrg).execute().getId().toUnqualifiedVersionless().getValue();
myOrgId = myClient.create().resource(myOrg).execute().getId().toUnqualifiedVersionless().getValue();
myOrg.setId(myOrgId);
ourLog.info("OrgId: {}", myOrgId);
myPatient = new Patient();
myPatient.getManagingOrganization().setReference(myOrgId);
myPatientId = ourClient.create().resource(myPatient).execute().getId().toUnqualifiedVersionless().getValue();
myPatientId = myClient.create().resource(myPatient).execute().getId().toUnqualifiedVersionless().getValue();
myPatient.setId(myPatientId);
Patient patient2 = new Patient();
patient2.getManagingOrganization().setReference(myOrgId);
myWrongPatId = ourClient.create().resource(patient2).execute().getId().toUnqualifiedVersionless().getValue();
myWrongPatId = myClient.create().resource(patient2).execute().getId().toUnqualifiedVersionless().getValue();
Encounter enc1 = new Encounter();
enc1.setStatus(EncounterStatus.CANCELLED);
enc1.getSubject().setReference(myPatientId);
enc1.getServiceProvider().setReference(myOrgId);
encId1 = ourClient.create().resource(enc1).execute().getId().toUnqualifiedVersionless().getValue();
encId1 = myClient.create().resource(enc1).execute().getId().toUnqualifiedVersionless().getValue();
Encounter enc2 = new Encounter();
enc2.setStatus(EncounterStatus.ARRIVED);
enc2.getSubject().setReference(myPatientId);
enc2.getServiceProvider().setReference(myOrgId);
encId2 = ourClient.create().resource(enc2).execute().getId().toUnqualifiedVersionless().getValue();
encId2 = myClient.create().resource(enc2).execute().getId().toUnqualifiedVersionless().getValue();
Encounter wrongEnc1 = new Encounter();
wrongEnc1.setStatus(EncounterStatus.ARRIVED);
wrongEnc1.getSubject().setReference(myWrongPatId);
wrongEnc1.getServiceProvider().setReference(myOrgId);
myWrongEnc1 = ourClient.create().resource(wrongEnc1).execute().getId().toUnqualifiedVersionless().getValue();
myWrongEnc1 = myClient.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(myPatientId);
obs.setStatus(ObservationStatus.FINAL);
String obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue();
String obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue();
myObsIds.add(obsId);
}
@ -120,7 +120,7 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test {
@Test
public void testEverythingReturnsCorrectResources() throws Exception {
Bundle bundle = fetchBundle(ourServerBase + "/" + myPatientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + myPatientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
assertNull(bundle.getLink("next"));
@ -144,16 +144,16 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test {
public void testEverythingHandlesCircularReferences() throws Exception {
Patient linkedPatient1 = new Patient();
linkedPatient1.addLink().setOther(new Reference(myPatientId));
String linkedPatient1Id = ourClient.create().resource(linkedPatient1).execute().getId().toUnqualifiedVersionless().getValue();
String linkedPatient1Id = myClient.create().resource(linkedPatient1).execute().getId().toUnqualifiedVersionless().getValue();
Patient linkedPatient2 = new Patient();
linkedPatient2.addLink().setOther(new Reference(linkedPatient1Id));
String linkedPatient2Id = ourClient.create().resource(linkedPatient2).execute().getId().toUnqualifiedVersionless().getValue();
String linkedPatient2Id = myClient.create().resource(linkedPatient2).execute().getId().toUnqualifiedVersionless().getValue();
myPatient.addLink().setOther(new Reference(linkedPatient2Id));
ourClient.update().resource(myPatient).execute();
myClient.update().resource(myPatient).execute();
Bundle bundle = fetchBundle(ourServerBase + "/" + myPatientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + myPatientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
assertNull(bundle.getLink("next"));
@ -183,7 +183,7 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test {
public void testEverythingReturnsCorrectResourcesSmallPage() throws Exception {
myDaoConfig.setEverythingIncludesFetchPageSize(1);
Bundle bundle = fetchBundle(ourServerBase + "/" + myPatientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + myPatientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
assertNull(bundle.getLink("next"));
@ -209,7 +209,7 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test {
@Test
public void testEverythingPagesWithCorrectEncodingJson() throws Exception {
Bundle bundle = fetchBundle(ourServerBase + "/" + myPatientId + "/$everything?_format=json&_count=1", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + myPatientId + "/$everything?_format=json&_count=1", EncodingEnum.JSON);
assertNotNull(bundle.getLink("next").getUrl());
assertThat(bundle.getLink("next").getUrl(), containsString("_format=json"));
@ -226,7 +226,7 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test {
@Test
public void testEverythingPagesWithCorrectEncodingXml() throws Exception {
Bundle bundle = fetchBundle(ourServerBase + "/" + myPatientId + "/$everything?_format=xml&_count=1", EncodingEnum.XML);
Bundle bundle = fetchBundle(myServerBase + "/" + myPatientId + "/$everything?_format=xml&_count=1", EncodingEnum.XML);
assertNotNull(bundle.getLink("next").getUrl());
ourLog.info("Next link: {}", bundle.getLink("next").getUrl());

View File

@ -97,7 +97,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
sp.setTitle("Foo Param");
try {
ourClient.create().resource(sp).execute();
myClient.create().resource(sp).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(1112) + "SearchParameter.status is missing or invalid", e.getMessage());
@ -108,7 +108,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
public void testConformanceOverrideAllowed() {
myModelConfig.setDefaultSearchParamsCanBeOverridden(true);
CapabilityStatement conformance = ourClient
CapabilityStatement conformance = myClient
.fetchConformance()
.ofType(CapabilityStatement.class)
.execute();
@ -161,7 +161,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
}
});
conformance = ourClient
conformance = myClient
.fetchConformance()
.ofType(CapabilityStatement.class)
.execute();
@ -241,14 +241,14 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
IBundleProvider results;
List<String> foundResources;
HttpGet get = new HttpGet(ourServerBase + "/Appointment?_include:recurse=Appointment:patient&_include:recurse=Appointment:location&_include:recurse=Patient:attending&_pretty=true");
HttpGet get = new HttpGet(myServerBase + "/Appointment?_include:recurse=Appointment:patient&_include:recurse=Appointment:location&_include:recurse=Patient:attending&_pretty=true");
CloseableHttpResponse response = ourHttpClient.execute(get);
try {
String resp = IOUtils.toString(response.getEntity().getContent(), Constants.CHARSET_UTF8);
ourLog.info(resp);
assertEquals(200, response.getStatusLine().getStatusCode());
assertThat(resp, containsString("<fullUrl value=\"http://localhost:" + ourPort + "/fhir/context/Practitioner/"));
assertThat(resp, containsString("<fullUrl value=\"http://localhost:" + myPort + "/fhir/context/Practitioner/"));
} finally {
IOUtils.closeQuietly(response);
}
@ -267,7 +267,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
ourLog.info(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(eyeColourSp));
ourClient
myClient
.create()
.resource(eyeColourSp)
.execute();
@ -286,7 +286,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
p2.addExtension().setUrl("http://acme.org/eyecolour").setValue(new CodeType("green"));
IIdType p2id = myPatientDao.create(p2).getId().toUnqualifiedVersionless();
Bundle bundle = ourClient
Bundle bundle = myClient
.search()
.forResource(Patient.class)
.where(new TokenClientParam("eyecolour").exactly().code("blue"))
@ -333,7 +333,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
List<String> foundResources;
Bundle result;
result = ourClient
result = myClient
.search()
.forResource(Observation.class)
.where(new ReferenceClientParam("foo").hasChainedProperty(Patient.GENDER.exactly().code("male")))
@ -373,7 +373,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
List<String> foundResources;
Bundle result;
result = ourClient
result = myClient
.search()
.forResource(Patient.class)
.where(new TokenClientParam("foo").exactly().code("male"))

View File

@ -35,7 +35,7 @@ public class ResourceProviderDstu3BundleTest extends BaseResourceProviderDstu3Te
.setName("content")
.setResource(bundle);
try {
ourClient.operation().onServer().named(JpaConstants.OPERATION_PROCESS_MESSAGE).withParameters(parameters).execute();
myClient.operation().onServer().named(JpaConstants.OPERATION_PROCESS_MESSAGE).withParameters(parameters).execute();
fail();
} catch (NotImplementedOperationException e) {
assertThat(e.getMessage(), containsString("This operation is not yet implemented on this server"));
@ -44,7 +44,7 @@ public class ResourceProviderDstu3BundleTest extends BaseResourceProviderDstu3Te
@Test
public void testConformanceContainsIncludesAndRevIncludes() {
CapabilityStatement execute = ourClient.capabilities().ofType(CapabilityStatement.class).execute();
CapabilityStatement execute = myClient.capabilities().ofType(CapabilityStatement.class).execute();
Optional<CapabilityStatement.CapabilityStatementRestResourceComponent> patient = execute.getRestFirstRep().getResource().stream().filter(resource -> resource.getType().equalsIgnoreCase("Patient")).findFirst();
if (patient.isEmpty()) {
fail("No Patient resource found in conformance statement");
@ -65,11 +65,11 @@ public class ResourceProviderDstu3BundleTest extends BaseResourceProviderDstu3Te
CarePlan carePlan = new CarePlan();
carePlan.getText().setDivAsString("A CarePlan");
carePlan.setId("ACarePlan");
ourClient.create().resource(carePlan).execute();
myClient.create().resource(carePlan).execute();
// GET CarePlans from server
Bundle bundle = ourClient.search()
.byUrl(ourServerBase + "/CarePlan")
Bundle bundle = myClient.search()
.byUrl(myServerBase + "/CarePlan")
.returnBundle(Bundle.class).execute();
// Create and populate list of CarePlans
@ -77,7 +77,7 @@ public class ResourceProviderDstu3BundleTest extends BaseResourceProviderDstu3Te
bundle.getEntry().forEach(entry -> carePlans.add((CarePlan) entry.getResource()));
// Post CarePlans should not get: HAPI-2006: Unable to perform PUT, URL provided is invalid...
ourClient.transaction().withResources(carePlans).execute();
myClient.transaction().withResources(carePlans).execute();
}

View File

@ -59,7 +59,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
ourLog.info("Code system versions:\n * " + myTermCodeSystemVersionDao.findAll().stream().map(t -> t.toString()).collect(Collectors.joining("\n * ")));
});
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -80,7 +80,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// With HTTP GET
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -134,11 +134,11 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
// Create the code system
CodeSystem cs = (CodeSystem) myFhirContext.newJsonParser().parseResource(input);
ourClient.update().resource(cs).execute();
myClient.update().resource(cs).execute();
runInTransaction(() -> assertEquals(26L, myConceptDao.count()));
// Delete the code system
ourClient.delete().resource(cs).execute();
myClient.delete().resource(cs).execute();
runInTransaction(() -> assertEquals(26L, myConceptDao.count()));
myTerminologyDeferredStorageSvc.saveDeferred();
@ -149,7 +149,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
@Test
public void testLookupOperationByCodeAndSystemBuiltInCode() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -174,7 +174,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
public void testLookupOperationByCodeAndSystemBuiltInNonexistantCode() {
//@formatter:off
try {
ourClient
myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -190,7 +190,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
@Test
public void testLookupOperationByCodeAndSystemUserDefinedCode() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -213,7 +213,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
public void testLookupOperationByCodeAndSystemUserDefinedNonExistantCode() {
//@formatter:off
try {
ourClient
myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -229,7 +229,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
@Test
public void testLookupOperationByCoding() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -251,7 +251,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
public void testLookupOperationByInvalidCombination() {
//@formatter:off
try {
ourClient
myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -270,7 +270,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
public void testLookupOperationByInvalidCombination2() {
//@formatter:off
try {
ourClient
myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -288,7 +288,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
public void testLookupOperationByInvalidCombination3() {
//@formatter:off
try {
ourClient
myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -303,7 +303,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
@Test
public void testLookupOperationForBuiltInCode() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -327,22 +327,22 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
@Test
public void testValidationOfUploadedCodeSystems() throws IOException {
CodeSystem csYesNo = loadResource("/dstu3/fmc01-cs-yesnounk.json", CodeSystem.class);
ourClient.update().resource(csYesNo).execute();
myClient.update().resource(csYesNo).execute();
CodeSystem csBinderRecommended = loadResource("/dstu3/fmc03-cs-binderrecommend.json", CodeSystem.class);
ourClient.update().resource(csBinderRecommended).execute();
myClient.update().resource(csBinderRecommended).execute();
ValueSet vsBinderRequired = loadResource("/dstu3/fmc03-vs-binderrecommend.json", ValueSet.class);
ourClient.update().resource(vsBinderRequired);
myClient.update().resource(vsBinderRequired);
ValueSet vsYesNo = loadResource("/dstu3/fmc03-vs-fmcyesno.json", ValueSet.class);
ourClient.update().resource(vsYesNo).execute();
myClient.update().resource(vsYesNo).execute();
Questionnaire q = loadResource("/dstu3/fmc03-questionnaire.json", Questionnaire.class);
ourClient.update().resource(q).execute();
myClient.update().resource(q).execute();
QuestionnaireResponse qr = loadResource("/dstu3/fmc03-questionnaireresponse.json", QuestionnaireResponse.class);
IBaseOperationOutcome oo = ourClient.validate().resource(qr).execute().getOperationOutcome();
IBaseOperationOutcome oo = myClient.validate().resource(qr).execute().getOperationOutcome();
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo);
ourLog.info("Encoded:\n{}", encoded);
@ -359,7 +359,7 @@ public class ResourceProviderDstu3CodeSystemTest extends BaseResourceProviderDst
inParams.addParameter().setName("url").setValue(new UriType("https://url"));
inParams.addParameter().setName("code").setValue(new CodeType("1"));
Parameters outcome = ourClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute();
Parameters outcome = myClient.operation().onType(CodeSystem.class).named("validate-code").withParameters(inParams).execute();
ourLog.info(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome));
String message = outcome

View File

@ -93,7 +93,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
ResourceProviderDstu3ValueSetVersionedTest.createExternalCs(myCodeSystemDao, myResourceTableDao, myTermCodeSystemStorageSvc, mySrd, "2");
// First test with no version specified (should return from last version created)
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -114,7 +114,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// With HTTP GET
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -136,7 +136,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// Test with version 1 specified.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -158,7 +158,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// With HTTP GET
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -181,7 +181,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// Test with version 2 specified.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -203,7 +203,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// With HTTP GET
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -229,7 +229,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testLookupOperationByCodeAndSystemUserDefinedCode() {
// First test with no version specified (should return from last version created)
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -250,7 +250,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// Test with version 1 specified.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -272,7 +272,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// Test with version 2 specified
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -297,7 +297,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testLookupOperationByCodeAndSystemUserDefinedNonExistentVersion() {
try {
ourClient
myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -314,7 +314,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testLookupOperationByCoding() {
// First test with no version specified (should return from last version created)
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -334,7 +334,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// Test with version set to 1
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -354,7 +354,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
// Test with version set to 2
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -378,7 +378,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testLookupOperationByCodeAndSystemBuiltInCode() {
// First test with no version specified (should return the one and only version defined).
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -397,7 +397,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("No", ((StringType) respParam.getParameter().get(2).getValue()).getValue());
// Repeat with version specified.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -420,7 +420,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testSubsumesOnCodes_Subsumes() {
// First test with no version specified (should return result for last version created).
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -437,7 +437,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("subsumes", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 1.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -455,7 +455,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("subsumes", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 2.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -477,7 +477,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testSubsumesOnCodes_Subsumedby() {
// First test with no version specified (should return result for last version created).
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -494,7 +494,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("subsumed-by", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 1.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -512,7 +512,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("subsumed-by", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 2.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -533,7 +533,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testSubsumesOnCodes_Disjoint() {
// First test with no version specified (should return result for last version created).
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -550,7 +550,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("not-subsumed", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 1
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -568,7 +568,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("not-subsumed", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 2
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -590,7 +590,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testSubsumesOnCodings_MismatchedCsVersions() {
try {
ourClient
myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -607,7 +607,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testSubsumesOnCodings_Subsumes() {
// First test with no version specified (should return result for last version created).
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -623,7 +623,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("subsumes", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 1.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -639,7 +639,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("subsumes", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 2.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -660,7 +660,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testSubsumesOnCodings_Subsumedby() {
// First test with no version specified (should return result for last version created).
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -676,7 +676,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("subsumed-by", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 1.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -692,7 +692,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("subsumed-by", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 2.
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -712,7 +712,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testSubsumesOnCodings_Disjoint() {
// First test with no version specified (should return result for last version created).
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -728,7 +728,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("not-subsumed", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 1
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -744,7 +744,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
assertEquals("not-subsumed", ((CodeType) respParam.getParameter().get(0).getValue()).getValue());
// Test with version set to 2
respParam = ourClient
respParam = myClient
.operation()
.onType(CodeSystem.class)
.named(JpaConstants.OPERATION_SUBSUMES)
@ -764,11 +764,11 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
@Test
public void testUpdateCodeSystemById() throws IOException {
CodeSystem initialCodeSystem = ourClient.read().resource(CodeSystem.class).withId(parentChildCs1Id).execute();
CodeSystem initialCodeSystem = myClient.read().resource(CodeSystem.class).withId(parentChildCs1Id).execute();
assertEquals("Parent Child CodeSystem 1", initialCodeSystem.getName());
initialCodeSystem.setName("Updated Parent Child CodeSystem 1");
String encoded = myFhirContext.newJsonParser().encodeResourceToString(initialCodeSystem);
HttpPut putRequest = new HttpPut(ourServerBase + "/CodeSystem/" + parentChildCs1Id);
HttpPut putRequest = new HttpPut(myServerBase + "/CodeSystem/" + parentChildCs1Id);
putRequest.setEntity(new StringEntity(encoded, ContentType.parse("application/json+fhir")));
CloseableHttpResponse resp = ourHttpClient.execute(putRequest);
try {
@ -777,14 +777,14 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
IOUtils.closeQuietly(resp);
}
CodeSystem updatedCodeSystem = ourClient.read().resource(CodeSystem.class).withId(parentChildCs1Id).execute();
CodeSystem updatedCodeSystem = myClient.read().resource(CodeSystem.class).withId(parentChildCs1Id).execute();
assertEquals("Updated Parent Child CodeSystem 1", updatedCodeSystem.getName());
initialCodeSystem = ourClient.read().resource(CodeSystem.class).withId(parentChildCs2Id).execute();
initialCodeSystem = myClient.read().resource(CodeSystem.class).withId(parentChildCs2Id).execute();
assertEquals("Parent Child CodeSystem 2", initialCodeSystem.getName());
initialCodeSystem.setName("Updated Parent Child CodeSystem 2");
encoded = myFhirContext.newJsonParser().encodeResourceToString(initialCodeSystem);
putRequest = new HttpPut(ourServerBase + "/CodeSystem/" + parentChildCs2Id);
putRequest = new HttpPut(myServerBase + "/CodeSystem/" + parentChildCs2Id);
putRequest.setEntity(new StringEntity(encoded, ContentType.parse("application/json+fhir")));
resp = ourHttpClient.execute(putRequest);
try {
@ -793,7 +793,7 @@ public class ResourceProviderDstu3CodeSystemVersionedTest extends BaseResourcePr
IOUtils.closeQuietly(resp);
}
updatedCodeSystem = ourClient.read().resource(CodeSystem.class).withId(parentChildCs2Id).execute();
updatedCodeSystem = myClient.read().resource(CodeSystem.class).withId(parentChildCs2Id).execute();
assertEquals("Updated Parent Child CodeSystem 2", updatedCodeSystem.getName());
}

View File

@ -41,7 +41,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
public void testStoreExistingTermConceptMapAndChildren() {
ConceptMap conceptMap = createConceptMap();
MethodOutcome methodOutcome = ourClient
MethodOutcome methodOutcome = myClient
.update()
.resource(conceptMap)
.conditional()
@ -57,7 +57,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ConceptMap conceptMap = createConceptMap();
conceptMap.getGroupFirstRep().getElementFirstRep().setCode("UPDATED_CODE");
MethodOutcome methodOutcome = ourClient
MethodOutcome methodOutcome = myClient
.update()
.resource(conceptMap)
.conditional()
@ -81,7 +81,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -142,7 +142,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -190,7 +190,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -240,7 +240,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -289,7 +289,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -337,7 +337,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -385,7 +385,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -432,7 +432,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -465,7 +465,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -510,7 +510,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -555,7 +555,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")
@ -600,7 +600,7 @@ public class ResourceProviderDstu3ConceptMapTest extends BaseResourceProviderDst
ourLog.info("Request Parameters:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(inParams));
Parameters respParams = ourClient
Parameters respParams = myClient
.operation()
.onType(ConceptMap.class)
.named("translate")

View File

@ -28,7 +28,7 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
double longitude = CoordCalculatorTestUtil.LONGITUDE_UHN;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position);
IIdType locId = ourClient.create().resource(loc).execute().getId().toUnqualifiedVersionless();
IIdType locId = myClient.create().resource(loc).execute().getId().toUnqualifiedVersionless();
{ // In the box
double bigEnoughDistance = CoordCalculatorTestUtil.DISTANCE_KM_CHIN_TO_UHN * 2;
@ -37,9 +37,9 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
"&" +
Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
Bundle actual = ourClient
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
@ -56,9 +56,9 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
myCaptureQueriesListener.clear();
Bundle actual = ourClient
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
@ -76,18 +76,18 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
double longitude = CoordCalculatorTestUtil.LONGITUDE_CHIN;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position);
IIdType locId = ourClient.create().resource(loc).execute().getId().toUnqualifiedVersionless();
IIdType locId = myClient.create().resource(loc).execute().getId().toUnqualifiedVersionless();
PractitionerRole pr = new PractitionerRole();
pr.addLocation().setReference(locId.getValue());
IIdType prId = ourClient.create().resource(pr).execute().getId().toUnqualifiedVersionless();
IIdType prId = myClient.create().resource(pr).execute().getId().toUnqualifiedVersionless();
String url = "PractitionerRole?location." +
Location.SP_NEAR + "=" + latitude + URLEncoder.encode(":") + longitude;
Bundle actual = ourClient
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
@ -119,9 +119,9 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
"location." + Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
myCaptureQueriesListener.clear();
Bundle actual = ourClient
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
@ -140,9 +140,9 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3
"location." + Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
myCaptureQueriesListener.clear();
Bundle actual = ourClient
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)

View File

@ -22,7 +22,7 @@ public class ResourceProviderDstu3StructureDefinitionTest extends BaseResourcePr
public void testSnapshotWithResourceParameter() throws IOException {
StructureDefinition sd = loadResourceFromClasspath(StructureDefinition.class, "/dstu3/profile-differential-patient-dstu3.json");
StructureDefinition response = ourClient
StructureDefinition response = myClient
.operation()
.onType(StructureDefinition.class)
.named(JpaConstants.OPERATION_SNAPSHOT)
@ -36,9 +36,9 @@ public class ResourceProviderDstu3StructureDefinitionTest extends BaseResourcePr
@Test
public void testSnapshotWithId() throws IOException {
StructureDefinition sd = loadResourceFromClasspath(StructureDefinition.class, "/dstu3/profile-differential-patient-dstu3.json");
IIdType id = ourClient.create().resource(sd).execute().getId().toUnqualifiedVersionless();
IIdType id = myClient.create().resource(sd).execute().getId().toUnqualifiedVersionless();
StructureDefinition response = ourClient
StructureDefinition response = myClient
.operation()
.onInstance(id)
.named(JpaConstants.OPERATION_SNAPSHOT)
@ -52,9 +52,9 @@ public class ResourceProviderDstu3StructureDefinitionTest extends BaseResourcePr
@Test
public void testSnapshotWithUrl() throws IOException {
StructureDefinition sd = loadResourceFromClasspath(StructureDefinition.class, "/dstu3/profile-differential-patient-dstu3.json");
IIdType id = ourClient.create().resource(sd).execute().getId().toUnqualifiedVersionless();
IIdType id = myClient.create().resource(sd).execute().getId().toUnqualifiedVersionless();
StructureDefinition response = ourClient
StructureDefinition response = myClient
.operation()
.onType(StructureDefinition.class)
.named(JpaConstants.OPERATION_SNAPSHOT)
@ -67,7 +67,7 @@ public class ResourceProviderDstu3StructureDefinitionTest extends BaseResourcePr
@Test
public void testSnapshotWithUrlAndId() {
try {
ourClient
myClient
.operation()
.onInstance(new IdType("StructureDefinition/123"))
.named(JpaConstants.OPERATION_SNAPSHOT)
@ -82,7 +82,7 @@ public class ResourceProviderDstu3StructureDefinitionTest extends BaseResourcePr
@Test
public void testSnapshotWithInvalidUrl() {
try {
ourClient
myClient
.operation()
.onType(StructureDefinition.class)
.named(JpaConstants.OPERATION_SNAPSHOT)

View File

@ -235,8 +235,8 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
.setOp(ValueSet.FilterOperator.REGEX)
.setValue("12345-1|12345-2");
IIdType vsId = ourClient.create().resource(vs).execute().getId();
outcome = (ValueSet) ourClient.operation().onInstance(vsId).named("expand").withNoParameters(Parameters.class).execute().getParameter().get(0).getResource();
IIdType vsId = myClient.create().resource(vs).execute().getId();
outcome = (ValueSet) myClient.operation().onInstance(vsId).named("expand").withNoParameters(Parameters.class).execute().getParameter().get(0).getResource();
codes = toCodesContains(outcome.getExpansion().getContains());
ourLog.info("** Got codes: {}", codes);
assertThat(codes, Matchers.containsInAnyOrder("50015-7"));
@ -271,8 +271,8 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
exclude = vs.getCompose().addExclude();
exclude.setSystem(CS_URL);
IIdType vsId = ourClient.create().resource(vs).execute().getId();
outcome = (ValueSet) ourClient.operation().onInstance(vsId).named("expand").withNoParameters(Parameters.class).execute().getParameter().get(0).getResource();
IIdType vsId = myClient.create().resource(vs).execute().getId();
outcome = (ValueSet) myClient.operation().onInstance(vsId).named("expand").withNoParameters(Parameters.class).execute().getParameter().get(0).getResource();
codes = toCodesContains(outcome.getExpansion().getContains());
assertThat(codes, Matchers.empty());
}
@ -282,7 +282,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testExpandById() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -315,7 +315,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
loadAndPersistCodeSystemAndValueSet();
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -345,7 +345,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testExpandByIdWithFilter() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -371,7 +371,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testExpandByIdentifier() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -391,7 +391,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testExpandByUrl() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -413,7 +413,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -434,7 +434,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
loadAndPersistCodeSystemAndValueSet();
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -453,7 +453,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
loadAndPersistCodeSystemAndValueSet();
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -477,7 +477,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -495,7 +495,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -516,7 +516,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
createLocalVsPointingAtBuiltInCodeSystem();
assertNotNull(myLocalValueSetId);
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -536,7 +536,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
assertNotNull(myLocalVs);
myLocalVs.setId("");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -558,7 +558,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
loadAndPersistCodeSystemAndValueSet();
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -571,7 +571,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
try {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-dstu3.xml");
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -585,7 +585,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
try {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-dstu3.xml");
ourClient
myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -598,7 +598,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
}
try {
ourClient
myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -610,7 +610,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
}
try {
ourClient
myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@ -627,7 +627,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
createLocalVsPointingAtBuiltInCodeSystem();
assertNotNull(myLocalValueSetId);
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myLocalValueSetId)
.named("expand")
@ -646,7 +646,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
createExternalCsAndLocalVs();
assertNotNull(myLocalValueSetId);
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myLocalValueSetId)
.named("expand")
@ -668,7 +668,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
createExternalCsAndLocalVs();
assertNotNull(myLocalValueSetId);
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -691,7 +691,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
@Test
public void testInvalidFilter() throws Exception {
String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8);
HttpPost post = new HttpPost(ourServerBase + "/ValueSet/%24expand");
HttpPost post = new HttpPost(myServerBase + "/ValueSet/%24expand");
post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW)));
try (CloseableHttpResponse resp = ourHttpClient.execute(post)) {
@ -711,7 +711,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testValidateCodeOperationByCodeAndSystemInstance() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("validate-code")
@ -732,7 +732,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
createLocalCs();
createLocalVsWithIncludeConcept();
String url = ourServerBase +
String url = myServerBase +
"/ValueSet/" + myLocalValueSetId.getIdPart() + "/$validate-code?system=" +
UrlUtil.escapeUrlParam(URL_MY_CODE_SYSTEM) +
"&code=AA";
@ -754,7 +754,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testValidateCodeOperationByCodeAndSystemType() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -776,7 +776,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testValidateCodeAgainstBuiltInSystem() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -806,7 +806,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testValidateCodeAgainstBuiltInSystemByUrl() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -835,7 +835,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -858,7 +858,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -878,7 +878,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -899,7 +899,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -918,7 +918,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testExpandByUrlWithFilter() throws Exception {
loadAndPersistCodeSystemAndValueSet();
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")

View File

@ -265,7 +265,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
loadAndPersistCodeSystemAndValueSet();
// Test with v1 of ValueSet
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v1)
.named("expand")
@ -290,7 +290,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertThat(resp, containsString("</expansion>"));
// Test with v2 of ValueSet
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v2)
.named("expand")
@ -326,7 +326,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertEquals(2, page.getContent().size());
// Verify v1 ValueSet
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v1)
.named("expand")
@ -351,7 +351,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertThat(resp, containsString("</expansion>"));
// Verify v2 ValueSet
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v2)
.named("expand")
@ -382,7 +382,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
loadAndPersistCodeSystemAndValueSet();
// Verify ValueSet v1
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v1)
.named("expand")
@ -396,7 +396,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertThat(resp, not(containsString("\"Foo Code\"")));
// Verify ValueSet v2
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v2)
.named("expand")
@ -422,7 +422,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertEquals(2, page.getContent().size());
// Validate ValueSet v1
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v1)
.named("expand")
@ -436,7 +436,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertThat(resp, not(containsString("\"Foo Code\"")));
// Validate ValueSet v2
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v2)
.named("expand")
@ -456,7 +456,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
loadAndPersistCodeSystemAndValueSet();
// Check expansion of multi-versioned ValueSet with version 1
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -472,7 +472,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
"<display value=\"Systolic blood pressure at First encounter\"/>"));
// Check expansion of multi-versioned ValueSet with version set to null
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -488,7 +488,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
"<display value=\"Systolic blood pressure at First encounter v2\"/>"));
// Check expansion of version 2
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -511,7 +511,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
loadAndPersistCodeSystemAndValueSet();
// Check expansion of multi-versioned ValueSet with version 1
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -527,7 +527,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
"<display value=\"Systolic blood pressure at First encounter\"/>"));
// Check expansion of multi-versioned ValueSet with version set to null
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -543,7 +543,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
"<display value=\"Systolic blood pressure at First encounter v2\"/>"));
// Check expansion of version 2
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -565,7 +565,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
loadAndPersistCodeSystemAndValueSet();
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -589,7 +589,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertEquals(2, page.getContent().size());
// Check expansion of multi-versioned ValueSet with version 1
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -605,7 +605,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
"<display value=\"Systolic blood pressure at First encounter\"/>"));
// Check expansion of multi-versioned ValueSet with version set to null
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -621,7 +621,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
"<display value=\"Systolic blood pressure at First encounter v2\"/>"));
// Check expansion of version 2
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -646,7 +646,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
try {
ourClient
myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -666,7 +666,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
// Test with no version specified
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -686,7 +686,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
toExpand.setId("ValueSet/vs1");
toExpand.getCompose().getInclude().get(0).setVersion("1");
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -707,7 +707,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
toExpand.setId("ValueSet/vs2");
toExpand.getCompose().getInclude().get(0).setVersion("2");
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -735,7 +735,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
// Test with no version specified
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -755,7 +755,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
toExpand.setId("ValueSet/vs1");
toExpand.getCompose().getInclude().get(0).setVersion("1");
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -776,7 +776,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
toExpand.setId("ValueSet/vs2");
toExpand.getCompose().getInclude().get(0).setVersion("2");
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -802,7 +802,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertNotNull(myLocalVs_v2);
myLocalVs_v1.setId("");
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -818,7 +818,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertThat(resp, not(containsStringIgnoringCase("<display value=\"Parent A1\"/>")));
myLocalVs_v2.setId("");
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -842,7 +842,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertNotNull(myLocalValueSetId_v2);
// Validate ValueSet v1
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myLocalValueSetId_v1)
.named("expand")
@ -858,7 +858,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertThat(resp, not(containsStringIgnoringCase("<display value=\"Parent A1\"/>")));
// Validate ValueSet v2
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myLocalValueSetId_v2)
.named("expand")
@ -881,7 +881,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertNotNull(myLocalValueSetId_v1);
assertNotNull(myLocalValueSetId_v2);
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@ -910,15 +910,15 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
cs.setUrl("http://foo1");
cs.setVersion("1");
cs.addConcept().setCode("foo1").setDisplay("foo1");
ourClient.update().resource(cs).execute();
myClient.update().resource(cs).execute();
ValueSet vs = new ValueSet();
vs.setId("ValueSet/VS179789");
vs.setUrl("http://bar");
vs.getCompose().addInclude().setSystem("http://foo1").setVersion("1").addConcept().setCode("foo1");
ourClient.update().resource(vs).execute();
myClient.update().resource(vs).execute();
ValueSet expanded = ourClient
ValueSet expanded = myClient
.operation()
.onInstance(new IdType("ValueSet/VS179789"))
.named("$expand")
@ -935,15 +935,15 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
cs.setUrl("http://foo2");
cs.setVersion("2");
cs.addConcept().setCode("foo2").setDisplay("foo2");
ourClient.update().resource(cs).execute();
myClient.update().resource(cs).execute();
vs = new ValueSet();
vs.setId("ValueSet/VS179789");
vs.setUrl("http://bar");
vs.getCompose().addInclude().setSystem("http://foo2").setVersion("2").addConcept().setCode("foo2");
ourClient.update().resource(vs).execute();
myClient.update().resource(vs).execute();
expanded = ourClient
expanded = myClient
.operation()
.onInstance(new IdType("ValueSet/VS179789"))
.named("$expand")
@ -1030,7 +1030,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
ValueSet updatedValueSet_v1 = valueSet_v1;
updatedValueSet_v1.setName(valueSet_v1.getName().concat(" - MODIFIED"));
String url = ourClient.getServerBase().concat("/").concat(myExtensionalVsId_v1.getValueAsString());
String url = myClient.getServerBase().concat("/").concat(myExtensionalVsId_v1.getValueAsString());
Bundle bundle = new Bundle();
bundle.setType(Bundle.BundleType.TRANSACTION);
bundle
@ -1041,7 +1041,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
.setMethod(Bundle.HTTPVerb.PUT)
.setUrl("ValueSet/" + updatedValueSet_v1.getIdElement().getIdPart());
ourLog.info("Transaction Bundle:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(bundle));
ourClient.transaction().withBundle(bundle).execute();
myClient.transaction().withBundle(bundle).execute();
updatedValueSet_v1 = myValueSetDao.read(myExtensionalVsId_v1);
ourLog.info("Updated ValueSet:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(updatedValueSet_v1));
@ -1052,7 +1052,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
ValueSet updatedValueSet_v2 = valueSet_v2;
updatedValueSet_v2.setName(valueSet_v2.getName().concat(" - MODIFIED"));
url = ourClient.getServerBase().concat("/").concat(myExtensionalVsId_v2.getValueAsString());
url = myClient.getServerBase().concat("/").concat(myExtensionalVsId_v2.getValueAsString());
bundle = new Bundle();
bundle.setType(Bundle.BundleType.TRANSACTION);
bundle
@ -1063,7 +1063,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
.setMethod(Bundle.HTTPVerb.PUT)
.setUrl("ValueSet/" + updatedValueSet_v2.getIdElement().getIdPart());
ourLog.info("Transaction Bundle:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(bundle));
ourClient.transaction().withBundle(bundle).execute();
myClient.transaction().withBundle(bundle).execute();
updatedValueSet_v2 = myValueSetDao.read(myExtensionalVsId_v2);
ourLog.info("Updated ValueSet:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(updatedValueSet_v2));
@ -1180,7 +1180,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
loadAndPersistCodeSystemAndValueSet();
// With correct system version specified. Should pass.
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1196,7 +1196,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertTrue(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1213,7 +1213,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertTrue(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
// With incorrect version specified. Should fail.
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1229,7 +1229,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertFalse(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1252,7 +1252,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
loadAndPersistCodeSystemAndValueSet();
// With correct system version specified. Should pass.
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v1)
.named("validate-code")
@ -1266,7 +1266,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertTrue(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v2)
.named("validate-code")
@ -1281,7 +1281,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertTrue(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
// With incorrect version specified. Should fail.
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v1)
.named("validate-code")
@ -1295,7 +1295,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertFalse(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
respParam = ourClient
respParam = myClient
.operation()
.onInstance(myExtensionalVsId_v2)
.named("validate-code")
@ -1322,7 +1322,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
codingToValidate_v2.setVersion("2");
// With correct system version specified. Should pass.
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1336,7 +1336,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertTrue(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1351,7 +1351,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertTrue(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
// With incorrect version specified. Should fail.
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1365,7 +1365,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertFalse(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1394,7 +1394,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
CodeableConcept codeableConceptToValidate_v2 = new CodeableConcept(codingToValidate);
// With correct system version specified. Should pass.
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1408,7 +1408,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertTrue(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1423,7 +1423,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertTrue(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
// With incorrect version specified. Should fail.
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@ -1437,7 +1437,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv
assertFalse(((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
respParam = ourClient
respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")

View File

@ -18,7 +18,6 @@ import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.dstu3.model.QuestionnaireResponse;
import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus;
import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -61,7 +60,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
}
}
ourRestServer.registerInterceptor(ourValidatingInterceptor);
myRestServer.registerInterceptor(ourValidatingInterceptor);
}
@ -82,7 +81,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
qr1.setStatus(QuestionnaireResponseStatus.COMPLETED);
qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123));
try {
ourClient.create().resource(qr1).execute();
myClient.create().resource(qr1).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.toString(), containsString("Answer value must be of type string"));
@ -131,7 +130,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
" </item>\n" +
"</QuestionnaireResponse>";
HttpPost post = new HttpPost(ourServerBase + "/QuestionnaireResponse");
HttpPost post = new HttpPost(myServerBase + "/QuestionnaireResponse");
post.setEntity(new StringEntity(input, ContentType.create(ca.uhn.fhir.rest.api.Constants.CT_FHIR_XML, "UTF-8")));
CloseableHttpResponse response = ourHttpClient.execute(post);
final IdType id2;
@ -140,13 +139,13 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
ourLog.info("Response: {}", responseString);
assertEquals(201, response.getStatusLine().getStatusCode());
String newIdString = response.getFirstHeader(ca.uhn.fhir.rest.api.Constants.HEADER_LOCATION_LC).getValue();
assertThat(newIdString, startsWith(ourServerBase + "/QuestionnaireResponse/"));
assertThat(newIdString, startsWith(myServerBase + "/QuestionnaireResponse/"));
id2 = new IdType(newIdString);
} finally {
IOUtils.closeQuietly(response);
}
HttpGet get = new HttpGet(ourServerBase + "/QuestionnaireResponse/" + id2.getIdPart() + "?_format=xml&_pretty=true");
HttpGet get = new HttpGet(myServerBase + "/QuestionnaireResponse/" + id2.getIdPart() + "?_format=xml&_pretty=true");
response = ourHttpClient.execute(get);
try {
String responseString = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -162,7 +161,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
@Test
public void testValidateOnNoId() throws Exception {
HttpGet get = new HttpGet(ourServerBase + "/QuestionnaireResponse/$validate");
HttpGet get = new HttpGet(myServerBase + "/QuestionnaireResponse/$validate");
CloseableHttpResponse response = ourHttpClient.execute(get);
try {
String responseString = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -183,7 +182,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
public void testValidateQuestionnaireResponseWithNoIdForCreate() throws Exception {
String input = "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"mode\",\"valueString\":\"create\"},{\"name\":\"resource\",\"resource\":{\"resourceType\":\"QuestionnaireResponse\",\"questionnaire\":{\"reference\":\"http://fhirtest.uhn.ca/baseDstu2/Questionnaire/MedsCheckEligibility\"},\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">!-- populated from the rendered HTML below --></div>\"},\"status\":\"completed\",\"authored\":\"2017-02-10T00:02:58.098Z\"}}]}";
HttpPost post = new HttpPost(ourServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
HttpPost post = new HttpPost(myServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
CloseableHttpResponse response = ourHttpClient.execute(post);
try {
@ -203,7 +202,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
public void testValidateQuestionnaireResponseWithNoIdForUpdate() throws Exception {
String input = "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"mode\",\"valueString\":\"update\"},{\"name\":\"resource\",\"resource\":{\"resourceType\":\"QuestionnaireResponse\",\"questionnaire\":{\"reference\":\"http://fhirtest.uhn.ca/baseDstu2/Questionnaire/MedsCheckEligibility\"},\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">!-- populated from the rendered HTML below --></div>\"},\"status\":\"completed\",\"authored\":\"2017-02-10T00:02:58.098Z\"}}]}";
HttpPost post = new HttpPost(ourServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
HttpPost post = new HttpPost(myServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
CloseableHttpResponse response = ourHttpClient.execute(post);
try {

View File

@ -33,7 +33,7 @@ public class ResourceProviderR3CodeSystemDesignationTest extends BaseResourcePro
@Test
public void testLookupWithDisplayLanguage() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -77,7 +77,7 @@ public class ResourceProviderR3CodeSystemDesignationTest extends BaseResourcePro
@Test
public void testLookupWithNonExistLanguage() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@ -113,7 +113,7 @@ public class ResourceProviderR3CodeSystemDesignationTest extends BaseResourcePro
@Test
public void testLookupWithoutDisplayLanguage() {
Parameters respParam = ourClient
Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")

View File

@ -26,7 +26,7 @@ public class ServerDstu3Test extends BaseResourceProviderDstu3Test {
@AfterEach
public void after() throws Exception {
super.after();
ourRestServer.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof OpenApiInterceptor);
myRestServer.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof OpenApiInterceptor);
}
@ -35,7 +35,7 @@ public class ServerDstu3Test extends BaseResourceProviderDstu3Test {
*/
@Test
public void saveIdParamOnlyAppearsOnce() throws IOException {
HttpGet get = new HttpGet(ourServerBase + "/metadata?_pretty=true&_format=xml");
HttpGet get = new HttpGet(myServerBase + "/metadata?_pretty=true&_format=xml");
CloseableHttpResponse resp = ourHttpClient.execute(get);
try {
ourLog.info(resp.toString());
@ -67,9 +67,9 @@ public class ServerDstu3Test extends BaseResourceProviderDstu3Test {
@Test
public void testFetchOpenApi() throws IOException {
ourRestServer.registerInterceptor(new OpenApiInterceptor());
myRestServer.registerInterceptor(new OpenApiInterceptor());
HttpGet get = new HttpGet(ourServerBase + "/api-docs");
HttpGet get = new HttpGet(myServerBase + "/api-docs");
try (CloseableHttpResponse response = ourHttpClient.execute(get)) {
String string = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(string);

View File

@ -61,7 +61,7 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
subs.getChannel().setEndpoint("http://localhost:8888");
subs.setCriteria("Observation?identifier=123");
try {
ourClient.create().resource(subs).execute();
myClient.create().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
@ -69,14 +69,14 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
subs.setId("ABC");
try {
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
}
subs.setStatus(SubscriptionStatus.REQUESTED);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
}
@Test
@ -88,7 +88,7 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
subs.setStatus(SubscriptionStatus.ACTIVE);
subs.setCriteria("Observation?identifier=123");
try {
ourClient.create().resource(subs).execute();
myClient.create().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(816) + "Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage());
@ -96,7 +96,7 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
subs.setId("ABC");
try {
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(816) + "Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage());
@ -112,13 +112,13 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
subs.getChannel().setEndpoint("http://localhost:8888");
subs.setStatus(SubscriptionStatus.REQUESTED);
subs.setCriteria("Observation?identifier=123");
IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless();
IIdType id = myClient.create().resource(subs).execute().getId().toUnqualifiedVersionless();
subs.setId(id);
try {
subs.setStatus(SubscriptionStatus.ACTIVE);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(814) + "Subscription.status can not be changed from 'requested' to 'active'", e.getMessage());
@ -126,7 +126,7 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
try {
subs.setStatus(null);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
@ -144,12 +144,12 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
subs.getChannel().setEndpoint("http://localhost:8888");
subs.setCriteria("Observation?identifier=123");
subs.setStatus(SubscriptionStatus.REQUESTED);
IIdType id = ourClient.create().resource(subs).execute().getId();
IIdType id = myClient.create().resource(subs).execute().getId();
subs.setId(id);
try {
subs.setStatus(SubscriptionStatus.ACTIVE);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: " + Msg.code(814) + "Subscription.status can not be changed from 'requested' to 'active'", e.getMessage());
@ -157,14 +157,14 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
try {
subs.setStatus(null);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
}
subs.setStatus(SubscriptionStatus.OFF);
ourClient.update().resource(subs).execute();
myClient.update().resource(subs).execute();
}

View File

@ -63,7 +63,7 @@ public class PagingMultinodeProviderDstu3Test extends BaseResourceProviderDstu3T
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10);
mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true);
found = ourClient
found = myClient
.search()
.forResource(Patient.class)
.sort().ascending(Patient.SP_FAMILY)
@ -72,19 +72,19 @@ public class PagingMultinodeProviderDstu3Test extends BaseResourceProviderDstu3T
.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 = ourClient
found = myClient
.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 = ourClient
found = myClient
.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 = ourClient
found = myClient
.loadPage()
.next(found)
.execute();
@ -110,7 +110,7 @@ public class PagingMultinodeProviderDstu3Test extends BaseResourceProviderDstu3T
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10);
mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true);
found = ourClient
found = myClient
.search()
.forResource(Patient.class)
.sort().ascending(Patient.SP_FAMILY)
@ -123,20 +123,20 @@ public class PagingMultinodeProviderDstu3Test extends BaseResourceProviderDstu3T
.orElseThrow(() -> new IllegalStateException("No next page link")).contains("_offset=10"), is(true));
myCaptureQueriesListener.clear();
found = ourClient
found = myClient
.loadPage()
.next(found)
.execute();
myCaptureQueriesListener.logSelectQueries();
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 = ourClient
found = myClient
.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 = ourClient
found = myClient
.loadPage()
.next(found)
.execute();

View File

@ -56,14 +56,14 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
ourLog.info("**** Starting @AfterEach *****");
for (IIdType next : mySubscriptionIds) {
ourClient.delete().resourceById(next).execute();
myClient.delete().resourceById(next).execute();
}
mySubscriptionIds.clear();
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@ -106,7 +106,7 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
int initialCount = mySubscriptionRegistry.getAll().size();
ourLog.info("About to create subscription...");
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId().getIdPart());
mySubscriptionIds.add(methodOutcome.getId());
@ -127,7 +127,7 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
observation.setStatus(Observation.ObservationStatus.FINAL);
MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);
@ -162,7 +162,7 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
assertEquals(mySubscriptionIds.get(0).toUnqualifiedVersionless().getValue(), received.get(0).getHeader("X-FHIR-Subscription")[0]);
// Expect the body of the email subscription to be an Observation formatted as XML
Observation parsedObservation = (Observation) ourClient.getFhirContext().newXmlParser().parseResource(received.get(0).getContent().toString().trim());
Observation parsedObservation = (Observation) myClient.getFhirContext().newXmlParser().parseResource(received.get(0).getContent().toString().trim());
assertEquals("SNOMED-CT", parsedObservation.getCode().getCodingFirstRep().getSystem());
assertEquals("1000000050", parsedObservation.getCode().getCodingFirstRep().getCode());
}
@ -209,7 +209,7 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
assertEquals(mySubscriptionIds.get(0).toUnqualifiedVersionless().getValue(), received.get(0).getHeader("X-FHIR-Subscription")[0]);
// Expect the body of the email subscription to be an Observation formatted as JSON
Observation parsedObservation = (Observation) ourClient.getFhirContext().newJsonParser().parseResource(received.get(0).getContent().toString().trim());
Observation parsedObservation = (Observation) myClient.getFhirContext().newJsonParser().parseResource(received.get(0).getContent().toString().trim());
assertEquals("SNOMED-CT", parsedObservation.getCode().getCodingFirstRep().getSystem());
assertEquals("1000000050", parsedObservation.getCode().getCodingFirstRep().getCode());
}
@ -257,7 +257,7 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
assertEquals("", received.get(0).getContent().toString().trim());
assertEquals(mySubscriptionIds.get(0).toUnqualifiedVersionless().getValue(), received.get(0).getHeader("X-FHIR-Subscription")[0]);
Subscription subscription = ourClient.read().resource(Subscription.class).withId(sub1.getIdElement().toUnqualifiedVersionless()).execute();
Subscription subscription = myClient.read().resource(Subscription.class).withId(sub1.getIdElement().toUnqualifiedVersionless()).execute();
assertEquals(Subscription.SubscriptionStatus.ACTIVE, subscription.getStatus());
assertEquals("2", subscription.getIdElement().getVersionIdPart());
}

View File

@ -97,14 +97,14 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
ourLog.info("**** Starting @AfterEach *****");
for (IIdType next : mySubscriptionIds) {
ourClient.delete().resourceById(next).execute();
myClient.delete().resourceById(next).execute();
}
mySubscriptionIds.clear();
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@ -138,7 +138,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
List<StringType> headers, Extension theChannelExtension) throws InterruptedException {
Subscription subscription = newSubscription(theCriteria, thePayload, theEndpoint, headers, theChannelExtension);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
mySubscriptionIds.add(methodOutcome.getId());
waitForQueueToDrain();
@ -177,7 +177,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
observation.setStatus(Observation.ObservationStatus.FINAL);
MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);
@ -261,13 +261,13 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
Assertions.assertEquals("abc-def", ourNotificationServlet.getReceivedAuthorizationHeaders().get(0));
ourNotificationServlet.reset();
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see 2 subscription notifications with and without authorization header
waitForSize(1, ourNotificationServlet.getReceivedAuthorizationHeaders());
@ -305,7 +305,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
String criteria = "Observation?_source=" + source;
Subscription subscription = newSubscription(criteria, payload, ourListenerServerBase, null, null);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
Subscription savedSub = (Subscription) methodOutcome.getResource();
assertInMemoryTag(savedSub);
mySubscriptionIds.add(methodOutcome.getId());
@ -314,7 +314,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
Observation observation = new Observation();
MetaUtil.setSource(myFhirContext, observation, source);
ourClient.create().resource(observation).execute();
myClient.create().resource(observation).execute();
// Should see 1 subscription notification
waitForQueueToDrain();
@ -343,10 +343,10 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
// Modify subscription 2 to also match
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
// Send another
@ -357,7 +357,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
myClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
waitForQueueToDrain();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@ -367,27 +367,27 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
@ -420,10 +420,10 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
// Modify subscription 2 to also match
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
// Send another observation
@ -435,7 +435,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
myClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
waitForQueueToDrain();
// Send another
@ -447,27 +447,27 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
@ -555,9 +555,9 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
assertEquals("In-memory", tag.getDisplay());
// Wait for subscription to be moved to active
await().until(() -> Subscription.SubscriptionStatus.ACTIVE.equals(ourClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute().getStatus()));
await().until(() -> Subscription.SubscriptionStatus.ACTIVE.equals(myClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute().getStatus()));
Subscription subscriptionActivated = ourClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute();
Subscription subscriptionActivated = myClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute();
assertEquals(Subscription.SubscriptionStatus.ACTIVE, subscriptionActivated.getStatus());
assertInMemoryTag(subscriptionActivated);
}
@ -588,9 +588,9 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
assertEquals("Database", tag.getDisplay());
// Wait for subscription to be moved to active
await().until(() -> Subscription.SubscriptionStatus.ACTIVE.equals(ourClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute().getStatus()));
await().until(() -> Subscription.SubscriptionStatus.ACTIVE.equals(myClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute().getStatus()));
Subscription subscription = ourClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute();
Subscription subscription = myClient.read().resource(Subscription.class).withId(subscriptionId.toUnqualifiedVersionless()).execute();
assertEquals(Subscription.SubscriptionStatus.ACTIVE, subscription.getStatus());
tags = subscription.getMeta().getTag();
assertEquals(1, tags.size());
@ -603,7 +603,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
@Test
public void testCommunicationRequestWithRef() throws InterruptedException {
Organization org = new Organization();
MethodOutcome methodOutcome = ourClient.create().resource(org).execute();
MethodOutcome methodOutcome = myClient.create().resource(org).execute();
String orgId = methodOutcome.getId().getIdPart();
String criteria = "CommunicationRequest?requester=1276," + orgId + "&occurrence=ge2019-02-08T00:00:00-05:00&occurrence=le2019-02-09T00:00:00-05:00";
@ -614,7 +614,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
cr.getRequester().getAgent().setReference("Organization/" + orgId);
cr.setOccurrence(new DateTimeType("2019-02-08T00:01:00-05:00"));
communicationRequestListenerLatch = new CountDownLatch(1);
ourClient.create().resource(cr).execute();
myClient.create().resource(cr).execute();
assertTrue(communicationRequestListenerLatch.await(10, TimeUnit.SECONDS), "Timed out waiting for subscription to match");
}
@ -624,7 +624,7 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test {
subscription.setStatus(null);
try {
ourClient.create().resource(subscription).execute();
myClient.create().resource(subscription).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Can not process submitted Subscription - Subscription.status must be populated on this server"));

View File

@ -61,7 +61,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
public void afterUnregisterRestHookListener() {
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@ -91,7 +91,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
channel.setEndpoint(endpoint);
subscription.setChannel(channel);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId().getIdPart());
waitForQueueToDrain();
@ -112,7 +112,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
observation.setStatus(Observation.ObservationStatus.FINAL);
MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);
@ -138,11 +138,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@ -151,7 +151,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
myClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
waitForQueueToDrain();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@ -160,26 +160,26 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForSize(0, ourCreatedObservations);
@ -208,11 +208,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@ -222,7 +222,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
myClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@ -231,27 +231,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();

View File

@ -90,14 +90,14 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
ourLog.info("**** Starting @AfterEach *****");
for (IIdType next : mySubscriptionIds) {
ourClient.delete().resourceById(next).execute();
myClient.delete().resourceById(next).execute();
}
mySubscriptionIds.clear();
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
ourClient.delete().resourceConditionalByUrl("Subscription?_lastUpdated=lt3000").execute();
ourClient.delete().resourceConditionalByUrl("Observation?_lastUpdated=lt3000").execute();
myClient.delete().resourceConditionalByUrl("Subscription?_lastUpdated=lt3000").execute();
myClient.delete().resourceConditionalByUrl("Observation?_lastUpdated=lt3000").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@ -141,7 +141,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
channel.setEndpoint(theEndpoint);
subscription.setChannel(channel);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId());
mySubscriptionIds.add(methodOutcome.getId());
@ -160,7 +160,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
observation.setStatus(Observation.ObservationStatus.FINAL);
MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);
@ -188,7 +188,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
Parameters response = ourClient
Parameters response = myClient
.operation()
.onInstance(subscriptionId)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -219,14 +219,14 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
for (int i = 0; i < 50; i++) {
Patient p = new Patient();
p.addName().setFamily("P" + i);
ourClient.create().resource(p).execute();
myClient.create().resource(p).execute();
}
for (int i = 0; i < 50; i++) {
Observation o = new Observation();
o.setId("O" + i);
o.setStatus(Observation.ObservationStatus.FINAL);
o.getCode().setText("O" + i);
ourClient.update().resource(o).execute();
myClient.update().resource(o).execute();
}
waitForSize(50, ourUpdatedObservations);
@ -238,7 +238,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
SubscriptionTriggeringSvcImpl svc = ProxyUtil.getSingletonTarget(mySubscriptionTriggeringSvc, SubscriptionTriggeringSvcImpl.class);
svc.setMaxSubmitPerPass(33);
Parameters response = ourClient
Parameters response = myClient
.operation()
.onInstance(sub1id)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -248,7 +248,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
response = ourClient
response = myClient
.operation()
.onInstance(sub2id)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -280,7 +280,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
// Use multiple strings
beforeReset();
Parameters response = ourClient
Parameters response = myClient
.operation()
.onInstance(sub2id)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -320,7 +320,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
// Use a single
beforeReset();
Parameters response = ourClient
Parameters response = myClient
.operation()
.onInstance(sub2id)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -347,14 +347,14 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
for (int i = 0; i < 50; i++) {
Patient p = new Patient();
p.addName().setFamily("P" + i);
ourClient.create().resource(p).execute();
myClient.create().resource(p).execute();
}
for (int i = 0; i < 50; i++) {
Observation o = new Observation();
o.setId("O" + i);
o.setStatus(Observation.ObservationStatus.FINAL);
o.getCode().setText("O" + i);
ourClient.update().resource(o).execute();
myClient.update().resource(o).execute();
}
waitForSize(50, ourUpdatedObservations);
@ -366,7 +366,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
SubscriptionTriggeringSvcImpl svc = ProxyUtil.getSingletonTarget(mySubscriptionTriggeringSvc, SubscriptionTriggeringSvcImpl.class);
svc.setMaxSubmitPerPass(33);
Parameters response = ourClient
Parameters response = myClient
.operation()
.onInstance(sub1id)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -375,7 +375,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
String responseValue = response.getParameter().get(0).getValue().primitiveValue();
assertThat(responseValue, containsString("Subscription triggering job submitted as JOB ID"));
response = ourClient
response = myClient
.operation()
.onInstance(sub2id)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -398,7 +398,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
public void testTriggerUsingInvalidSearchUrl() {
try {
ourClient
myClient
.operation()
.onType(Subscription.class)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -421,7 +421,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
o.setId("O" + i);
o.setStatus(Observation.ObservationStatus.FINAL);
o.getCode().setText("O" + i);
ourClient.update().resource(o).execute();
myClient.update().resource(o).execute();
}
waitForSize(20, ourUpdatedObservations);
@ -433,7 +433,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
SubscriptionTriggeringSvcImpl svc = ProxyUtil.getSingletonTarget(mySubscriptionTriggeringSvc, SubscriptionTriggeringSvcImpl.class);
svc.setMaxSubmitPerPass(50);
Parameters response = ourClient
Parameters response = myClient
.operation()
.onType(Subscription.class)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -470,7 +470,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
Parameters response = ourClient
Parameters response = myClient
.operation()
.onInstance(subscriptionId)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -520,7 +520,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
// Use a trigger subscription
beforeReset();
Parameters response = ourClient
Parameters response = myClient
.operation()
.onInstance(sub2id)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -559,7 +559,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
// Use a trigger subscription
beforeReset();
Parameters response = ourClient
Parameters response = myClient
.operation()
.onInstance(sub2id)
.named(JpaConstants.OPERATION_TRIGGER_SUBSCRIPTION)
@ -672,7 +672,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
Patient p = new Patient();
p.setId("P" + i);
p.addName().setFamily("P" + i);
ourClient.update().resource(p).execute();
myClient.update().resource(p).execute();
}
waitForSize(numberOfPatient, ourUpdatedPatients);

View File

@ -46,7 +46,7 @@ public class WebsocketWithCriteriaDstu3Test extends BaseResourceProviderDstu3Tes
*/
Patient patient = FhirDstu3Util.getPatient();
MethodOutcome methodOutcome = ourClient.create().resource(patient).execute();
MethodOutcome methodOutcome = myClient.create().resource(patient).execute();
myPatientId = methodOutcome.getId().getIdPart();
/*
@ -63,7 +63,7 @@ public class WebsocketWithCriteriaDstu3Test extends BaseResourceProviderDstu3Tes
channel.setPayload("application/json");
subscription.setChannel(channel);
methodOutcome = ourClient.create().resource(subscription).execute();
methodOutcome = myClient.create().resource(subscription).execute();
mySubscriptionId = methodOutcome.getId().getIdPart();
/*
@ -86,7 +86,7 @@ public class WebsocketWithCriteriaDstu3Test extends BaseResourceProviderDstu3Tes
observation.setSubject(reference);
observation.setStatus(Observation.ObservationStatus.FINAL);
MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);
@ -110,7 +110,7 @@ public class WebsocketWithCriteriaDstu3Test extends BaseResourceProviderDstu3Tes
observation.setSubject(reference);
observation.setStatus(Observation.ObservationStatus.FINAL);
MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);

View File

@ -68,7 +68,7 @@ public class WebsocketWithSubscriptionIdDstu3Test extends BaseResourceProviderDs
*/
Patient patient = FhirDstu3Util.getPatient();
MethodOutcome methodOutcome = ourClient.create().resource(patient).execute();
MethodOutcome methodOutcome = myClient.create().resource(patient).execute();
myPatientId = methodOutcome.getId().getIdPart();
/*
@ -85,7 +85,7 @@ public class WebsocketWithSubscriptionIdDstu3Test extends BaseResourceProviderDs
channel.setPayload("application/json");
subscription.setChannel(channel);
methodOutcome = ourClient.create().resource(subscription).execute();
methodOutcome = myClient.create().resource(subscription).execute();
mySubscriptionId = methodOutcome.getId().getIdPart();
myWebsocketClientExtension.bind(mySubscriptionId);
@ -104,7 +104,7 @@ public class WebsocketWithSubscriptionIdDstu3Test extends BaseResourceProviderDs
observation.setSubject(reference);
observation.setStatus(Observation.ObservationStatus.FINAL);
MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);
@ -128,7 +128,7 @@ public class WebsocketWithSubscriptionIdDstu3Test extends BaseResourceProviderDs
observation.setSubject(reference);
observation.setStatus(Observation.ObservationStatus.FINAL);
MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);

View File

@ -43,7 +43,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@ -293,7 +292,7 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
String replace = patientBinaryId.replace("_history/1", "");
{ // Test with the Accept Header omitted should stream out the results.
HttpGet expandGet = new HttpGet(ourServerBase + "/" + replace);
HttpGet expandGet = new HttpGet(myServerBase + "/" + replace);
try (CloseableHttpResponse status = ourHttpClient.execute(expandGet)) {
Header[] headers = status.getHeaders("Content-Type");
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
@ -303,7 +302,7 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
}
{ //Test with the Accept Header set to application/fhir+ndjson should stream out the results.
HttpGet expandGet = new HttpGet(ourServerBase + "/" + replace);
HttpGet expandGet = new HttpGet(myServerBase + "/" + replace);
expandGet.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_NDJSON);
try (CloseableHttpResponse status = ourHttpClient.execute(expandGet)) {
Header[] headers = status.getHeaders("Content-Type");
@ -314,7 +313,7 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
}
{ //Test that demanding octet-stream will force it to whatever the Binary's content-type is set to.
HttpGet expandGet = new HttpGet(ourServerBase + "/" + replace);
HttpGet expandGet = new HttpGet(myServerBase + "/" + replace);
expandGet.addHeader(Constants.HEADER_ACCEPT, Constants.CT_OCTET_STREAM);
try (CloseableHttpResponse status = ourHttpClient.execute(expandGet)) {
Header[] headers = status.getHeaders("Content-Type");
@ -325,7 +324,7 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test {
}
{ //Test with the Accept Header set to application/fhir+json should simply return the Binary resource.
HttpGet expandGet = new HttpGet(ourServerBase + "/" + replace);
HttpGet expandGet = new HttpGet(myServerBase + "/" + replace);
expandGet.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON);
try (CloseableHttpResponse status = ourHttpClient.execute(expandGet)) {

View File

@ -2172,6 +2172,40 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
}
@Test
public void testNumber_IndexRange() {
// setup
RiskAssessment riskAssessment = new RiskAssessment();
Range range = new Range()
.setLow(new Quantity(5))
.setHigh(new Quantity(7));
riskAssessment.addPrediction().setProbability(range);
String id = myRiskAssessmentDao.create(riskAssessment, mySrd).getId().toUnqualifiedVersionless().getValue();
riskAssessment = new RiskAssessment();
range = new Range()
.setLow(new Quantity(50))
.setHigh(new Quantity(70));
riskAssessment.addPrediction().setProbability(range);
myRiskAssessmentDao.create(riskAssessment, mySrd);
logAllNumberIndexes();
// execute
myCaptureQueriesListener.clear();
SearchParameterMap map;
List<String> values;
map = SearchParameterMap.newSynchronous(RiskAssessment.SP_PROBABILITY, new NumberParam(5));
values = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map, mySrd));
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
// verify
assertThat(values, contains(id));
}
@Test
public void testDateRangeOnPeriod_SearchByDateTime_NoUpperBound() {
Encounter enc = new Encounter();

View File

@ -77,7 +77,7 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
@AfterEach
public void after() throws Exception {
super.after();
ourRestServer.getInterceptorService().unregisterInterceptor(myDeleteInterceptor);
myServer.unregisterInterceptor(myDeleteInterceptor);
}
public void createResources() {
@ -123,8 +123,8 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
// This is done in order to pass the mockDaoRegistry, otherwise this assertion will fail: verify(mockResourceDao).read(any(IIdType.class), theRequestDetailsCaptor.capture());
final ThreadSafeResourceDeleterSvc threadSafeResourceDeleterSvc = new ThreadSafeResourceDeleterSvc(mockDaoRegistry, myInterceptorBroadcaster, myPlatformTransactionManager);
CascadingDeleteInterceptor aDeleteInterceptor = new CascadingDeleteInterceptor(myFhirContext, mockDaoRegistry, myInterceptorBroadcaster, threadSafeResourceDeleterSvc);
ourRestServer.getInterceptorService().unregisterInterceptor(myDeleteInterceptor);
ourRestServer.getInterceptorService().registerInterceptor(aDeleteInterceptor);
myServer.unregisterInterceptor(myDeleteInterceptor);
myServer.registerInterceptor(aDeleteInterceptor);
when(mockDaoRegistry.getResourceDao(any(String.class))).thenReturn(mockResourceDao);
when(mockResourceDao.read(any(IIdType.class), any(RequestDetails.class))).thenReturn(mockResource);
ArgumentCaptor<RequestDetails> theRequestDetailsCaptor = ArgumentCaptor.forClass(RequestDetails.class);
@ -136,7 +136,7 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
e.setSubject(new Reference(myPatientId));
myEncounterId = myClient.create().resource(e).execute().getId().toUnqualifiedVersionless();
HttpDelete delete = new HttpDelete(ourServerBase + "/" + myPatientId.getValue() + "?" + Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE + "&_pretty=true");
HttpDelete delete = new HttpDelete(myServerBase + "/" + myPatientId.getValue() + "?" + Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE + "&_pretty=true");
delete.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON_NEW);
try (CloseableHttpResponse response = ourHttpClient.execute(delete)) {
String deleteResponse = IOUtils.toString(response.getEntity().getContent(), Charsets.UTF_8);
@ -183,7 +183,7 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
public void testDeleteWithInterceptorAndConstraints() {
createResources();
ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor);
myServer.registerInterceptor(myDeleteInterceptor);
try {
myClient.delete().resourceById(myPatientId).execute();
@ -203,9 +203,9 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
createResources();
ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor);
myServer.registerInterceptor(myDeleteInterceptor);
HttpDelete delete = new HttpDelete(ourServerBase + "/" + myPatientId.getValue() + "?" + Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE + "&_pretty=true");
HttpDelete delete = new HttpDelete(myServerBase + "/" + myPatientId.getValue() + "?" + Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE + "&_pretty=true");
delete.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON_NEW);
try (CloseableHttpResponse response = ourHttpClient.execute(delete)) {
assertEquals(200, response.getStatusLine().getStatusCode());
@ -229,14 +229,14 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
return; // See class javadoc for explanation
}
ourRestServer.getInterceptorService().registerInterceptor(myOverridePathBasedReferentialIntegrityForDeletesInterceptor);
myServer.registerInterceptor(myOverridePathBasedReferentialIntegrityForDeletesInterceptor);
try {
createResources();
ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor);
myServer.registerInterceptor(myDeleteInterceptor);
HttpDelete delete = new HttpDelete(ourServerBase + "/" + myPatientId.getValue() + "?" + Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE + "&_pretty=true");
HttpDelete delete = new HttpDelete(myServerBase + "/" + myPatientId.getValue() + "?" + Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE + "&_pretty=true");
delete.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON_NEW);
try (CloseableHttpResponse response = ourHttpClient.execute(delete)) {
String deleteResponse = IOUtils.toString(response.getEntity().getContent(), Charsets.UTF_8);
@ -254,7 +254,7 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
}
} finally {
ourRestServer.getInterceptorService().unregisterInterceptor(myOverridePathBasedReferentialIntegrityForDeletesInterceptor);
myServer.unregisterInterceptor(myOverridePathBasedReferentialIntegrityForDeletesInterceptor);
}
}
@ -273,9 +273,9 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
o0.getPartOf().setReference(o1id.getValue());
myOrganizationDao.update(o0);
ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor);
myServer.registerInterceptor(myDeleteInterceptor);
HttpDelete delete = new HttpDelete(ourServerBase + "/Organization/" + o0id.getIdPart() + "?" + Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE + "&_pretty=true");
HttpDelete delete = new HttpDelete(myServerBase + "/Organization/" + o0id.getIdPart() + "?" + Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE + "&_pretty=true");
delete.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON_NEW);
try (CloseableHttpResponse response = ourHttpClient.execute(delete)) {
String deleteResponse = IOUtils.toString(response.getEntity().getContent(), Charsets.UTF_8);
@ -308,9 +308,9 @@ public class CascadingDeleteInterceptorTest extends BaseResourceProviderR4Test {
createResources();
ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor);
myServer.registerInterceptor(myDeleteInterceptor);
HttpDelete delete = new HttpDelete(ourServerBase + "/" + myPatientId.getValue() + "?_pretty=true");
HttpDelete delete = new HttpDelete(myServerBase + "/" + myPatientId.getValue() + "?_pretty=true");
delete.addHeader(Constants.HEADER_CASCADE, Constants.CASCADE_DELETE);
delete.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON_NEW);
try (CloseableHttpResponse response = ourHttpClient.execute(delete)) {

View File

@ -28,7 +28,7 @@ public class ForceOffsetSearchModeInterceptorTest extends BaseResourceProviderR4
mySvc = new ForceOffsetSearchModeInterceptor();
myInterceptorRegistry.registerInterceptor(mySvc);
myInitialDefaultPageSize = ourRestServer.getDefaultPageSize();
myInitialDefaultPageSize = myServer.getDefaultPageSize();
}
@Override
@ -37,12 +37,12 @@ public class ForceOffsetSearchModeInterceptorTest extends BaseResourceProviderR4
super.after();
myInterceptorRegistry.unregisterInterceptor(mySvc);
ourRestServer.setDefaultPageSize(myInitialDefaultPageSize);
myServer.setDefaultPageSize(myInitialDefaultPageSize);
}
@Test
public void testSearch_NoExplicitCount() {
ourRestServer.setDefaultPageSize(5);
myServer.setDefaultPageSize(5);
for (int i = 0; i < 10; i++) {
createPatient(withId("A" + i), withActiveTrue());
@ -125,7 +125,7 @@ public class ForceOffsetSearchModeInterceptorTest extends BaseResourceProviderR4
@Test
public void testSearch_WithExplicitCount() {
ourRestServer.setDefaultPageSize(5);
myServer.setDefaultPageSize(5);
for (int i = 0; i < 10; i++) {
createPatient(withId("A" + i), withActiveTrue());
@ -159,7 +159,7 @@ public class ForceOffsetSearchModeInterceptorTest extends BaseResourceProviderR4
@Test
public void testSearch_LoadSynchronousUpToOverridesConfig() {
ourRestServer.setDefaultPageSize(5);
myServer.setDefaultPageSize(5);
mySvc.setDefaultCount(5);
for (int i = 0; i < 10; i++) {
@ -182,7 +182,7 @@ public class ForceOffsetSearchModeInterceptorTest extends BaseResourceProviderR4
@Test
public void testSearch_NoLoadSynchronous() {
ourRestServer.setDefaultPageSize(5);
myServer.setDefaultPageSize(5);
mySvc.setDefaultCount(5);
for (int i = 0; i < 10; i++) {

View File

@ -48,13 +48,13 @@ public class ResponseTerminologyTranslationInterceptorTest extends BaseResourceP
@BeforeEach
public void beforeEach() {
myConceptMapDao.create(createConceptMap());
ourRestServer.registerInterceptor(myResponseTerminologyTranslationInterceptor);
myServer.registerInterceptor(myResponseTerminologyTranslationInterceptor);
}
@AfterEach
public void afterEach() {
myResponseTerminologyTranslationInterceptor.clearMappingSpecifications();
ourRestServer.unregisterInterceptor(myResponseTerminologyTranslationInterceptor);
myServer.unregisterInterceptor(myResponseTerminologyTranslationInterceptor);
}
@Test

View File

@ -26,7 +26,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
super.before();
mySvc = new SearchPreferHandlingInterceptor(mySearchParamRegistry);
ourRestServer.registerInterceptor(mySvc);
myServer.registerInterceptor(mySvc);
}
@Override
@ -34,7 +34,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
public void after() throws Exception {
super.after();
ourRestServer.unregisterInterceptor(mySvc);
myServer.unregisterInterceptor(mySvc);
}
@ -108,7 +108,7 @@ public class SearchPreferHandlingInterceptorJpaTest extends BaseResourceProvider
.execute();
assertEquals(0, outcome.getTotal());
assertEquals(ourServerBase + "/Patient?_format=json&_pretty=true&identifier=BLAH", outcome.getLink(Constants.LINK_SELF).getUrl());
assertEquals(myServerBase + "/Patient?_format=json&_pretty=true&identifier=BLAH", outcome.getLink(Constants.LINK_SELF).getUrl());
}
@Test

View File

@ -85,7 +85,7 @@ public class ValidationMessageSuppressingInterceptorTest extends BaseResourcePro
RequestValidatingInterceptor requestInterceptor = new RequestValidatingInterceptor();
requestInterceptor.setFailOnSeverity(ResultSeverityEnum.ERROR);
requestInterceptor.setValidator(validator);
ourRestServer.registerInterceptor(requestInterceptor);
myServer.registerInterceptor(requestInterceptor);
// Without suppression

View File

@ -87,7 +87,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
myDaoConfig.setAllowMultipleDelete(true);
myDaoConfig.setExpungeEnabled(true);
myDaoConfig.setDeleteExpungeEnabled(true);
ourRestServer.registerInterceptor(new BulkDataExportProvider());
myServer.getRestfulServer().registerInterceptor(new BulkDataExportProvider());
}
@Override
@ -118,15 +118,15 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
.build();
}
};
ourRestServer.getInterceptorService().registerInterceptor(authInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(authInterceptor);
Observation obs = new Observation();
obs.setStatus(ObservationStatus.FINAL);
obs.setSubject(new Reference(pid1));
IIdType oid = myClient.create().resource(obs).execute().getId().toUnqualified();
ourRestServer.getInterceptorService().unregisterInterceptor(authInterceptor);
ourRestServer.getInterceptorService().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().getInterceptorService().unregisterInterceptor(authInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -162,7 +162,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
patient.addName().setFamily("Tester").addGiven("Raghad");
final MethodOutcome output1 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
ourRestServer.getInterceptorService().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().getInterceptorService().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -205,7 +205,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
@Test
public void testCreateConditionalViaTransaction() {
ourRestServer.getInterceptorService().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().getInterceptorService().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -304,7 +304,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
patient.addName().setFamily("Tester").addGiven("Raghad");
IIdType id = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
String authHeader = theRequestDetails.getHeader("Authorization");
@ -365,7 +365,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
obs2.setStatus(ObservationStatus.FINAL);
IIdType observationId2 = myClient.create().resource(obs2).execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -409,7 +409,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
createObservation(withId("allowed"), withObservationCode(TermTestUtil.URL_MY_CODE_SYSTEM, "A"));
createObservation(withId("disallowed"), withObservationCode(TermTestUtil.URL_MY_CODE_SYSTEM, "foo"));
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -431,7 +431,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
mySystemDao.transaction(mySrd, loadResourceFromClasspath(Bundle.class, "r4/adi-ptbundle.json"));
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -468,7 +468,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
obs.setStatus(ObservationStatus.FINAL);
myClient.update().resource(obs).execute();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -516,7 +516,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
obsNotInCompartment.setStatus(ObservationStatus.FINAL);
IIdType obsNotInCompartmentId = myClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -554,7 +554,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
obsNotInCompartment.setStatus(ObservationStatus.FINAL);
IIdType obsNotInCompartmentId = myClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -589,7 +589,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
@Test
public void testDeleteIsBlocked() {
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -618,7 +618,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
@Test
public void testDeleteCascadeBlocked() {
CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(myFhirContext, myDaoRegistry, myInterceptorRegistry, myThreadSafeResourceDeleterSvc);
ourRestServer.getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
try {
// Create Patient, and Observation that refers to it
@ -633,7 +633,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
myClient.create().resource(obs).execute();
// Allow any deletes, but don't allow cascade
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -654,7 +654,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
}
} finally {
ourRestServer.getInterceptorService().unregisterInterceptor(cascadingDeleteInterceptor);
myServer.getRestfulServer().getInterceptorService().unregisterInterceptor(cascadingDeleteInterceptor);
}
}
@ -662,7 +662,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
@Test
public void testDeleteCascadeAllowed() {
CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(myFhirContext, myDaoRegistry, myInterceptorRegistry, myThreadSafeResourceDeleterSvc);
ourRestServer.getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
try {
// Create Patient, and Observation that refers to it
@ -677,7 +677,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
myClient.create().resource(obs).execute();
// Allow any deletes and allow cascade
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -694,14 +694,14 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
.execute();
} finally {
ourRestServer.getInterceptorService().unregisterInterceptor(cascadingDeleteInterceptor);
myServer.getRestfulServer().getInterceptorService().unregisterInterceptor(cascadingDeleteInterceptor);
}
}
@Test
public void testDeleteCascadeAllowed_ButNotOnTargetType() {
CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(myFhirContext, myDaoRegistry, myInterceptorRegistry, myThreadSafeResourceDeleterSvc);
ourRestServer.getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
try {
// Create Patient, and Observation that refers to it
@ -716,7 +716,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
myClient.create().resource(obs).execute();
// Allow any deletes, but don't allow cascade
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -739,7 +739,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
}
} finally {
ourRestServer.getInterceptorService().unregisterInterceptor(cascadingDeleteInterceptor);
myServer.getRestfulServer().getInterceptorService().unregisterInterceptor(cascadingDeleteInterceptor);
}
}
@ -751,14 +751,14 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
pt.addName().setFamily(methodName);
String resource = myFhirContext.newXmlParser().encodeResourceToString(pt);
HttpPost post = new HttpPost(ourServerBase + "/Patient");
HttpPost post = new HttpPost(myServerBase + "/Patient");
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
CloseableHttpResponse response = ourHttpClient.execute(post);
final IdType id;
try {
assertEquals(201, response.getStatusLine().getStatusCode());
String newIdString = response.getFirstHeader(Constants.HEADER_LOCATION_LC).getValue();
assertThat(newIdString, startsWith(ourServerBase + "/Patient/"));
assertThat(newIdString, startsWith(myServerBase + "/Patient/"));
id = new IdType(newIdString);
} finally {
response.close();
@ -768,20 +768,20 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
pt.addName().setFamily("FOOFOOFOO");
resource = myFhirContext.newXmlParser().encodeResourceToString(pt);
post = new HttpPost(ourServerBase + "/Patient");
post = new HttpPost(myServerBase + "/Patient");
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
response = ourHttpClient.execute(post);
final IdType id2;
try {
assertEquals(201, response.getStatusLine().getStatusCode());
String newIdString = response.getFirstHeader(Constants.HEADER_LOCATION_LC).getValue();
assertThat(newIdString, startsWith(ourServerBase + "/Patient/"));
assertThat(newIdString, startsWith(myServerBase + "/Patient/"));
id2 = new IdType(newIdString);
} finally {
response.close();
}
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
//@formatter:off
@ -792,7 +792,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
}
});
HttpDelete delete = new HttpDelete(ourServerBase + "/Patient?name=" + methodName);
HttpDelete delete = new HttpDelete(myServerBase + "/Patient?name=" + methodName);
response = ourHttpClient.execute(delete);
try {
assertEquals(200, response.getStatusLine().getStatusCode());
@ -800,7 +800,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
response.close();
}
delete = new HttpDelete(ourServerBase + "/Patient?name=FOOFOOFOO");
delete = new HttpDelete(myServerBase + "/Patient?name=FOOFOOFOO");
response = ourHttpClient.execute(delete);
try {
assertEquals(403, response.getStatusLine().getStatusCode());
@ -817,7 +817,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
createPatient(withId("A"), withActiveFalse());
createObservation(withId("B"), withStatus("final"));
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -853,7 +853,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
createObservation(withId("C"), withStatus("final"));
createObservation(withId("D"), withStatus("amended"));
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -897,7 +897,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
createPatient(withId("A"), withFamily("MY_FAMILY"));
createPatient(withId("B"), withFamily("MY_FAMILY"));
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -911,14 +911,14 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
HttpGet httpGet;
String query = "{name{family,given}}";
httpGet = new HttpGet(ourServerBase + "/Patient/A/$graphql?query=" + UrlUtil.escapeUrlParam(query));
httpGet = new HttpGet(myServerBase + "/Patient/A/$graphql?query=" + UrlUtil.escapeUrlParam(query));
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
assertEquals(200, response.getStatusLine().getStatusCode());
assertThat(resp, containsString("MY_FAMILY"));
}
httpGet = new HttpGet(ourServerBase + "/Patient/B/$graphql?query=" + UrlUtil.escapeUrlParam(query));
httpGet = new HttpGet(myServerBase + "/Patient/B/$graphql?query=" + UrlUtil.escapeUrlParam(query));
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
assertEquals(403, response.getStatusLine().getStatusCode());
@ -932,7 +932,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
*/
@Test
public void testInstanceRuleOkForResourceWithNoId() {
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -972,7 +972,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
@Test
public void testTransactionResponses() {
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -1036,7 +1036,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
@Test
public void testInstanceRuleOkForResourceWithNoId2() {
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -1132,7 +1132,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
obs1.setSubject(new Reference(pid1));
myClient.create().resource(obs1).execute();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -1195,7 +1195,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
obs2.setSubject(new Reference(pid2));
IIdType oid2 = myClient.create().resource(obs2).execute().getId().toUnqualified();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -1241,7 +1241,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
patient.setActive(true);
final IIdType patientId = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
// allow write all Observation resource
@ -1294,7 +1294,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
patient2.setActive(true);
IIdType p2id = myPatientDao.create(patient2).getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -1357,7 +1357,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
eob3.setPatient(new Reference(p3id));
myExplanationOfBenefitDao.create(eob3);
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -1413,7 +1413,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
// Allow any deletes, but don't allow expunge
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -1443,7 +1443,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
// Allow deletes and allow expunge
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myServer.getRestfulServer().registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -1474,7 +1474,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
}
};
interceptor.setAuthorizationSearchParamMatcher(new AuthorizationSearchParamMatcher(mySearchParamMatcher));
ourRestServer.registerInterceptor(interceptor);
myServer.getRestfulServer().registerInterceptor(interceptor);
// search runs without 403.
Bundle bundle = myClient.search().byUrl("/Observation?code=foo").returnBundle(Bundle.class).execute();
@ -1495,7 +1495,7 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes
}
};
interceptor.setAuthorizationSearchParamMatcher(new AuthorizationSearchParamMatcher(mySearchParamMatcher));
ourRestServer.registerInterceptor(interceptor);
myServer.getRestfulServer().registerInterceptor(interceptor);
// search should fail since the allow rule can't be evaluated with an unknown SP
try {

View File

@ -53,8 +53,8 @@ public abstract class BaseMultitenantResourceProviderR4Test extends BaseResource
myInterceptorRegistry.registerInterceptor(myRequestTenantPartitionInterceptor);
myPartitionSettings.setPartitioningEnabled(true);
ourRestServer.registerProvider(myPartitionManagementProvider);
ourRestServer.setTenantIdentificationStrategy(new UrlBaseTenantIdentificationStrategy());
myServer.getRestfulServer().registerProvider(myPartitionManagementProvider);
myServer.getRestfulServer().setTenantIdentificationStrategy(new UrlBaseTenantIdentificationStrategy());
myCapturingInterceptor = new CapturingInterceptor();
myClient.getInterceptorService().registerInterceptor(myCapturingInterceptor);
@ -75,10 +75,10 @@ public abstract class BaseMultitenantResourceProviderR4Test extends BaseResource
myPartitionSettings.setPartitioningEnabled(new PartitionSettings().isPartitioningEnabled());
myInterceptorRegistry.unregisterInterceptor(myRequestTenantPartitionInterceptor);
if (myAuthorizationInterceptor != null) {
ourRestServer.unregisterInterceptor(myAuthorizationInterceptor);
myServer.getRestfulServer().unregisterInterceptor(myAuthorizationInterceptor);
}
ourRestServer.unregisterProvider(myPartitionManagementProvider);
ourRestServer.setTenantIdentificationStrategy(null);
myServer.getRestfulServer().unregisterProvider(myPartitionManagementProvider);
myServer.getRestfulServer().setTenantIdentificationStrategy(null);
myClient.getInterceptorService().unregisterAllInterceptors();
}
@ -111,7 +111,7 @@ public abstract class BaseMultitenantResourceProviderR4Test extends BaseResource
public void setupAuthorizationInterceptorWithRules(Supplier<List<IAuthRule>> theRuleSupplier) {
if(myAuthorizationInterceptor != null) {
ourRestServer.unregisterInterceptor(myAuthorizationInterceptor);
myServer.getRestfulServer().unregisterInterceptor(myAuthorizationInterceptor);
}
myAuthorizationInterceptor = new AuthorizationInterceptor() {
@Override
@ -119,7 +119,7 @@ public abstract class BaseMultitenantResourceProviderR4Test extends BaseResource
return theRuleSupplier.get();
}
}.setDefaultPolicy(PolicyEnum.DENY);
ourRestServer.registerInterceptor(myAuthorizationInterceptor);
myServer.getRestfulServer().registerInterceptor(myAuthorizationInterceptor);
}

View File

@ -107,7 +107,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Read it back using the operation
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ +
"?path=DocumentReference.content.attachment";
@ -138,7 +138,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
myInterceptorRegistry.registerAnonymousInterceptor(Pointcut.STORAGE_PRESHOW_RESOURCES, interceptor);
try {
// Read it back using the operation
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ +
"?path=DocumentReference.content[1].attachment";
@ -163,7 +163,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
public void testReadNoPath() throws IOException {
IIdType id = createDocumentReference(true);
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ;
HttpGet get = new HttpGet(path);
@ -181,7 +181,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
public void testReadNoData() throws IOException {
IIdType id = createDocumentReference(false);
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ +
"?path=DocumentReference.content.attachment";
@ -202,10 +202,10 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
IIdType id = createDocumentReference(true);
PointcutLatch latch = new PointcutLatch(Pointcut.SERVER_OUTGOING_RESPONSE);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_OUTGOING_RESPONSE, latch);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_OUTGOING_RESPONSE, latch);
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ +
"?path=DocumentReference.content.attachment";
@ -231,7 +231,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Write a binary using the operation
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_WRITE +
"?path=DocumentReference.content.attachment";
@ -260,7 +260,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
myBinaryStorageSvc.expungeBlob(id, attachmentId);
path = ourServerBase +
path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ +
"?path=DocumentReference.content.attachment";
@ -290,7 +290,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Write the binary using the operation
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_WRITE +
"?path=DocumentReference.content.attachment";
@ -323,7 +323,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Read it back using the operation
path = ourServerBase +
path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ +
"?path=DocumentReference.content.attachment";
@ -374,7 +374,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Read it back using the operation
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_WRITE +
"?path=DocumentReference.content.attachment";
@ -428,7 +428,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
try {
// Write using the operation
String path = ourServerBase +
String path = myServerBase +
"/Binary/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_WRITE +
"?path=Binary";
@ -459,7 +459,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Read it back using the operation
path = ourServerBase +
path = myServerBase +
"/Binary/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ +
"?path=Binary";
@ -494,7 +494,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Write using the operation
String path = ourServerBase +
String path = myServerBase +
"/Binary/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_WRITE;
HttpPost post = new HttpPost(path);
@ -520,7 +520,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Read it back using the operation
path = ourServerBase +
path = myServerBase +
"/Binary/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ;
HttpGet get = new HttpGet(path);
@ -559,7 +559,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
try {
// Write using the operation
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_WRITE +
"?path=DocumentReference.content.attachment";
@ -589,7 +589,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
// Read it back using the operation
path = ourServerBase +
path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_READ +
"?path=DocumentReference.content.attachment";
@ -636,7 +636,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
public void testResourceExpungeAlsoExpungesBinaryData() throws IOException {
IIdType id = createDocumentReference(false);
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_WRITE +
"?path=DocumentReference.content.attachment";
@ -692,12 +692,12 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
@Test
public void testWriteWithConflictInterceptor() throws IOException {
UserRequestRetryVersionConflictsInterceptor interceptor = new UserRequestRetryVersionConflictsInterceptor();
ourRestServer.registerInterceptor(interceptor);
myServer.getRestfulServer().registerInterceptor(interceptor);
try {
IIdType id = createDocumentReference(false);
String path = ourServerBase +
String path = myServerBase +
"/DocumentReference/" + id.getIdPart() + "/" +
JpaConstants.OPERATION_BINARY_ACCESS_WRITE +
"?path=DocumentReference.content.attachment";
@ -718,7 +718,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test {
}
} finally {
ourRestServer.unregisterInterceptor(interceptor);
myServer.getRestfulServer().unregisterInterceptor(interceptor);
}
}

View File

@ -125,7 +125,7 @@ public class CompositionDocumentR4Test extends BaseResourceProviderR4Test {
@Test
public void testDocumentBundleReturnedCorrect() throws IOException {
String theUrl = ourServerBase + "/" + compId + "/$document?_format=json";
String theUrl = myServerBase + "/" + compId + "/$document?_format=json";
Bundle bundle = fetchBundle(theUrl, EncodingEnum.JSON);
//Ensure each entry has a URL.
@ -154,7 +154,7 @@ public class CompositionDocumentR4Test extends BaseResourceProviderR4Test {
public void testInterceptorHookIsCalledForAllContents_STORAGE_PREACCESS_RESOURCES() throws IOException {
IAnonymousInterceptor interceptor = mock(IAnonymousInterceptor.class);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PREACCESS_RESOURCES, interceptor);
try {
ourLog.info("Composition ID: {}", compId);
@ -170,7 +170,7 @@ public class CompositionDocumentR4Test extends BaseResourceProviderR4Test {
return null;
}).when(interceptor).invoke(eq(Pointcut.STORAGE_PREACCESS_RESOURCES), any());
String theUrl = ourServerBase + "/" + compId + "/$document?_format=json";
String theUrl = myServerBase + "/" + compId + "/$document?_format=json";
Bundle bundle = fetchBundle(theUrl, EncodingEnum.JSON);
for (Bundle.BundleEntryComponent next : bundle.getEntry()) {
ourLog.info("Bundle contained: {}", next.getResource().getIdElement().getValue());
@ -185,7 +185,7 @@ public class CompositionDocumentR4Test extends BaseResourceProviderR4Test {
} finally {
ourRestServer.getInterceptorService().unregisterInterceptor(interceptor);
myServer.getRestfulServer().getInterceptorService().unregisterInterceptor(interceptor);
}
}

View File

@ -6,7 +6,6 @@ import ca.uhn.fhir.jpa.config.JpaConfig;
import ca.uhn.fhir.jpa.entity.Search;
import ca.uhn.fhir.jpa.model.search.SearchStatusEnum;
import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test;
import ca.uhn.fhir.jpa.test.config.TestR4Config;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.PreferReturnEnum;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
@ -51,13 +50,10 @@ import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.io.IOException;
import java.util.ArrayList;
@ -101,8 +97,8 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
super.after();
Validate.notNull(myConsentInterceptor);
myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds());
ourRestServer.getInterceptorService().unregisterInterceptor(myConsentInterceptor);
ourRestServer.unregisterProvider(myGraphQlProvider);
myServer.getRestfulServer().getInterceptorService().unregisterInterceptor(myConsentInterceptor);
myServer.getRestfulServer().unregisterProvider(myGraphQlProvider);
}
@Override
@ -110,7 +106,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
public void before() throws Exception {
super.before();
myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190));
ourRestServer.registerProvider(myGraphQlProvider);
myServer.getRestfulServer().registerProvider(myGraphQlProvider);
}
@Test
@ -119,7 +115,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
IConsentService consentService = new ConsentSvcCantSeeOddNumbered();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
// Perform a search
Bundle result = myClient
@ -159,7 +155,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
DelegatingConsentService consentService = new DelegatingConsentService();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
// Perform a search and only allow even
consentService.setTarget(new ConsentSvcCantSeeOddNumbered());
@ -251,7 +247,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
ConsentSvcMaskObservationSubjects consentService = new ConsentSvcMaskObservationSubjects();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
// Perform a search
Bundle result = myClient
@ -286,8 +282,8 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
public void testConsentWorksWithVersionedApiConverterInterceptor() {
myConsentInterceptor = new ConsentInterceptor(new IConsentService() {
});
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
ourRestServer.getInterceptorService().registerInterceptor(new VersionedApiConverterInterceptor());
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(new VersionedApiConverterInterceptor());
myClient.create().resource(new Patient().setGender(Enumerations.AdministrativeGender.MALE).addName(new HumanName().setFamily("1"))).execute();
Bundle response = myClient.search().forResource(Patient.class).count(1).accept("application/fhir+json; fhirVersion=3.0").returnBundle(Bundle.class).execute();
@ -303,7 +299,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
IConsentService consentService = new ConsentSvcCantSeeOddNumbered();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
// Perform a search
Bundle result = myClient
@ -326,7 +322,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
IConsentService consentService = new ConsentSvcCantSeeOddNumbered();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
myClient.read().resource("Observation").withId(new IdType(myObservationIdsEvenOnly.get(0))).execute();
myClient.read().resource("Observation").withId(new IdType(myObservationIdsEvenOnly.get(1))).execute();
@ -352,14 +348,14 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
DelegatingConsentService consentService = new DelegatingConsentService();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
Patient patient = new Patient();
patient.setActive(true);
// Reject output
consentService.setTarget(new ConsentSvcRejectCanSeeAnything());
HttpPost post = new HttpPost(ourServerBase + "/Patient");
HttpPost post = new HttpPost(myServerBase + "/Patient");
post.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION);
post.setEntity(toEntity(patient));
try (CloseableHttpResponse status = ourHttpClient.execute(post)) {
@ -373,7 +369,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
// Accept output
consentService.setTarget(new ConsentSvcNop(ConsentOperationStatusEnum.PROCEED));
post = new HttpPost(ourServerBase + "/Patient");
post = new HttpPost(myServerBase + "/Patient");
post.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION);
post.setEntity(toEntity(patient));
try (CloseableHttpResponse status = ourHttpClient.execute(post)) {
@ -398,7 +394,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
DelegatingConsentService consentService = new DelegatingConsentService();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
// Reject output
consentService.setTarget(new ConsentSvcRejectCanSeeAnything());
@ -406,7 +402,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
patient.setId(id);
patient.setActive(true);
patient.addIdentifier().setValue("VAL1");
HttpPut put = new HttpPut(ourServerBase + "/Patient/" + id.getIdPart());
HttpPut put = new HttpPut(myServerBase + "/Patient/" + id.getIdPart());
put.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION);
put.setEntity(toEntity(patient));
try (CloseableHttpResponse status = ourHttpClient.execute(put)) {
@ -424,7 +420,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
patient.setId(id);
patient.setActive(true);
patient.addIdentifier().setValue("VAL2");
put = new HttpPut(ourServerBase + "/Patient/" + id.getIdPart());
put = new HttpPut(myServerBase + "/Patient/" + id.getIdPart());
put.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + '=' + Constants.HEADER_PREFER_RETURN_REPRESENTATION);
put.setEntity(toEntity(patient));
try (CloseableHttpResponse status = ourHttpClient.execute(put)) {
@ -445,10 +441,10 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
ConsentSvcRejectWillSeeEvenNumbered consentService = new ConsentSvcRejectWillSeeEvenNumbered();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
// Search for all
String url = ourServerBase + "/Observation?_pretty=true&_count=10";
String url = myServerBase + "/Observation?_pretty=true&_count=10";
ourLog.info("HTTP GET {}", url);
HttpGet get = new HttpGet(url);
get.addHeader(Constants.HEADER_ACCEPT, Constants.CT_JSON);
@ -471,12 +467,12 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
DelegatingConsentService consentService = new DelegatingConsentService();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
// Proceed everything
consentService.setTarget(new ConsentSvcNop(ConsentOperationStatusEnum.PROCEED));
String query = "{ name { family, given }, managingOrganization { reference, resource {name} } }";
String url = ourServerBase + "/" + myPatientIds.get(0) + "/$graphql?query=" + UrlUtil.escapeUrlParam(query);
String url = myServerBase + "/" + myPatientIds.get(0) + "/$graphql?query=" + UrlUtil.escapeUrlParam(query);
ourLog.info("HTTP GET {}", url);
HttpGet get = new HttpGet(url);
get.addHeader(Constants.HEADER_ACCEPT, Constants.CT_JSON);
@ -497,7 +493,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
DelegatingConsentService consentService = new DelegatingConsentService();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
IConsentService svc = mock(IConsentService.class);
when(svc.startOperation(any(), any())).thenReturn(ConsentOutcome.PROCEED);
@ -505,7 +501,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
consentService.setTarget(svc);
String query = "{ name { family, given }, managingOrganization { reference, resource {name} } }";
String url = ourServerBase + "/" + myPatientIds.get(0) + "/$graphql?query=" + UrlUtil.escapeUrlParam(query);
String url = myServerBase + "/" + myPatientIds.get(0) + "/$graphql?query=" + UrlUtil.escapeUrlParam(query);
ourLog.info("HTTP GET {}", url);
HttpGet get = new HttpGet(url);
get.addHeader(Constants.HEADER_ACCEPT, Constants.CT_JSON);
@ -529,7 +525,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
DelegatingConsentService consentService = new DelegatingConsentService();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
IConsentService svc = mock(IConsentService.class);
when(svc.startOperation(any(), any())).thenReturn(ConsentOutcome.PROCEED);
@ -544,7 +540,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
consentService.setTarget(svc);
String query = "{ name { family, given }, managingOrganization { reference, resource {name} } }";
String url = ourServerBase + "/" + myPatientIds.get(0) + "/$graphql?query=" + UrlUtil.escapeUrlParam(query);
String url = myServerBase + "/" + myPatientIds.get(0) + "/$graphql?query=" + UrlUtil.escapeUrlParam(query);
ourLog.info("HTTP GET {}", url);
HttpGet get = new HttpGet(url);
get.addHeader(Constants.HEADER_ACCEPT, Constants.CT_JSON);
@ -565,7 +561,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
@Test
public void testBundleTotalIsStripped() {
myConsentInterceptor = new ConsentInterceptor(new ConsentSvcCantSeeFemales());
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
myClient.create().resource(new Patient().setGender(Enumerations.AdministrativeGender.MALE).addName(new HumanName().setFamily("1"))).execute();
myClient.create().resource(new Patient().setGender(Enumerations.AdministrativeGender.MALE).addName(new HumanName().setFamily("2"))).execute();
@ -624,7 +620,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
public void testDefaultInterceptorAllowsAll() {
myConsentInterceptor = new ConsentInterceptor(new IConsentService() {
});
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
myClient.create().resource(new Patient().setGender(Enumerations.AdministrativeGender.MALE).addName(new HumanName().setFamily("1"))).execute();
myClient.create().resource(new Patient().setGender(Enumerations.AdministrativeGender.MALE).addName(new HumanName().setFamily("2"))).execute();
@ -665,7 +661,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
public void testDefaultInterceptorAllowsFailure() {
myConsentInterceptor = new ConsentInterceptor(new IConsentService() {
});
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
myClient.create().resource(new Patient().setGender(Enumerations.AdministrativeGender.MALE).addName(new HumanName().setFamily("1"))).execute();
myClient.create().resource(new Patient().setGender(Enumerations.AdministrativeGender.MALE).addName(new HumanName().setFamily("2"))).execute();
@ -685,7 +681,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
DelegatingConsentService consentService = new DelegatingConsentService();
myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL);
ourRestServer.getInterceptorService().registerInterceptor(myConsentInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor);
IConsentService svc = mock(IConsentService.class);
when(svc.startOperation(any(), any())).thenReturn(ConsentOutcome.PROCEED);
@ -702,7 +698,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid
consentService.setTarget(svc);
String query = "{ name { family, given }, managingOrganization { reference, resource {name, identifier { system } } } }";
String url = ourServerBase + "/" + myPatientIds.get(0) + "/$graphql?query=" + UrlUtil.escapeUrlParam(query);
String url = myServerBase + "/" + myPatientIds.get(0) + "/$graphql?query=" + UrlUtil.escapeUrlParam(query);
ourLog.info("HTTP GET {}", url);
HttpGet get = new HttpGet(url);
get.addHeader(Constants.HEADER_ACCEPT, Constants.CT_JSON);

View File

@ -16,7 +16,7 @@ public class CorsR4Test extends BaseResourceProviderR4Test {
@Test
public void saveLocalOrigin() throws IOException {
HttpGet get = new HttpGet(ourServerBase + "/Patient?name=test");
HttpGet get = new HttpGet(myServerBase + "/Patient?name=test");
get.addHeader("Origin", "file://");
CloseableHttpResponse resp = ourHttpClient.execute(get);

View File

@ -88,7 +88,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
myDaoConfig.setTagStorageMode(new DaoConfig().getTagStorageMode());
myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED);
ourRestServer.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof CascadingDeleteInterceptor);
myServer.getRestfulServer().getInterceptorService().unregisterInterceptorsIf(t -> t instanceof CascadingDeleteInterceptor);
}
@BeforeEach
@ -215,7 +215,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
@Test
public void testDeleteCascade() throws IOException {
ourRestServer.registerInterceptor(new CascadingDeleteInterceptor(myFhirContext, myDaoRegistry, myInterceptorRegistry, myThreadSafeResourceDeleterSvc));
myServer.getRestfulServer().registerInterceptor(new CascadingDeleteInterceptor(myFhirContext, myDaoRegistry, myInterceptorRegistry, myThreadSafeResourceDeleterSvc));
// setup
Organization organization = new Organization();
@ -232,7 +232,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test {
IIdType patientId = myPatientDao.create(patient).getId().toUnqualifiedVersionless();
// execute
String url = ourServerBase + "/Organization/" + organizationId.getIdPart() + "?" +
String url = myServerBase + "/Organization/" + organizationId.getIdPart() + "?" +
Constants.PARAMETER_CASCADE_DELETE + "=" + Constants.CASCADE_DELETE
+ "&" +
JpaConstants.PARAM_DELETE_EXPUNGE + "=true"

View File

@ -41,7 +41,7 @@ public class GraphQLR4Test extends BaseResourceProviderR4Test {
initTestPatients();
String query = "{name{family,given}}";
HttpGet httpGet = new HttpGet(ourServerBase + "/Patient/" + myPatientId0.getIdPart() + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
HttpGet httpGet = new HttpGet(myServerBase + "/Patient/" + myPatientId0.getIdPart() + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -66,7 +66,7 @@ public class GraphQLR4Test extends BaseResourceProviderR4Test {
initTestPatients();
String query = "{birthDate}";
HttpGet httpGet = new HttpGet(ourServerBase + "/Patient/" + myPatientId0.getIdPart() + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
HttpGet httpGet = new HttpGet(myServerBase + "/Patient/" + myPatientId0.getIdPart() + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -85,7 +85,7 @@ public class GraphQLR4Test extends BaseResourceProviderR4Test {
public void testType_Introspect_Patient() throws IOException {
initTestPatients();
String uri = ourServerBase + "/Patient/$graphql";
String uri = myServerBase + "/Patient/$graphql";
HttpPost httpGet = new HttpPost(uri);
httpGet.setEntity(new StringEntity(INTROSPECTION_QUERY, ContentType.APPLICATION_JSON));
@ -111,7 +111,7 @@ public class GraphQLR4Test extends BaseResourceProviderR4Test {
public void testType_Introspect_Observation() throws IOException {
initTestPatients();
String uri = ourServerBase + "/Observation/$graphql";
String uri = myServerBase + "/Observation/$graphql";
HttpPost httpGet = new HttpPost(uri);
httpGet.setEntity(new StringEntity(INTROSPECTION_QUERY, ContentType.APPLICATION_JSON));
@ -138,7 +138,7 @@ public class GraphQLR4Test extends BaseResourceProviderR4Test {
public void testRoot_Introspect() throws IOException {
initTestPatients();
String uri = ourServerBase + "/$graphql";
String uri = myServerBase + "/$graphql";
HttpPost httpPost = new HttpPost(uri);
httpPost.setEntity(new StringEntity(INTROSPECTION_QUERY, ContentType.APPLICATION_JSON));
@ -165,7 +165,7 @@ public class GraphQLR4Test extends BaseResourceProviderR4Test {
initTestPatients();
String query = "{Patient(id:\"" + myPatientId0.getIdPart() + "\"){name{family,given}}}";
HttpGet httpGet = new HttpGet(ourServerBase + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
HttpGet httpGet = new HttpGet(myServerBase + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -196,7 +196,7 @@ public class GraphQLR4Test extends BaseResourceProviderR4Test {
initTestPatients();
String query = "{PatientList(given:\"given\"){name{family,given}}}";
HttpGet httpGet = new HttpGet(ourServerBase + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
HttpGet httpGet = new HttpGet(myServerBase + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -227,7 +227,7 @@ public class GraphQLR4Test extends BaseResourceProviderR4Test {
initTestPatients();
String query = "{ObservationList(date: \"2022\") {id}}";
HttpGet httpGet = new HttpGet(ourServerBase + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
HttpGet httpGet = new HttpGet(myServerBase + "/$graphql?query=" + UrlUtil.escapeUrlParam(query));
myCaptureQueriesListener.clear();
try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) {

View File

@ -92,7 +92,7 @@ public class MultitenantServerR4Test extends BaseMultitenantResourceProviderR4Te
CapabilityStatement cs = myClient.capabilities().ofType(CapabilityStatement.class).execute();
assertEquals("HAPI FHIR Server", cs.getSoftware().getName());
assertEquals(ourServerBase + "/TENANT-A/metadata", myCapturingInterceptor.getLastRequest().getUri());
assertEquals(myServerBase + "/TENANT-A/metadata", myCapturingInterceptor.getLastRequest().getUri());
}
@Test
@ -691,7 +691,7 @@ public class MultitenantServerR4Test extends BaseMultitenantResourceProviderR4Te
@BeforeEach
public void setBulkDataExportProvider() {
ourRestServer.registerProvider(myProvider);
myServer.getRestfulServer().registerProvider(myProvider);
}
private String buildExportUrl(String createInPartition, String jobId) {

View File

@ -47,7 +47,7 @@ public class NicknameSearchR4Test extends BaseResourceProviderR4Test {
Bundle result = myClient
.loadPage()
.byUrl(ourServerBase + "/Patient?name:nickname=kenneth")
.byUrl(myServerBase + "/Patient?name:nickname=kenneth")
.andReturnBundle(Bundle.class)
.execute();

View File

@ -21,14 +21,14 @@ public class OpenApiInterceptorJpaTest extends BaseResourceProviderR4Test {
@AfterEach
public void after() throws Exception {
super.after();
ourRestServer.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof OpenApiInterceptor);
myServer.getRestfulServer().getInterceptorService().unregisterInterceptorsIf(t -> t instanceof OpenApiInterceptor);
}
@Test
public void testFetchOpenApi() throws IOException {
ourRestServer.registerInterceptor(new OpenApiInterceptor());
myServer.getRestfulServer().registerInterceptor(new OpenApiInterceptor());
HttpGet get = new HttpGet(ourServerBase + "/metadata?_format=json&_pretty=true");
HttpGet get = new HttpGet(myServerBase + "/metadata?_format=json&_pretty=true");
try (CloseableHttpResponse response = ourHttpClient.execute(get)) {
String string = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(string);
@ -36,7 +36,7 @@ public class OpenApiInterceptorJpaTest extends BaseResourceProviderR4Test {
assertEquals(200, response.getStatusLine().getStatusCode());
}
get = new HttpGet(ourServerBase + "/api-docs");
get = new HttpGet(myServerBase + "/api-docs");
try (CloseableHttpResponse response = ourHttpClient.execute(get)) {
String string = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(string);

View File

@ -100,7 +100,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
.getRequest().setUrl(pid1.getValue())
.setMethod(Bundle.HTTPVerb.PATCH);
HttpPost post = new HttpPost(ourServerBase);
HttpPost post = new HttpPost(myServerBase);
String encodedRequest = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(input);
ourLog.info("Request:\n{}", encodedRequest);
post.setEntity(new StringEntity(encodedRequest, ContentType.parse(Constants.CT_FHIR_JSON_NEW+ Constants.CHARSET_UTF8_CTSUFFIX)));
@ -216,7 +216,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
" } " +
"]";
HttpPatch patch = new HttpPatch(ourServerBase + "/Observation/" + id.getIdPart());
HttpPatch patch = new HttpPatch(myServerBase + "/Observation/" + id.getIdPart());
patch.setEntity(new StringEntity(patchText, ContentType.parse(Constants.CT_JSON_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
patch.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + "=" + Constants.HEADER_PREFER_RETURN_REPRESENTATION);
patch.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON);
@ -242,7 +242,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
}
HttpPatch patch = new HttpPatch(ourServerBase + "/Patient/" + pid1.getIdPart());
HttpPatch patch = new HttpPatch(myServerBase + "/Patient/" + pid1.getIdPart());
patch.setEntity(new StringEntity("[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]", ContentType.parse(Constants.CT_JSON_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
patch.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + "=" + Constants.HEADER_PREFER_RETURN_OPERATION_OUTCOME);
@ -284,7 +284,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
.getRequest().setUrl(pid1.getValue())
.setMethod(Bundle.HTTPVerb.PATCH);
HttpPost post = new HttpPost(ourServerBase);
HttpPost post = new HttpPost(myServerBase);
String encodedRequest = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(input);
ourLog.info("Request:\n{}", encodedRequest);
post.setEntity(new StringEntity(encodedRequest, ContentType.parse(Constants.CT_FHIR_JSON_NEW+ Constants.CHARSET_UTF8_CTSUFFIX)));
@ -312,7 +312,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
}
HttpPatch patch = new HttpPatch(ourServerBase + "/Patient?_id=" + pid1.getIdPart());
HttpPatch patch = new HttpPatch(myServerBase + "/Patient?_id=" + pid1.getIdPart());
patch.setEntity(new StringEntity("[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]", ContentType.parse(Constants.CT_JSON_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
patch.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + "=" + Constants.HEADER_PREFER_RETURN_OPERATION_OUTCOME);
@ -340,7 +340,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
}
HttpPatch patch = new HttpPatch(ourServerBase + "/Patient?_id=" + pid1.getIdPart()+"FOO");
HttpPatch patch = new HttpPatch(myServerBase + "/Patient?_id=" + pid1.getIdPart()+"FOO");
patch.setEntity(new StringEntity("[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]", ContentType.parse(Constants.CT_JSON_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
patch.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + "=" + Constants.HEADER_PREFER_RETURN_OPERATION_OUTCOME);
@ -373,7 +373,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
}
HttpPatch patch = new HttpPatch(ourServerBase + "/Patient?active=true");
HttpPatch patch = new HttpPatch(myServerBase + "/Patient?active=true");
patch.setEntity(new StringEntity("[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]", ContentType.parse(Constants.CT_JSON_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
patch.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + "=" + Constants.HEADER_PREFER_RETURN_OPERATION_OUTCOME);
@ -410,7 +410,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
" } ]";
HttpPatch patch = new HttpPatch(ourServerBase + "/Observation/" + id.getIdPart());
HttpPatch patch = new HttpPatch(myServerBase + "/Observation/" + id.getIdPart());
patch.setEntity(new StringEntity(patchText, ContentType.parse(Constants.CT_JSON_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
patch.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + "=" + Constants.HEADER_PREFER_RETURN_OPERATION_OUTCOME);
@ -435,7 +435,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
}
HttpPatch patch = new HttpPatch(ourServerBase + "/Patient/" + pid1.getIdPart());
HttpPatch patch = new HttpPatch(myServerBase + "/Patient/" + pid1.getIdPart());
patch.setEntity(new StringEntity("[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]", ContentType.parse(Constants.CT_JSON_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
patch.addHeader("If-Match", "W/\"9\"");
@ -463,7 +463,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
}
HttpPatch patch = new HttpPatch(ourServerBase + "/Patient/" + pid1.getIdPart());
HttpPatch patch = new HttpPatch(myServerBase + "/Patient/" + pid1.getIdPart());
patch.setEntity(new StringEntity("[ { \"op\":\"replace\", \"path\":\"/active\", \"value\":false } ]", ContentType.parse(Constants.CT_JSON_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
patch.addHeader("If-Match", "W/\"1\"");
patch.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + "=" + Constants.HEADER_PREFER_RETURN_OPERATION_OUTCOME);
@ -492,7 +492,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
}
HttpPatch patch = new HttpPatch(ourServerBase + "/Patient/" + pid1.getIdPart());
HttpPatch patch = new HttpPatch(myServerBase + "/Patient/" + pid1.getIdPart());
String patchString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><diff xmlns:fhir=\"http://hl7.org/fhir\"><replace sel=\"fhir:Patient/fhir:active/@value\">false</replace></diff>";
patch.addHeader(Constants.HEADER_PREFER, Constants.HEADER_PREFER_RETURN + "=" + Constants.HEADER_PREFER_RETURN_OPERATION_OUTCOME);
patch.setEntity(new StringEntity(patchString, ContentType.parse(Constants.CT_XML_PATCH + Constants.CHARSET_UTF8_CTSUFFIX)));
@ -535,7 +535,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
.getRequest().setUrl(pid1.getValue())
.setMethod(Bundle.HTTPVerb.PATCH);
HttpPost post = new HttpPost(ourServerBase);
HttpPost post = new HttpPost(myServerBase);
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(input);
ourLog.info("Encoded output: {}", encoded);
@ -577,7 +577,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
.getRequest().setUrl(pid1.getValue())
.setMethod(Bundle.HTTPVerb.PATCH);
HttpPost post = new HttpPost(ourServerBase);
HttpPost post = new HttpPost(myServerBase);
post.setEntity(new StringEntity(myFhirContext.newJsonParser().encodeResourceToString(input), ContentType.parse(Constants.CT_FHIR_JSON_NEW+ Constants.CHARSET_UTF8_CTSUFFIX)));
try (CloseableHttpResponse response = ourHttpClient.execute(post)) {
assertEquals(400, response.getStatusLine().getStatusCode());
@ -615,7 +615,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
.getRequest().setUrl(pid1.getValue())
.setMethod(Bundle.HTTPVerb.PATCH);
HttpPost post = new HttpPost(ourServerBase);
HttpPost post = new HttpPost(myServerBase);
post.setEntity(new StringEntity(myFhirContext.newJsonParser().encodeResourceToString(input), ContentType.parse(Constants.CT_FHIR_JSON_NEW+ Constants.CHARSET_UTF8_CTSUFFIX)));
try (CloseableHttpResponse response = ourHttpClient.execute(post)) {
assertEquals(400, response.getStatusLine().getStatusCode());
@ -654,7 +654,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
.getRequest().setUrl(pid1.getValue())
.setMethod(Bundle.HTTPVerb.PATCH);
HttpPost post = new HttpPost(ourServerBase);
HttpPost post = new HttpPost(myServerBase);
post.setEntity(new StringEntity(myFhirContext.newJsonParser().encodeResourceToString(input), ContentType.parse(Constants.CT_FHIR_JSON_NEW+ Constants.CHARSET_UTF8_CTSUFFIX)));
try (CloseableHttpResponse response = ourHttpClient.execute(post)) {
assertEquals(400, response.getStatusLine().getStatusCode());
@ -692,7 +692,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
.getRequest().setUrl(pid1.getValue())
.setMethod(Bundle.HTTPVerb.PATCH);
HttpPost post = new HttpPost(ourServerBase);
HttpPost post = new HttpPost(myServerBase);
post.setEntity(new StringEntity(myFhirContext.newJsonParser().encodeResourceToString(input), ContentType.parse(Constants.CT_FHIR_JSON_NEW+ Constants.CHARSET_UTF8_CTSUFFIX)));
try (CloseableHttpResponse response = ourHttpClient.execute(post)) {
assertEquals(400, response.getStatusLine().getStatusCode());

View File

@ -140,7 +140,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test {
String observationId = myObservationDao.create(obs).getId().toUnqualifiedVersionless().getValue();
// Normal call
Bundle bundle = fetchBundle(ourServerBase + "/" + patientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + patientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
assertNull(bundle.getLink("next"));
Set<String> actual = new TreeSet<>();
for (BundleEntryComponent nextEntry : bundle.getEntry()) {
@ -149,7 +149,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test {
assertThat(actual, containsInAnyOrder(patientId, observationId));
// Synchronous call
HttpGet get = new HttpGet(ourServerBase + "/" + patientId + "/$everything?_format=json&_count=100");
HttpGet get = new HttpGet(myServerBase + "/" + patientId + "/$everything?_format=json&_count=100");
get.addHeader(Constants.HEADER_CACHE_CONTROL, Constants.CACHE_CONTROL_NO_CACHE);
try (CloseableHttpResponse resp = ourHttpClient.execute(get)) {
assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy(), resp.getFirstHeader(ca.uhn.fhir.rest.api.Constants.HEADER_CONTENT_TYPE).getValue().replaceAll(";.*", ""));
@ -170,7 +170,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test {
@Test
public void testEverythingReturnsCorrectResources() throws Exception {
Bundle bundle = fetchBundle(ourServerBase + "/" + patId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + patId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
assertNull(bundle.getLink("next"));
@ -198,7 +198,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test {
public void testEverythingReturnsCorrectResourcesSmallPage() throws Exception {
myDaoConfig.setEverythingIncludesFetchPageSize(1);
Bundle bundle = fetchBundle(ourServerBase + "/" + patId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + patId + "/$everything?_format=json&_count=100", EncodingEnum.JSON);
assertNull(bundle.getLink("next"));
@ -224,7 +224,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test {
@Test
public void testEverythingPagesWithCorrectEncodingJson() throws Exception {
Bundle bundle = fetchBundle(ourServerBase + "/" + patId + "/$everything?_format=json&_count=1", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + patId + "/$everything?_format=json&_count=1", EncodingEnum.JSON);
assertNotNull(bundle.getLink("next").getUrl());
assertThat(bundle.getLink("next").getUrl(), containsString("_format=json"));
@ -241,7 +241,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test {
@Test
public void testEverythingPagesWithCorrectEncodingXml() throws Exception {
Bundle bundle = fetchBundle(ourServerBase + "/" + patId + "/$everything?_format=xml&_count=1", EncodingEnum.XML);
Bundle bundle = fetchBundle(myServerBase + "/" + patId + "/$everything?_format=xml&_count=1", EncodingEnum.XML);
assertNotNull(bundle.getLink("next").getUrl());
ourLog.info("Next link: {}", bundle.getLink("next").getUrl());
@ -264,7 +264,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test {
myObservationDao.create(obs1, new SystemRequestDetails()).getId().toUnqualifiedVersionless();
}
Bundle bundle = fetchBundle(ourServerBase + "/" + patId + "/$everything?_format=json&_count=250", EncodingEnum.JSON);
Bundle bundle = fetchBundle(myServerBase + "/" + patId + "/$everything?_format=json&_count=250", EncodingEnum.JSON);
do {
String next = bundle.getLink("next").getUrl();

View File

@ -85,7 +85,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
myDaoConfig.setEverythingIncludesFetchPageSize(new DaoConfig().getEverythingIncludesFetchPageSize());
myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds());
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
ourRestServer.unregisterProvider(theMemberMatchR4ResourceProvider);
myServer.getRestfulServer().unregisterProvider(theMemberMatchR4ResourceProvider);
}
@Override
@ -113,7 +113,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
.addPolicy(new Consent.ConsentPolicyComponent().setUri(CONSENT_POLICY_SENSITIVE_DATA_URI))
.setPatient(new Reference("Patient/A123"))
.addPerformer(new Reference("Patient/A123"));
ourRestServer.registerProvider(theMemberMatchR4ResourceProvider);
myServer.getRestfulServer().registerProvider(theMemberMatchR4ResourceProvider);
myMemberMatcherR4Helper.setRegularFilterSupported(false);
}
@ -155,7 +155,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
createCoverageWithBeneficiary(true, true);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
Parameters parametersResponse = performOperation(ourServerBase + ourQuery,
Parameters parametersResponse = performOperation(myServerBase + ourQuery,
EncodingEnum.JSON, inputParameters);
validateMemberPatient(parametersResponse);
@ -168,7 +168,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
createCoverageWithBeneficiary(false, false);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Could not find beneficiary for coverage.");
}
@ -177,7 +177,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
createCoverageWithBeneficiary(true, false);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Coverage beneficiary does not have an identifier.");
}
@ -187,7 +187,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
myPatient.setName(Lists.newArrayList(new HumanName().setUse(HumanName.NameUse.OFFICIAL).setFamily("Smith")));
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Could not find matching patient for coverage.");
}
@ -197,7 +197,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
myPatient.setBirthDateElement(new DateType("2000-01-01"));
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Could not find matching patient for coverage.");
}
@ -206,7 +206,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
createCoverageWithBeneficiary(true, true);
myConsent.getPolicy().get(0).setUri(CONSENT_POLICY_REGULAR_DATA_URI);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Consent policy does not match the data release segmentation capabilities.");
}
@ -214,7 +214,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
public void testSensitiveContentProfileAccessWithRegularNotAllowed() throws Exception {
createCoverageWithBeneficiary(true, true);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
Parameters parametersResponse = performOperation(ourServerBase + ourQuery,
Parameters parametersResponse = performOperation(myServerBase + ourQuery,
EncodingEnum.JSON, inputParameters);
validateMemberPatient(parametersResponse);
@ -227,7 +227,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
myConsent.getPolicy().get(0).setUri(CONSENT_POLICY_REGULAR_DATA_URI);
myMemberMatcherR4Helper.setRegularFilterSupported(true);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
Parameters parametersResponse = performOperation(ourServerBase + ourQuery,
Parameters parametersResponse = performOperation(myServerBase + ourQuery,
EncodingEnum.JSON, inputParameters);
validateMemberPatient(parametersResponse);
@ -240,7 +240,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
myConsent.getPolicy().get(0).setUri(CONSENT_POLICY_REGULAR_DATA_URI);
myMemberMatcherR4Helper.setRegularFilterSupported(true);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
Parameters parametersResponse = performOperation(ourServerBase + ourQuery,
Parameters parametersResponse = performOperation(myServerBase + ourQuery,
EncodingEnum.JSON, inputParameters);
validateMemberPatient(parametersResponse);
@ -274,35 +274,35 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
@Test
public void testInvalidPatient() throws Exception {
Parameters inputParameters = buildInputParameters(new Patient(), ourOldCoverage, ourNewCoverage, ourConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Parameter \\\"" + PARAM_MEMBER_PATIENT + "\\\" is required.");
}
@Test
public void testInvalidOldCoverage() throws Exception {
Parameters inputParameters = buildInputParameters(ourPatient, new Coverage(), ourNewCoverage, ourConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Parameter \\\"" + PARAM_OLD_COVERAGE + "\\\" is required.");
}
@Test
public void testInvalidNewCoverage() throws Exception {
Parameters inputParameters = buildInputParameters(ourPatient, ourOldCoverage, new Coverage(), ourConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Parameter \\\"" + PARAM_NEW_COVERAGE + "\\\" is required.");
}
@Test
public void testInvalidConsent() throws Exception {
Parameters inputParameters = buildInputParameters(ourPatient, ourOldCoverage, ourNewCoverage, new Consent());
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Parameter \\\"" + PARAM_CONSENT + "\\\" is required.");
}
@Test
public void testMissingPatientFamilyName() throws Exception {
Parameters inputParameters = buildInputParameters(ourPatient, ourOldCoverage, ourNewCoverage, ourConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Parameter \\\"" + PARAM_MEMBER_PATIENT_NAME + "\\\" is required.");
}
@ -311,7 +311,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
ourPatient.setName(Lists.newArrayList(new HumanName()
.setUse(HumanName.NameUse.OFFICIAL).setFamily("Person")));
Parameters inputParameters = buildInputParameters(ourPatient, ourOldCoverage, ourNewCoverage, ourConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Parameter \\\"" + PARAM_MEMBER_PATIENT_BIRTHDATE + "\\\" is required.");
}
@ -322,7 +322,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
.setBirthDateElement(new DateType("2020-01-01"));
Parameters inputParameters = buildInputParameters(ourPatient, ourOldCoverage, ourNewCoverage, ourConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Parameter \\\"" + PARAM_CONSENT_PATIENT_REFERENCE + "\\\" is required.");
}
@ -334,7 +334,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
ourConsent.setPatient(new Reference("Patient/1"));
Parameters inputParameters = buildInputParameters(ourPatient, ourOldCoverage, ourNewCoverage, ourConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Parameter \\\"" + PARAM_CONSENT_PERFORMER_REFERENCE + "\\\" is required.");
}
}
@ -345,7 +345,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
createCoverageWithBeneficiary(true, true);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
Parameters parametersResponse = performOperation(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters);
Parameters parametersResponse = performOperation(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters);
validateMemberPatient(parametersResponse);
validateNewCoverage(parametersResponse, newCoverage);
@ -407,7 +407,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
@Test
public void testNoCoverageMatchFound() throws Exception {
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
performOperationExpecting422(ourServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
performOperationExpecting422(myServerBase + ourQuery, EncodingEnum.JSON, inputParameters,
"Could not find coverage for member");
}
@ -415,7 +415,7 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes
public void testConsentUpdatePatientAndPerformer() throws Exception {
createCoverageWithBeneficiary(true, true);
Parameters inputParameters = buildInputParameters(myPatient, oldCoverage, newCoverage, myConsent);
Parameters parametersResponse = performOperation(ourServerBase + ourQuery,
Parameters parametersResponse = performOperation(myServerBase + ourQuery,
EncodingEnum.JSON, inputParameters);
Consent respConsent = validateResponseConsent(parametersResponse, myConsent);

View File

@ -90,7 +90,7 @@ public class ResourceProviderConcurrencyR4Test extends BaseResourceProviderR4Tes
// Submit search 1 (should block because of interceptor semaphore)
{
String uri = ourServerBase + "/Patient?_format=json&family=FAMILY1";
String uri = myServerBase + "/Patient?_format=json&family=FAMILY1";
ourLog.info("Submitting GET " + uri);
HttpGet get = new HttpGet(uri);
myExecutor.submit(() -> {
@ -114,7 +114,7 @@ public class ResourceProviderConcurrencyR4Test extends BaseResourceProviderR4Tes
// Submit search 2 (should also block because it will reuse the first search - same name being searched)
{
String uri = ourServerBase + "/Patient?_format=json&family=FAMILY1";
String uri = myServerBase + "/Patient?_format=json&family=FAMILY1";
HttpGet get = new HttpGet(uri);
myExecutor.submit(() -> {
ourLog.info("Submitting GET " + uri);
@ -136,7 +136,7 @@ public class ResourceProviderConcurrencyR4Test extends BaseResourceProviderR4Tes
// Submit search 3 (should not block - different name being searched, so it should actually finish first)
{
String uri = ourServerBase + "/Patient?_format=json&family=FAMILY3";
String uri = myServerBase + "/Patient?_format=json&family=FAMILY3";
HttpGet get = new HttpGet(uri);
myExecutor.submit(() -> {
ourLog.info("Submitting GET " + uri);

View File

@ -285,14 +285,14 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
IBundleProvider results;
List<String> foundResources;
HttpGet get = new HttpGet(ourServerBase + "/Appointment?_include:recurse=Appointment:patient&_include:recurse=Appointment:location&_include:recurse=Patient:attending&_pretty=true");
HttpGet get = new HttpGet(myServerBase + "/Appointment?_include:recurse=Appointment:patient&_include:recurse=Appointment:location&_include:recurse=Patient:attending&_pretty=true");
CloseableHttpResponse response = ourHttpClient.execute(get);
try {
String resp = IOUtils.toString(response.getEntity().getContent(), Constants.CHARSET_UTF8);
ourLog.info(resp);
assertEquals(200, response.getStatusLine().getStatusCode());
assertThat(resp, containsString("<fullUrl value=\"http://localhost:" + ourPort + "/fhir/context/Practitioner/"));
assertThat(resp, containsString("<fullUrl value=\"http://localhost:" + myPort + "/fhir/context/Practitioner/"));
} finally {
IOUtils.closeQuietly(response);
}
@ -530,7 +530,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
if (bundle == null) {
bundle = myClient
.search()
.byUrl(ourServerBase + "/Patient?identifier=FOO")
.byUrl(myServerBase + "/Patient?identifier=FOO")
.returnBundle(Bundle.class)
.execute();
} else {

View File

@ -112,7 +112,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:identifier=" + UrlUtil.escapeUrlParam("urn:system|FOO");
String uri = myServerBase + "/Patient?_has:Observation:subject:identifier=" + UrlUtil.escapeUrlParam("urn:system|FOO");
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertThat(ids, contains(pid0.getValue()));
}
@ -163,7 +163,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
ourLog.info("Encounter: \n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(encounter));
}
String uri = ourServerBase + "/Patient?_has:Encounter:subject:class=" + UrlUtil.escapeUrlParam("urn:system|IMP") + "&_has:Encounter:subject:date=gt1950";
String uri = myServerBase + "/Patient?_has:Encounter:subject:class=" + UrlUtil.escapeUrlParam("urn:system|IMP") + "&_has:Encounter:subject:date=gt1950";
ourLog.info("uri = " + uri);
@ -220,7 +220,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
ourLog.info("Encounter: \n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(encounter));
}
String uri = ourServerBase + "/Patient?_has:Observation:patient:code=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7") + "&_has:Encounter:subject:date=gt1950";
String uri = myServerBase + "/Patient?_has:Observation:patient:code=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7") + "&_has:Encounter:subject:date=gt1950";
ourLog.info("uri = " + uri);
@ -269,7 +269,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
myObservationDao.create(obs, mySrd);
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt180");
String uri = myServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt180");
ourLog.info("uri = " + uri);
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertThat(ids, contains(pid0.getValue()));
@ -317,7 +317,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
myObservationDao.create(obs, mySrd);
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:code-value-date=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt2019");
String uri = myServerBase + "/Patient?_has:Observation:subject:code-value-date=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt2019");
ourLog.info("uri = " + uri);
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertThat(ids, contains(pid0.getValue()));
@ -373,7 +373,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
myObservationDao.create(obs, mySrd);
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:combo-code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-8$200");
String uri = myServerBase + "/Patient?_has:Observation:subject:combo-code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-8$200");
ourLog.info("uri = " + uri);
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertThat(ids, contains(pid0.getValue()));
@ -433,7 +433,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
myObservationDao.create(obs, mySrd);
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:code-value-string=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$100,http://loinc.org|2345-7$200");
String uri = myServerBase + "/Patient?_has:Observation:subject:code-value-string=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$100,http://loinc.org|2345-7$200");
ourLog.info("uri = " + uri);
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
@ -481,7 +481,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
myObservationDao.create(obs, mySrd);
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$lt180");
String uri = myServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$lt180");
ourLog.info("uri = " + uri);
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(0, ids.size());
@ -528,7 +528,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
myObservationDao.create(obs, mySrd);
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt180") + "&_has:Observation:subject:identifier=" + UrlUtil.escapeUrlParam("urn:system|FOO");
String uri = myServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt180") + "&_has:Observation:subject:identifier=" + UrlUtil.escapeUrlParam("urn:system|FOO");
ourLog.info("uri = " + uri);
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
@ -589,7 +589,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
ourLog.info("Encounter: \n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(encounter));
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt180") + "&_has:Encounter:subject:date=gt1950" + "&_has:Encounter:subject:class=" + UrlUtil.escapeUrlParam("urn:system|IMP");
String uri = myServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt180") + "&_has:Encounter:subject:date=gt1950" + "&_has:Encounter:subject:class=" + UrlUtil.escapeUrlParam("urn:system|IMP");
ourLog.info("uri = " + uri);
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
@ -604,7 +604,7 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test {
createPatientWithObs(10);
}
String uri = ourServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt180") + "&_has:Observation:subject:date=gt1950" + "&_has:Observation:subject:status=final&_count=4";
String uri = myServerBase + "/Patient?_has:Observation:subject:code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$gt180") + "&_has:Observation:subject:date=gt1950" + "&_has:Observation:subject:status=final&_count=4";
ourLog.info("uri = " + uri);
myCaptureQueriesListener.clear();

View File

@ -87,7 +87,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
super.after();
myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds());
ourRestServer.getInterceptorService().unregisterAllInterceptors();
myServer.getRestfulServer().getInterceptorService().unregisterAllInterceptors();
}
@Test
@ -101,11 +101,11 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
}
IAnonymousInterceptor interceptor = mock(IAnonymousInterceptor.class);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_COMPLETE, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_FAILED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_PASS_COMPLETE, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_SELECT_COMPLETE, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_COMPLETE, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_FAILED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_PASS_COMPLETE, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_SEARCH_SELECT_COMPLETE, interceptor);
myInterceptors.add(interceptor);
myInterceptors.add(new PerformanceTracingLoggingInterceptor());
@ -156,10 +156,10 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
// Do it again but with a conditional create that shouldn't actually create
IAnonymousInterceptor interceptor = mock(IAnonymousInterceptor.class);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_POST_PROCESSED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_RESOURCE_CREATED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_RESOURCE_UPDATED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_POST_PROCESSED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_RESOURCE_CREATED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_RESOURCE_UPDATED, interceptor);
entry.getRequest().setIfNoneExist("Patient?name=" + methodName);
transaction(bundle);
@ -186,16 +186,16 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
String resource = myFhirContext.newXmlParser().encodeResourceToString(pt);
IAnonymousInterceptor interceptor = mock(IAnonymousInterceptor.class);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
HttpPost post = new HttpPost(ourServerBase + "/Patient");
HttpPost post = new HttpPost(myServerBase + "/Patient");
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
try (CloseableHttpResponse response = ourHttpClient.execute(post)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info("Response was: {}", resp);
assertEquals(201, response.getStatusLine().getStatusCode());
String newIdString = response.getFirstHeader(Constants.HEADER_LOCATION_LC).getValue();
assertThat(newIdString, startsWith(ourServerBase + "/Patient/"));
assertThat(newIdString, startsWith(myServerBase + "/Patient/"));
}
verify(interceptor, timeout(10 * MILLIS_PER_SECOND).times(1)).invoke(eq(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED), myParamsCaptor.capture());
@ -220,9 +220,9 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
entry.getRequest().setUrl("Patient");
IAnonymousInterceptor interceptor = mock(IAnonymousInterceptor.class);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_POST_PROCESSED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRECOMMIT_RESOURCE_CREATED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_POST_PROCESSED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRECOMMIT_RESOURCE_CREATED, interceptor);
transaction(bundle);
@ -237,7 +237,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
public void testCreateReflexResourceTheHardWay() {
ServerOperationInterceptorAdapter interceptor = new ReflexInterceptor();
ourRestServer.registerInterceptor(interceptor);
myServer.getRestfulServer().registerInterceptor(interceptor);
try {
Patient p = new Patient();
@ -254,7 +254,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
ourLog.info(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(observations));
} finally {
ourRestServer.unregisterInterceptor(interceptor);
myServer.getRestfulServer().unregisterInterceptor(interceptor);
}
}
@ -280,16 +280,16 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
ourLog.info(resource);
IAnonymousInterceptor interceptor = mock(IAnonymousInterceptor.class);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
HttpPost post = new HttpPost(ourServerBase + "/Patient");
HttpPost post = new HttpPost(myServerBase + "/Patient");
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
try (CloseableHttpResponse response = ourHttpClient.execute(post)) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info("Response was: {}", resp);
assertEquals(201, response.getStatusLine().getStatusCode());
String newIdString = response.getFirstHeader(Constants.HEADER_LOCATION_LC).getValue();
assertThat(newIdString, startsWith(ourServerBase + "/Patient/"));
assertThat(newIdString, startsWith(myServerBase + "/Patient/"));
}
verify(interceptor, timeout(10 * MILLIS_PER_SECOND).times(1)).invoke(eq(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED), myParamsCaptor.capture());
@ -321,9 +321,9 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
// Do it again but with an update that shouldn't actually create
IAnonymousInterceptor interceptor = mock(IAnonymousInterceptor.class);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRECOMMIT_RESOURCE_CREATED, interceptor);
ourRestServer.getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRECOMMIT_RESOURCE_UPDATED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.SERVER_INCOMING_REQUEST_PRE_HANDLED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRECOMMIT_RESOURCE_CREATED, interceptor);
myServer.getRestfulServer().getInterceptorService().registerAnonymousInterceptor(Pointcut.STORAGE_PRECOMMIT_RESOURCE_UPDATED, interceptor);
entry.getRequest().setIfNoneExist("Patient?name=" + methodName);
transaction(bundle);
@ -338,7 +338,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
private void transaction(Bundle theBundle) throws IOException {
String resource = myFhirContext.newXmlParser().encodeResourceToString(theBundle);
HttpPost post = new HttpPost(ourServerBase + "/");
HttpPost post = new HttpPost(myServerBase + "/");
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
try (CloseableHttpResponse response = ourHttpClient.execute(post)) {
assertEquals(200, response.getStatusLine().getStatusCode());
@ -401,7 +401,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
SearchExpandingInterceptor interceptor = new SearchExpandingInterceptor();
try {
ourRestServer.registerInterceptor(interceptor);
myServer.getRestfulServer().registerInterceptor(interceptor);
Bundle bundle = myClient
.search()
@ -413,7 +413,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
assertThat(ids, containsInAnyOrder("Observation/o1", "Observation/o2"));
} finally {
ourRestServer.unregisterInterceptor(interceptor);
myServer.getRestfulServer().unregisterInterceptor(interceptor);
}
}
@ -534,7 +534,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
}
private void registerSearchParameterValidatingInterceptor(){
ourRestServer.getInterceptorService().registerInterceptor(mySearchParamValidatingInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(mySearchParamValidatingInterceptor);
}
private SearchParameter createSearchParameter(){

View File

@ -25,7 +25,7 @@ public class ResourceProviderInvalidDataR4Test extends BaseResourceProviderR4Tes
@AfterEach
public void after() throws Exception {
super.after();
ourRestServer.getInterceptorService().unregisterAllInterceptors();
myServer.getRestfulServer().getInterceptorService().unregisterAllInterceptors();
}
@Test
@ -46,7 +46,7 @@ public class ResourceProviderInvalidDataR4Test extends BaseResourceProviderR4Tes
myResourceHistoryTableDao.save(resVer);
});
HttpGet httpGet = new HttpGet(ourServerBase + "/Observation/" + id);
HttpGet httpGet = new HttpGet(myServerBase + "/Observation/" + id);
httpGet.addHeader("Accept", "application/fhir+json");
try (CloseableHttpResponse status = ourHttpClient.execute(httpGet)) {
String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);

View File

@ -73,7 +73,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
}
}
ourRestServer.getInterceptorService().registerInterceptor(ourValidatingInterceptor);
myServer.getRestfulServer().getInterceptorService().registerInterceptor(ourValidatingInterceptor);
}
@Test
@ -214,7 +214,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
" </item>\n" +
"</QuestionnaireResponse>";
HttpPost post = new HttpPost(ourServerBase + "/QuestionnaireResponse");
HttpPost post = new HttpPost(myServerBase + "/QuestionnaireResponse");
post.setEntity(new StringEntity(input, ContentType.create(ca.uhn.fhir.rest.api.Constants.CT_FHIR_XML, "UTF-8")));
CloseableHttpResponse response = ourHttpClient.execute(post);
final IdType id2;
@ -223,13 +223,13 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
ourLog.info("Response: {}", responseString);
assertEquals(201, response.getStatusLine().getStatusCode());
String newIdString = response.getFirstHeader(ca.uhn.fhir.rest.api.Constants.HEADER_LOCATION_LC).getValue();
assertThat(newIdString, startsWith(ourServerBase + "/QuestionnaireResponse/"));
assertThat(newIdString, startsWith(myServerBase + "/QuestionnaireResponse/"));
id2 = new IdType(newIdString);
} finally {
IOUtils.closeQuietly(response);
}
HttpGet get = new HttpGet(ourServerBase + "/QuestionnaireResponse/" + id2.getIdPart() + "?_format=xml&_pretty=true");
HttpGet get = new HttpGet(myServerBase + "/QuestionnaireResponse/" + id2.getIdPart() + "?_format=xml&_pretty=true");
response = ourHttpClient.execute(get);
try {
String responseString = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -244,7 +244,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
@Test
public void testValidateOnNoId() throws Exception {
HttpGet get = new HttpGet(ourServerBase + "/QuestionnaireResponse/$validate");
HttpGet get = new HttpGet(myServerBase + "/QuestionnaireResponse/$validate");
CloseableHttpResponse response = ourHttpClient.execute(get);
try {
String responseString = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
@ -265,7 +265,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
public void testValidateQuestionnaireResponseWithNoIdForCreate() throws Exception {
String input = "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"mode\",\"valueString\":\"create\"},{\"name\":\"resource\",\"resource\":{\"resourceType\":\"QuestionnaireResponse\",\"questionnaire\":\"http://fhirtest.uhn.ca/baseDstu2/Questionnaire/MedsCheckEligibility\",\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">!-- populated from the rendered HTML below --></div>\"},\"status\":\"completed\",\"authored\":\"2017-02-10T00:02:58.098Z\"}}]}";
HttpPost post = new HttpPost(ourServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
HttpPost post = new HttpPost(myServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
CloseableHttpResponse response = ourHttpClient.execute(post);
try {
@ -285,7 +285,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
public void testValidateQuestionnaireResponseWithNoIdForUpdate() throws Exception {
String input = "{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"mode\",\"valueString\":\"update\"},{\"name\":\"resource\",\"resource\":{\"resourceType\":\"QuestionnaireResponse\",\"questionnaire\":\"http://fhirtest.uhn.ca/baseDstu2/Questionnaire/MedsCheckEligibility\",\"text\":{\"status\":\"generated\",\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">!-- populated from the rendered HTML below --></div>\"},\"status\":\"completed\",\"authored\":\"2017-02-10T00:02:58.098Z\"}}]}";
HttpPost post = new HttpPost(ourServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
HttpPost post = new HttpPost(myServerBase + "/QuestionnaireResponse/$validate?_pretty=true");
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
CloseableHttpResponse response = ourHttpClient.execute(post);
try {

View File

@ -343,7 +343,7 @@ public class ResourceProviderR4BundleTest extends BaseResourceProviderR4Test {
// GET CarePlans from server
Bundle bundle = myClient.search()
.byUrl(ourServerBase + "/CarePlan")
.byUrl(myServerBase + "/CarePlan")
.returnBundle(Bundle.class).execute();
// Create and populate list of CarePlans

View File

@ -194,7 +194,7 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test {
Bundle results2 = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute();
assertEquals(1, results2.getEntry().size());
runInTransaction(() -> assertEquals(1, mySearchEntityDao.count()));
assertEquals("HIT from " + ourServerBase, myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE).get(0));
assertEquals("HIT from " + myServerBase, myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE).get(0));
assertEquals(results1.getMeta().getLastUpdated(), results2.getMeta().getLastUpdated());
assertEquals(results1.getId(), results2.getId());
}

View File

@ -451,7 +451,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
assertEquals("Parent Child CodeSystem", initialCodeSystem.getName());
initialCodeSystem.setName("Updated Parent Child CodeSystem");
String encoded = myFhirContext.newJsonParser().encodeResourceToString(initialCodeSystem);
HttpPut putRequest = new HttpPut(ourServerBase + "/CodeSystem/" + parentChildCsId);
HttpPut putRequest = new HttpPut(myServerBase + "/CodeSystem/" + parentChildCsId);
putRequest.setEntity(new StringEntity(encoded, ContentType.parse("application/json+fhir")));
CloseableHttpResponse resp = ourHttpClient.execute(putRequest);
try {

View File

@ -793,7 +793,7 @@ public class ResourceProviderR4CodeSystemVersionedTest extends BaseResourceProvi
assertEquals("Parent Child CodeSystem 1", initialCodeSystem.getName());
initialCodeSystem.setName("Updated Parent Child CodeSystem 1");
String encoded = myFhirContext.newJsonParser().encodeResourceToString(initialCodeSystem);
HttpPut putRequest = new HttpPut(ourServerBase + "/CodeSystem/" + parentChildCs1Id);
HttpPut putRequest = new HttpPut(myServerBase + "/CodeSystem/" + parentChildCs1Id);
putRequest.setEntity(new StringEntity(encoded, ContentType.parse("application/json+fhir")));
myCaptureQueriesListener.clear();
CloseableHttpResponse resp = ourHttpClient.execute(putRequest);
@ -811,7 +811,7 @@ public class ResourceProviderR4CodeSystemVersionedTest extends BaseResourceProvi
assertEquals("Parent Child CodeSystem 2", initialCodeSystem.getName());
initialCodeSystem.setName("Updated Parent Child CodeSystem 2");
encoded = myFhirContext.newJsonParser().encodeResourceToString(initialCodeSystem);
putRequest = new HttpPut(ourServerBase + "/CodeSystem/" + parentChildCs2Id);
putRequest = new HttpPut(myServerBase + "/CodeSystem/" + parentChildCs2Id);
putRequest.setEntity(new StringEntity(encoded, ContentType.parse("application/json+fhir")));
resp = ourHttpClient.execute(putRequest);
try {

View File

@ -37,7 +37,7 @@ public class ResourceProviderR4DistanceTest extends BaseResourceProviderR4Test {
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
@ -55,7 +55,7 @@ public class ResourceProviderR4DistanceTest extends BaseResourceProviderR4Test {
myCaptureQueriesListener.clear();
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
@ -84,7 +84,7 @@ public class ResourceProviderR4DistanceTest extends BaseResourceProviderR4Test {
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
@ -117,7 +117,7 @@ public class ResourceProviderR4DistanceTest extends BaseResourceProviderR4Test {
myCaptureQueriesListener.clear();
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
@ -137,7 +137,7 @@ public class ResourceProviderR4DistanceTest extends BaseResourceProviderR4Test {
myCaptureQueriesListener.clear();
Bundle actual = myClient
.search()
.byUrl(ourServerBase + "/" + url)
.byUrl(myServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)

View File

@ -89,7 +89,7 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
public void testContainedDisabled() throws Exception {
myModelConfig.setIndexOnContainedResources(false);
String uri = ourServerBase + "/Observation?subject.name=Smith&_contained=true";
String uri = myServerBase + "/Observation?subject.name=Smith&_contained=true";
try (CloseableHttpResponse response = ourHttpClient.execute(new HttpGet(uri))) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(resp);
@ -100,7 +100,7 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
@Test
public void testContainedBoth() throws Exception {
String uri = ourServerBase + "/Observation?subject.name=Smith&_contained=both";
String uri = myServerBase + "/Observation?subject.name=Smith&_contained=both";
try (CloseableHttpResponse response = ourHttpClient.execute(new HttpGet(uri))) {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(resp);
@ -161,28 +161,28 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
//-- Simple name match
String uri = ourServerBase + "/Observation?subject.name=Smith&_contained=true";
String uri = myServerBase + "/Observation?subject.name=Smith&_contained=true";
List<String> oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());
assertThat(oids, contains(oid1.getValue()));
//-- Simple name match with or
uri = ourServerBase + "/Observation?subject.name=Smith,Jane&_contained=true";
uri = myServerBase + "/Observation?subject.name=Smith,Jane&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(2L, oids.size());
//assertEquals(oids.toString(), "[Observation/1, Observation/2]");
//-- Simple name match with qualifier
uri = ourServerBase + "/Observation?subject.name:exact=Smith&_contained=true";
uri = myServerBase + "/Observation?subject.name:exact=Smith&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());
assertThat(oids, contains(oid1.getValue()));
//-- Simple name match with and
uri = ourServerBase + "/Observation?subject.family=Smith&subject.given=John&_contained=true";
uri = myServerBase + "/Observation?subject.family=Smith&subject.given=John&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());
@ -245,42 +245,42 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
}
//-- Search by date default op
String uri = ourServerBase + "/Observation?subject.birthdate=2000-01-01&_contained=true";
String uri = myServerBase + "/Observation?subject.birthdate=2000-01-01&_contained=true";
List<String> oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());
assertThat(oids, contains(oid1.getValue()));
//-- Search by date op=eq
uri = ourServerBase + "/Observation?subject.birthdate=eq2000-01-01&_contained=true";
uri = myServerBase + "/Observation?subject.birthdate=eq2000-01-01&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());
assertThat(oids, contains(oid1.getValue()));
//-- Search by date op=eq, with or
uri = ourServerBase + "/Observation?subject.birthdate=2000-01-01,2000-02-01&_contained=true";
uri = myServerBase + "/Observation?subject.birthdate=2000-01-01,2000-02-01&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(2L, oids.size());
//assertEquals(oids.toString(), "[Observation/1, Observation/2]");
//-- Simple name match with op = gt
uri = ourServerBase + "/Observation?subject.birthdate=gt2000-02-10&_contained=true";
uri = myServerBase + "/Observation?subject.birthdate=gt2000-02-10&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());
assertThat(oids, contains(oid3.getValue()));
//-- Simple name match with AND
uri = ourServerBase + "/Observation?subject.family=Smith&subject.birthdate=eq2000-01-01&_contained=true";
uri = myServerBase + "/Observation?subject.family=Smith&subject.birthdate=eq2000-01-01&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());
assertThat(oids, contains(oid1.getValue()));
//-- Simple name match with AND - not found
uri = ourServerBase + "/Observation?subject.family=Smith&subject.birthdate=eq2000-02-01&_contained=true";
uri = myServerBase + "/Observation?subject.family=Smith&subject.birthdate=eq2000-02-01&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(0L, oids.size());
@ -385,7 +385,7 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
}
//-- Search by number
String uri = ourServerBase + "/ClinicalImpression?investigation.probability=2&_contained=true";
String uri = myServerBase + "/ClinicalImpression?investigation.probability=2&_contained=true";
List<String> cids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, cids.size());
@ -393,7 +393,7 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
//-- Search by number with op = eq
uri = ourServerBase + "/ClinicalImpression?investigation.probability=eq2&_contained=true";
uri = myServerBase + "/ClinicalImpression?investigation.probability=eq2&_contained=true";
cids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, cids.size());
@ -401,12 +401,12 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
//-- Search by number with op = eq and or
uri = ourServerBase + "/ClinicalImpression?investigation.probability=eq2,10&_contained=true";
uri = myServerBase + "/ClinicalImpression?investigation.probability=eq2,10&_contained=true";
cids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(2L, cids.size());
//-- Search by number with op = lt
uri = ourServerBase + "/ClinicalImpression?investigation.probability=lt4&_contained=true";
uri = myServerBase + "/ClinicalImpression?investigation.probability=lt4&_contained=true";
cids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, cids.size());
@ -509,7 +509,7 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
}
//-- Search by quantity
String uri = ourServerBase + "/Encounter?reason-reference.combo-value-quantity=200&_contained=true";
String uri = myServerBase + "/Encounter?reason-reference.combo-value-quantity=200&_contained=true";
List<String> eids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, eids.size());
@ -517,7 +517,7 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
//-- Search by quantity
uri = ourServerBase + "/Encounter?reason-reference.combo-value-quantity=le400&_contained=true";
uri = myServerBase + "/Encounter?reason-reference.combo-value-quantity=le400&_contained=true";
eids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(3L, eids.size());
@ -620,7 +620,7 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
}
//-- Search by code
String uri = ourServerBase + "/Encounter?reason-reference.code=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7") + "&_contained=true";
String uri = myServerBase + "/Encounter?reason-reference.code=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7") + "&_contained=true";
List<String> eids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, eids.size());
@ -724,14 +724,14 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
}
//-- Search by composite
String uri = ourServerBase + "/Encounter?reason-reference.combo-code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-8$300") + "&_contained=true";
String uri = myServerBase + "/Encounter?reason-reference.combo-code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-8$300") + "&_contained=true";
List<String> eids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, eids.size());
assertThat(eids, contains(eid2.getValue()));
//-- Search by composite - not found
uri = ourServerBase + "/Encounter?reason-reference.combo-code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$300") + "&_contained=true";
uri = myServerBase + "/Encounter?reason-reference.combo-code-value-quantity=http://" + UrlUtil.escapeUrlParam("loinc.org|2345-7$300") + "&_contained=true";
eids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(0L, eids.size());
@ -825,20 +825,20 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
}
//-- Search by uri
String uri = ourServerBase + "/Observation?based-on.instantiates-uri=http://www.hl7.com";
String uri = myServerBase + "/Observation?based-on.instantiates-uri=http://www.hl7.com";
List<String> oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());
assertThat(oids, contains(oid1.getValue()));
//-- Search by uri more than 1 results
uri = ourServerBase + "/Observation?based-on.instantiates-uri=http://www2.hl7.com";
uri = myServerBase + "/Observation?based-on.instantiates-uri=http://www2.hl7.com";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(2L, oids.size());
//-- Search by uri with 'or'
uri = ourServerBase + "/Observation?based-on.instantiates-uri=http://www.hl7.com,http://www2.hl7.com";
uri = myServerBase + "/Observation?based-on.instantiates-uri=http://www.hl7.com,http://www2.hl7.com";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(3L, oids.size());
@ -919,13 +919,13 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
//-- No Obs with Patient Smith
String uri = ourServerBase + "/Observation?subject.family=Smith&_contained=true";
String uri = myServerBase + "/Observation?subject.family=Smith&_contained=true";
List<String> oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(0L, oids.size());
//-- Two Obs with Patient Doe
uri = ourServerBase + "/Observation?subject.family=Doe&_contained=true";
uri = myServerBase + "/Observation?subject.family=Doe&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(2L, oids.size());
@ -970,13 +970,13 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR
}
//-- No Obs with Patient Smith
String uri = ourServerBase + "/Observation?subject.family=Smith&_contained=true";
String uri = myServerBase + "/Observation?subject.family=Smith&_contained=true";
List<String> oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(0L, oids.size());
//-- 1 Obs with Patient Doe
uri = ourServerBase + "/Observation?subject.family=Doe&_contained=true";
uri = myServerBase + "/Observation?subject.family=Doe&_contained=true";
oids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1L, oids.size());

View File

@ -810,7 +810,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv
@Test
public void testInvalidFilter() throws Exception {
String string = loadResource("/bug_516_invalid_expansion.json");
HttpPost post = new HttpPost(ourServerBase + "/ValueSet/%24expand");
HttpPost post = new HttpPost(myServerBase + "/ValueSet/%24expand");
post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW)));
try (CloseableHttpResponse resp = ourHttpClient.execute(post)) {
@ -1022,7 +1022,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv
}
private void testValidateCodeOperationByCodeAndSystemInstanceOnType() throws IOException {
String url = ourServerBase +
String url = myServerBase +
"/ValueSet/" + myLocalValueSetId.getIdPart() + "/$validate-code?system=" +
UrlUtil.escapeUrlParam(URL_MY_CODE_SYSTEM) +
"&code=AA";
@ -1215,7 +1215,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv
}
private void testValidateCodeOperationByCodeAndSystemInstanceOnInstance() throws IOException {
String url = ourServerBase +
String url = myServerBase +
"/ValueSet/" + myLocalValueSetId.getIdPart() + "/$validate-code?system=" +
UrlUtil.escapeUrlParam(URL_MY_CODE_SYSTEM) +
"&code=AA";
@ -1326,13 +1326,13 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv
.setValue("ParentA");
IIdType vsId = myValueSetDao.create(vs).getId().toUnqualifiedVersionless();
HttpGet expandGet = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$expand?_pretty=true");
HttpGet expandGet = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$expand?_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(expandGet)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
}
HttpGet validateCodeGet = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=ChildAA&_pretty=true");
HttpGet validateCodeGet = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=ChildAA&_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(validateCodeGet)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
@ -1340,7 +1340,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv
assertEquals(true, output.getParameterBool("result"));
}
HttpGet validateCodeGet2 = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=FOO&_pretty=true");
HttpGet validateCodeGet2 = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=FOO&_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(validateCodeGet2)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);

View File

@ -947,13 +947,13 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid
.setValue("ParentA");
IIdType vsId = myValueSetDao.create(vs).getId().toUnqualifiedVersionless();
HttpGet expandGet = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$expand?_pretty=true");
HttpGet expandGet = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$expand?_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(expandGet)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
}
HttpGet validateCodeGet = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=ChildAA&_pretty=true");
HttpGet validateCodeGet = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=ChildAA&_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(validateCodeGet)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
@ -961,7 +961,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid
assertEquals(true, output.getParameterBool("result"));
}
HttpGet validateCodeGet2 = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=FOO&_pretty=true");
HttpGet validateCodeGet2 = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=FOO&_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(validateCodeGet2)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);

View File

@ -75,7 +75,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
List<IIdType> obsList = createObs(10, false);
String uri = ourServerBase + "/Observation?code:not=2345-3";
String uri = myServerBase + "/Observation?code:not=2345-3";
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(9, ids.size());
@ -95,7 +95,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
List<IIdType> obsList = createObs(10, false);
String uri = ourServerBase + "/Observation?code:not=2345-3&code:not=2345-7&code:not=2345-9";
String uri = myServerBase + "/Observation?code:not=2345-3&code:not=2345-7&code:not=2345-9";
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(7, ids.size());
@ -115,7 +115,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
// Observation?code:not=2345-3&code:not=2345-7&code:not=2345-9
// slower than Observation?code:not=2345-3&code=2345-7&code:not=2345-9
String uri = ourServerBase + "/Observation?code:not=2345-3&code=2345-7&code:not=2345-9";
String uri = myServerBase + "/Observation?code:not=2345-3&code=2345-7&code:not=2345-9";
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(1, ids.size());
@ -127,7 +127,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
List<IIdType> obsList = createObs(10, false);
String uri = ourServerBase + "/Observation?code:not=2345-3,2345-7,2345-9";
String uri = myServerBase + "/Observation?code:not=2345-3,2345-7,2345-9";
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(7, ids.size());
@ -145,7 +145,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
List<IIdType> obsList = createObs(10, true);
String uri = ourServerBase + "/Observation?code:not=2345-3";
String uri = myServerBase + "/Observation?code:not=2345-3";
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(8, ids.size());
@ -164,7 +164,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
List<IIdType> obsList = createObs(10, true);
String uri = ourServerBase + "/Observation?code:not=2345-3&code:not=2345-4";
String uri = myServerBase + "/Observation?code:not=2345-3&code:not=2345-4";
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(7, ids.size());
@ -182,7 +182,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
List<IIdType> obsList = createObs(10, true);
String uri = ourServerBase + "/Observation?code:not=2345-3&code=2345-7&code:not=2345-9";
String uri = myServerBase + "/Observation?code:not=2345-3&code=2345-7&code:not=2345-9";
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(2, ids.size());
@ -195,7 +195,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
List<IIdType> obsList = createObs(10, true);
String uri = ourServerBase + "/Observation?code:not=2345-3,2345-7,2345-9";
String uri = myServerBase + "/Observation?code:not=2345-3,2345-7,2345-9";
List<String> ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertEquals(4, ids.size());
@ -210,7 +210,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
myModelConfig.setIndexIdentifierOfType(true);
try {
String uri = ourServerBase + "/Patient?identifier:of-type=A";
String uri = myServerBase + "/Patient?identifier:of-type=A";
myClient.search().byUrl(uri).execute();
fail();
} catch (InvalidRequestException e) {
@ -218,7 +218,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
}
try {
String uri = ourServerBase + "/Patient?identifier:of-type=A|B";
String uri = myServerBase + "/Patient?identifier:of-type=A|B";
myClient.search().byUrl(uri).execute();
fail();
} catch (InvalidRequestException e) {
@ -226,7 +226,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
}
try {
String uri = ourServerBase + "/Patient?identifier:of-type=A|B|";
String uri = myServerBase + "/Patient?identifier:of-type=A|B|";
myClient.search().byUrl(uri).execute();
fail();
} catch (InvalidRequestException e) {
@ -234,7 +234,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
}
try {
String uri = ourServerBase + "/Patient?identifier:of-type=|B|C";
String uri = myServerBase + "/Patient?identifier:of-type=|B|C";
myClient.search().byUrl(uri).execute();
fail();
} catch (InvalidRequestException e) {
@ -242,7 +242,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
}
try {
String uri = ourServerBase + "/Patient?identifier:of-type=||C";
String uri = myServerBase + "/Patient?identifier:of-type=||C";
myClient.search().byUrl(uri).execute();
fail();
} catch (InvalidRequestException e) {
@ -250,7 +250,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
}
try {
String uri = ourServerBase + "/Patient?identifier:of-type=|B|";
String uri = myServerBase + "/Patient?identifier:of-type=|B|";
myClient.search().byUrl(uri).execute();
fail();
} catch (InvalidRequestException e) {
@ -258,7 +258,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
}
try {
String uri = ourServerBase + "/Patient?identifier:of-type=A||";
String uri = myServerBase + "/Patient?identifier:of-type=A||";
myClient.search().byUrl(uri).execute();
fail();
} catch (InvalidRequestException e) {
@ -266,7 +266,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4
}
try {
String uri = ourServerBase + "/Patient?identifier:of-type=||";
String uri = myServerBase + "/Patient?identifier:of-type=||";
myClient.search().byUrl(uri).execute();
fail();
} catch (InvalidRequestException e) {

View File

@ -35,7 +35,7 @@ public class ServerR4Test extends BaseResourceProviderR4Test {
@Test
public void testCapabilityStatementValidates() throws IOException {
HttpGet get = new HttpGet(ourServerBase + "/metadata?_pretty=true&_format=json");
HttpGet get = new HttpGet(myServerBase + "/metadata?_pretty=true&_format=json");
try (CloseableHttpResponse resp = ourHttpClient.execute(get)) {
assertEquals(200, resp.getStatusLine().getStatusCode());
String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8);
@ -59,7 +59,7 @@ public class ServerR4Test extends BaseResourceProviderR4Test {
*/
@Test
public void saveIdParamOnlyAppearsOnce() throws IOException {
HttpGet get = new HttpGet(ourServerBase + "/metadata?_pretty=true&_format=xml");
HttpGet get = new HttpGet(myServerBase + "/metadata?_pretty=true&_format=xml");
CloseableHttpResponse resp = ourHttpClient.execute(get);
try {
ourLog.info(resp.toString());

View File

@ -97,7 +97,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
public void after() throws Exception {
super.after();
ourRestServer.unregisterInterceptor(myRequestValidatingInterceptor);
myServer.unregisterInterceptor(myRequestValidatingInterceptor);
myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
myPagingProvider.setMaximumPageSize(myPreviousMaxPageSize);
@ -149,7 +149,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
IGenericClient fhirClient = this.myClient;
String url = ourServerBase + "/Observation?date=gt2000&_sort=-_lastUpdated";
String url = myServerBase + "/Observation?date=gt2000&_sort=-_lastUpdated";
int pageIndex = 0;
ourLog.info("Loading page {}", pageIndex);
@ -529,7 +529,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
*/
@Test
public void testMultithreadedSearchWithValidation() throws Exception {
ourRestServer.registerInterceptor(myRequestValidatingInterceptor);
myServer.registerInterceptor(myRequestValidatingInterceptor);
Bundle input = new Bundle();
input.setType(BundleType.TRANSACTION);
@ -540,7 +540,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
}
myClient.transaction().withBundle(input).execute();
try (CloseableHttpResponse getMeta = ourHttpClient.execute(new HttpGet(ourServerBase + "/metadata"))) {
try (CloseableHttpResponse getMeta = ourHttpClient.execute(new HttpGet(myServerBase + "/metadata"))) {
assertEquals(200, getMeta.getStatusLine().getStatusCode());
}
@ -669,7 +669,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test {
Bundle respBundle;
// Load search
HttpGet get = new HttpGet(ourServerBase + "/Patient?identifier=http%3A%2F%2Ftest%7CBAR," + UUID.randomUUID());
HttpGet get = new HttpGet(myServerBase + "/Patient?identifier=http%3A%2F%2Ftest%7CBAR," + UUID.randomUUID());
get.addHeader(Constants.HEADER_CONTENT_TYPE, Constants.CT_FHIR_JSON_NEW);
getResp = ourHttpClient.execute(get);
try {

View File

@ -15,7 +15,6 @@ import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor;
import ca.uhn.fhir.test.utilities.HttpClientExtension;
import ca.uhn.fhir.test.utilities.server.RestfulServerConfigurerExtension;
@ -30,23 +29,19 @@ import java.util.Arrays;
@ContextConfiguration(classes = ServerConfiguration.class)
public abstract class BaseResourceProviderR4BTest extends BaseJpaR4BTest {
protected int myPort;
protected String myServerBase;
protected IGenericClient myClient;
@RegisterExtension
protected static HttpClientExtension ourHttpClient = new HttpClientExtension();
// TODO: JA2 These are no longer static but are named like static. I'm going to
// rename them in a separate PR that only makes that change so that it's easier to review
protected int ourPort;
protected String ourServerBase;
protected IGenericClient myClient;
protected RestfulServer ourRestServer;
@Autowired
@RegisterExtension
protected RestfulServerExtension myServer;
@RegisterExtension
protected RestfulServerConfigurerExtension myServerConfigurer = new RestfulServerConfigurerExtension(() -> myServer).withServerBeforeEach(s -> {
protected RestfulServerConfigurerExtension myServerConfigurer = new RestfulServerConfigurerExtension(() -> myServer).withServerBeforeAll(s -> {
s.registerProviders(myResourceProviders.createProviders());
s.setDefaultResponseEncoding(EncodingEnum.XML);
s.setDefaultPrettyPrint(false);
@ -84,13 +79,12 @@ public abstract class BaseResourceProviderR4BTest extends BaseJpaR4BTest {
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
s.registerInterceptor(corsInterceptor);
}).withServerBeforeAll(s -> {
}).withServerBeforeEach(s -> {
// TODO: JA-2 These don't need to be static variables, should just inline all of the uses of these
ourPort = myServer.getPort();
ourServerBase = myServer.getBaseUrl();
myPort = myServer.getPort();
myServerBase = myServer.getBaseUrl();
myClient = myServer.getFhirClient();
ourRestServer = myServer.getRestfulServer();
myClient.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof LoggingInterceptor);
if (shouldLogClient()) {
@ -112,9 +106,7 @@ public abstract class BaseResourceProviderR4BTest extends BaseJpaR4BTest {
@AfterEach
public void after() throws Exception {
myFhirCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE);
if (ourRestServer != null) {
ourRestServer.getInterceptorService().unregisterAllInterceptors();
}
myServer.getRestfulServer().getInterceptorService().unregisterAllInterceptors();
}
protected boolean shouldLogClient() {

View File

@ -62,7 +62,7 @@ public class ResourceProviderR4BTest extends BaseResourceProviderR4BTest {
myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds());
myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches());
ourRestServer.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof OpenApiInterceptor);
myServer.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof OpenApiInterceptor);
}
@BeforeEach
@ -319,7 +319,7 @@ public class ResourceProviderR4BTest extends BaseResourceProviderR4BTest {
ourLog.info("Observation: \n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(obs));
}
String uri = ourServerBase + "/Observation?_sort=combo-code-value-quantity";
String uri = myServerBase + "/Observation?_sort=combo-code-value-quantity";
Bundle found;
HttpGet get = new HttpGet(uri);
@ -402,9 +402,9 @@ public class ResourceProviderR4BTest extends BaseResourceProviderR4BTest {
@Test
public void testOpenApiFetchSwaggerUi() throws IOException {
ourRestServer.getInterceptorService().registerInterceptor(new OpenApiInterceptor());
myServer.getInterceptorService().registerInterceptor(new OpenApiInterceptor());
String uri = ourServerBase + "/swagger-ui/";
String uri = myServerBase + "/swagger-ui/";
HttpGet get = new HttpGet(uri);
try (CloseableHttpResponse resp = ourHttpClient.execute(get)) {
@ -465,7 +465,7 @@ public class ResourceProviderR4BTest extends BaseResourceProviderR4BTest {
// GET CarePlans from server
Bundle bundle = myClient.search()
.byUrl(ourServerBase + "/CarePlan")
.byUrl(myServerBase + "/CarePlan")
.returnBundle(Bundle.class).execute();
// Create and populate list of CarePlans

View File

@ -83,6 +83,7 @@ import org.hl7.fhir.r5.model.Binary;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.CarePlan;
import org.hl7.fhir.r5.model.ChargeItem;
import org.hl7.fhir.r5.model.ClinicalUseDefinition;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Coding;
@ -111,6 +112,7 @@ import org.hl7.fhir.r5.model.Meta;
import org.hl7.fhir.r5.model.MolecularSequence;
import org.hl7.fhir.r5.model.NamingSystem;
import org.hl7.fhir.r5.model.Observation;
import org.hl7.fhir.r5.model.ObservationDefinition;
import org.hl7.fhir.r5.model.OperationDefinition;
import org.hl7.fhir.r5.model.Organization;
import org.hl7.fhir.r5.model.Patient;
@ -161,6 +163,10 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil
@Autowired
protected ITermCodeSystemStorageSvc myTermCodeSystemStorageSvc;
@Autowired
protected IFhirResourceDao<ClinicalUseDefinition> myClinicalUseDefinitionDao;
@Autowired
protected IFhirResourceDao<ObservationDefinition> myObservationDefinitionDao;
@Autowired
@Qualifier("myResourceCountsCache")
protected ResourceCountCache myResourceCountsCache;
@Autowired

View File

@ -7,16 +7,26 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.HasAndListParam;
import ca.uhn.fhir.rest.param.HasOrListParam;
import ca.uhn.fhir.rest.param.HasParam;
import ca.uhn.fhir.rest.param.ReferenceParam;
import ca.uhn.fhir.rest.param.TokenParam;
import org.hamcrest.Matchers;
import org.hl7.fhir.r5.model.ClinicalUseDefinition;
import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.ObservationDefinition;
import org.hl7.fhir.r5.model.Organization;
import org.hl7.fhir.r5.model.Patient;
import org.hl7.fhir.r5.model.Practitioner;
import org.hl7.fhir.r5.model.PractitionerRole;
import org.hl7.fhir.r5.model.Reference;
import org.junit.jupiter.api.Test;
import org.springframework.test.context.ContextConfiguration;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ContextConfiguration(classes = TestHSearchAddInConfig.NoFT.class)
@ -140,4 +150,51 @@ public class FhirResourceDaoR5SearchNoFtTest extends BaseJpaR5Test {
assertEquals(0, outcome.getResources(0, 3).size());
}
@Test
public void testToken_CodeableReference_Reference() {
// Setup
ObservationDefinition obs = new ObservationDefinition();
obs.setApprovalDate(new Date());
String obsId = myObservationDefinitionDao.create(obs, mySrd).getId().toUnqualifiedVersionless().getValue();
ClinicalUseDefinition def = new ClinicalUseDefinition();
def.getContraindication().getDiseaseSymptomProcedure().setReference(new Reference(obsId));
String id = myClinicalUseDefinitionDao.create(def, mySrd).getId().toUnqualifiedVersionless().getValue();
ClinicalUseDefinition def2 = new ClinicalUseDefinition();
def2.getContraindication().getDiseaseSymptomProcedure().setConcept(new CodeableConcept().addCoding(new Coding("http://foo", "bar", "baz")));
myClinicalUseDefinitionDao.create(def2, mySrd).getId().toUnqualifiedVersionless().getValue();
// Test
SearchParameterMap map = SearchParameterMap.newSynchronous(ClinicalUseDefinition.SP_CONTRAINDICATION_REFERENCE, new ReferenceParam(obsId));
List<String> outcome = toUnqualifiedVersionlessIdValues(myClinicalUseDefinitionDao.search(map, mySrd));
assertThat(outcome, Matchers.contains(id));
}
@Test
public void testToken_CodeableReference_Coding() {
// Setup
ObservationDefinition obs = new ObservationDefinition();
obs.setApprovalDate(new Date());
String obsId = myObservationDefinitionDao.create(obs, mySrd).getId().toUnqualifiedVersionless().getValue();
ClinicalUseDefinition def = new ClinicalUseDefinition();
def.getContraindication().getDiseaseSymptomProcedure().setReference(new Reference(obsId));
myClinicalUseDefinitionDao.create(def, mySrd).getId().toUnqualifiedVersionless().getValue();
ClinicalUseDefinition def2 = new ClinicalUseDefinition();
def2.getContraindication().getDiseaseSymptomProcedure().setConcept(new CodeableConcept().addCoding(new Coding("http://foo", "bar", "baz")));
String id =myClinicalUseDefinitionDao.create(def2, mySrd).getId().toUnqualifiedVersionless().getValue();
// Test
SearchParameterMap map = SearchParameterMap.newSynchronous(ClinicalUseDefinition.SP_CONTRAINDICATION, new TokenParam("http://foo", "bar"));
List<String> outcome = toUnqualifiedVersionlessIdValues(myClinicalUseDefinitionDao.search(map, mySrd));
assertThat(outcome, Matchers.contains(id));
}
}

View File

@ -49,7 +49,7 @@ public class AuthorizationInterceptorJpaR5Test extends BaseResourceProviderR5Tes
obsNotInCompartment.setStatus(Enumerations.ObservationStatus.FINAL);
IIdType obsNotInCompartmentId = myClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()
@ -87,7 +87,7 @@ public class AuthorizationInterceptorJpaR5Test extends BaseResourceProviderR5Tes
obsNotInCompartment.setStatus(Enumerations.ObservationStatus.FINAL);
IIdType obsNotInCompartmentId = myClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
myRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) {
return new RuleBuilder()

View File

@ -13,7 +13,6 @@ import ca.uhn.fhir.jpa.provider.ProcessMessageProvider;
import ca.uhn.fhir.jpa.provider.ServerConfiguration;
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
import ca.uhn.fhir.jpa.provider.TerminologyUploaderProvider;
import ca.uhn.fhir.jpa.provider.ValueSetOperationProvider;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
@ -40,24 +39,21 @@ import java.util.List;
@ContextConfiguration(classes = ServerConfiguration.class)
public abstract class BaseResourceProviderR5Test extends BaseJpaR5Test {
protected int myPort;
protected String myServerBase;
protected RestfulServer myRestServer;
protected IGenericClient myClient;
@RegisterExtension
protected static HttpClientExtension ourHttpClient = new HttpClientExtension();
// TODO: JA2 These are no longer static but are named like static. I'm going to
// rename them in a separate PR that only makes that change so that it's easier to review
protected int ourPort;
protected String ourServerBase;
protected RestfulServer ourRestServer;
protected IGenericClient myClient;
@Autowired
@RegisterExtension
protected RestfulServerExtension myServer;
@RegisterExtension
protected RestfulServerConfigurerExtension myServerConfigurer = new RestfulServerConfigurerExtension(() -> myServer)
.withServerBeforeEach(s -> {
.withServerBeforeAll(s -> {
s.registerProviders(myResourceProviders.createProviders());
s.setDefaultResponseEncoding(EncodingEnum.XML);
s.setDefaultPrettyPrint(false);
@ -102,12 +98,11 @@ public abstract class BaseResourceProviderR5Test extends BaseJpaR5Test {
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
s.registerInterceptor(corsInterceptor);
}).withServerBeforeAll(s -> {
// TODO: JA-2 These don't need to be static variables, should just inline all of the uses of these
ourPort = myServer.getPort();
ourServerBase = myServer.getBaseUrl();
}).withServerBeforeEach(s -> {
myPort = myServer.getPort();
myServerBase = myServer.getBaseUrl();
myClient = myServer.getFhirClient();
ourRestServer = myServer.getRestfulServer();
myRestServer = myServer.getRestfulServer();
myClient.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof LoggingInterceptor);
if (shouldLogClient()) {
@ -127,8 +122,8 @@ public abstract class BaseResourceProviderR5Test extends BaseJpaR5Test {
@AfterEach
public void after() throws Exception {
myFhirCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE);
if (ourRestServer != null) {
ourRestServer.getInterceptorService().unregisterAllInterceptors();
if (myRestServer != null) {
myRestServer.getInterceptorService().unregisterAllInterceptors();
}
}

View File

@ -213,7 +213,7 @@ public class ResourceProviderR5Test extends BaseResourceProviderR5Test {
public void testValidateGeneratedCapabilityStatement() throws IOException {
String input;
HttpGet get = new HttpGet(ourServerBase + "/metadata?_format=json");
HttpGet get = new HttpGet(myServerBase + "/metadata?_format=json");
try (CloseableHttpResponse resp = ourHttpClient.execute(get)) {
assertEquals(200, resp.getStatusLine().getStatusCode());
input = IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8);
@ -221,7 +221,7 @@ public class ResourceProviderR5Test extends BaseResourceProviderR5Test {
}
HttpPost post = new HttpPost(ourServerBase + "/CapabilityStatement/$validate?_pretty=true");
HttpPost post = new HttpPost(myServerBase + "/CapabilityStatement/$validate?_pretty=true");
post.setEntity(new StringEntity(input, ContentType.APPLICATION_JSON));
try (CloseableHttpResponse resp = ourHttpClient.execute(post)) {
@ -360,7 +360,7 @@ public class ResourceProviderR5Test extends BaseResourceProviderR5Test {
ourLog.info("Observation: \n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(obs));
}
String uri = ourServerBase + "/Observation?_sort=combo-code-value-quantity";
String uri = myServerBase + "/Observation?_sort=combo-code-value-quantity";
Bundle found;
HttpGet get = new HttpGet(uri);
@ -492,7 +492,7 @@ public class ResourceProviderR5Test extends BaseResourceProviderR5Test {
// GET CarePlans from server
Bundle bundle = myClient.search()
.byUrl(ourServerBase + "/CarePlan")
.byUrl(myServerBase + "/CarePlan")
.returnBundle(Bundle.class).execute();
// Create and populate list of CarePlans

View File

@ -1003,7 +1003,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
@Test
public void testInvalidFilter() throws Exception {
String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8);
HttpPost post = new HttpPost(ourServerBase + "/ValueSet/%24expand");
HttpPost post = new HttpPost(myServerBase + "/ValueSet/%24expand");
post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW)));
try (CloseableHttpResponse resp = ourHttpClient.execute(post)) {
@ -1154,7 +1154,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
createLocalCsAndVs();
createLocalVsWithIncludeConcept();
String url = ourServerBase +
String url = myServerBase +
"/ValueSet/" + myLocalValueSetId.getIdPart() + "/$validate-code?system=" +
UrlUtil.escapeUrlParam(URL_MY_CODE_SYSTEM) +
"&code=AA";
@ -1175,7 +1175,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
createLocalCsAndVs();
createLocalVsWithIncludeConcept();
String url = ourServerBase +
String url = myServerBase +
"/ValueSet/" + myLocalValueSetId.getIdPart() + "/$validate-code?system=" +
UrlUtil.escapeUrlParam(URL_MY_CODE_SYSTEM) +
"&code=AA";
@ -1283,14 +1283,14 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
.setValue("ParentA");
IIdType vsId = myValueSetDao.create(vs).getId().toUnqualifiedVersionless();
HttpGet expandGet = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$expand?_pretty=true");
HttpGet expandGet = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$expand?_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(expandGet)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
assertThat(response, containsString("<display value=\"Child AA\"/>"));
}
HttpGet validateCodeGet = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=ChildAA&_pretty=true");
HttpGet validateCodeGet = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=ChildAA&_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(validateCodeGet)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
@ -1298,7 +1298,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
assertEquals(true, output.getParameterBool("result"));
}
HttpGet validateCodeGet2 = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=FOO&_pretty=true");
HttpGet validateCodeGet2 = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=FOO&_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(validateCodeGet2)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
@ -1309,13 +1309,13 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
// Now do a pre-expansion
myTermSvc.preExpandDeferredValueSetsToTerminologyTables();
expandGet = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$expand?_pretty=true");
expandGet = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$expand?_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(expandGet)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
}
validateCodeGet = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=ChildAA&_pretty=true");
validateCodeGet = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=ChildAA&_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(validateCodeGet)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);
@ -1323,7 +1323,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test {
assertEquals(true, output.getParameterBool("result"));
}
validateCodeGet2 = new HttpGet(ourServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=FOO&_pretty=true");
validateCodeGet2 = new HttpGet(myServerBase + "/ValueSet/" + vsId.getIdPart() + "/$validate-code?system=http://mycs&code=FOO&_pretty=true");
try (CloseableHttpResponse status = ourHttpClient.execute(validateCodeGet2)) {
String response = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
ourLog.info("Response: {}", response);

View File

@ -36,7 +36,7 @@ public class ServerR5Test extends BaseResourceProviderR5Test {
@Test
@Disabled
public void testCapabilityStatementValidates() throws IOException {
HttpGet get = new HttpGet(ourServerBase + "/metadata?_pretty=true&_format=json");
HttpGet get = new HttpGet(myServerBase + "/metadata?_pretty=true&_format=json");
try (CloseableHttpResponse resp = ourHttpClient.execute(get)) {
assertEquals(200, resp.getStatusLine().getStatusCode());
String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8);
@ -60,7 +60,7 @@ public class ServerR5Test extends BaseResourceProviderR5Test {
*/
@Test
public void saveIdParamOnlyAppearsOnce() throws IOException {
HttpGet get = new HttpGet(ourServerBase + "/metadata?_pretty=true&_format=xml");
HttpGet get = new HttpGet(myServerBase + "/metadata?_pretty=true&_format=xml");
CloseableHttpResponse resp = ourHttpClient.execute(get);
try {
ourLog.info(resp.toString());

View File

@ -62,22 +62,16 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test {
@RegisterExtension
protected static HttpClientExtension ourHttpClient = new HttpClientExtension();
// TODO: JA2 These are no longer static but are named like static. I'm going to
// rename them in a separate PR that only makes that change so that it's easier to review
protected int ourPort;
protected String ourServerBase;
protected IGenericClient ourClient;
protected RestfulServer ourRestServer;
protected int myPort;
protected String myServerBase;
protected IGenericClient myClient;
@Autowired
@RegisterExtension
protected RestfulServerExtension myServer;
@RegisterExtension
protected RestfulServerConfigurerExtension myServerConfigurer = new RestfulServerConfigurerExtension(() -> myServer)
.withServerBeforeEach(s -> {
.withServerBeforeAll(s -> {
s.registerProviders(myResourceProviders.createProviders());
s.setDefaultResponseEncoding(EncodingEnum.XML);
s.setDefaultPrettyPrint(false);
@ -120,17 +114,14 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test {
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
s.registerInterceptor(corsInterceptor);
}).withServerBeforeAll(s -> {
// TODO: JA-2 These don't need to be static variables, should just inline all of the uses of these
ourPort = myServer.getPort();
ourServerBase = myServer.getBaseUrl();
ourClient = myServer.getFhirClient();
}).withServerBeforeEach(s -> {
myPort = myServer.getPort();
myServerBase = myServer.getBaseUrl();
myClient = myServer.getFhirClient();
ourRestServer = myServer.getRestfulServer();
ourClient.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof LoggingInterceptor);
myClient.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof LoggingInterceptor);
if (shouldLogClient()) {
ourClient.registerInterceptor(new LoggingInterceptor());
myClient.registerInterceptor(new LoggingInterceptor());
}
});
@Autowired
@ -149,7 +140,7 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test {
@AfterEach
public void after() throws Exception {
myFhirContext.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE);
ourRestServer.getInterceptorService().unregisterAllInterceptors();
myServer.getRestfulServer().getInterceptorService().unregisterAllInterceptors();
}
protected boolean shouldLogClient() {

View File

@ -39,6 +39,7 @@ import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
import ca.uhn.fhir.jpa.dao.data.IResourceHistoryTableDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedComboTokensNonUniqueDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamDateDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamNumberDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamStringDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamTokenDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamUriDao;
@ -202,6 +203,8 @@ public abstract class BaseJpaTest extends BaseTest {
@Autowired
protected IResourceIndexedSearchParamTokenDao myResourceIndexedSearchParamTokenDao;
@Autowired
protected IResourceIndexedSearchParamNumberDao myResourceIndexedSearchParamNumberDao;
@Autowired
protected IResourceIndexedSearchParamUriDao myResourceIndexedSearchParamUriDao;
@Autowired
protected IResourceIndexedSearchParamStringDao myResourceIndexedSearchParamStringDao;
@ -428,6 +431,12 @@ public abstract class BaseJpaTest extends BaseTest {
});
}
protected void logAllNumberIndexes() {
runInTransaction(() -> {
ourLog.info("Number indexes:\n * {}", myResourceIndexedSearchParamNumberDao.findAll().stream().map(t -> t.toString()).collect(Collectors.joining("\n * ")));
});
}
protected void logAllUriIndexes() {
runInTransaction(() -> {
ourLog.info("URI indexes:\n * {}", myResourceIndexedSearchParamUriDao.findAll().stream().map(t -> t.toString()).collect(Collectors.joining("\n * ")));

View File

@ -1,8 +1,13 @@
package ca.uhn.fhir.rest.server;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor;
import ca.uhn.fhir.interceptor.api.IPointcut;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.rest.annotation.Transaction;
import ca.uhn.fhir.rest.annotation.TransactionParam;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
import ca.uhn.fhir.test.utilities.server.ResourceProviderExtension;
import ca.uhn.fhir.test.utilities.server.RestfulServerExtension;
import com.google.common.base.Charsets;
@ -18,6 +23,8 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
@ -29,15 +36,37 @@ import java.io.InputStream;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.notNullValue;
public class BlockingContentR4Test {
private static final Logger ourLog = LoggerFactory.getLogger(BlockingContentR4Test.class);
private static FhirContext ourCtx = FhirContext.forR4();
private static FhirContext ourCtx = FhirContext.forR4Cached();
@RegisterExtension
public static RestfulServerExtension ourServerRule = new RestfulServerExtension(ourCtx);
public static RestfulServerExtension ourServerRule = new RestfulServerExtension(ourCtx)
.withIdleTimeout(5000);
@RegisterExtension
public ResourceProviderExtension myPatientProviderRule = new ResourceProviderExtension(ourServerRule, new SystemProvider());
private volatile BaseServerResponseException myServerException;
private IAnonymousInterceptor myErrorCaptureInterceptor;
@BeforeEach
public void beforeEach() {
myErrorCaptureInterceptor = (thePointcut, theArgs) -> myServerException = theArgs.get(BaseServerResponseException.class);
ourServerRule.registerAnonymousInterceptor(Pointcut.SERVER_HANDLE_EXCEPTION, myErrorCaptureInterceptor);
}
@AfterEach
public void afterEach() {
ourServerRule.unregisterInterceptor(myErrorCaptureInterceptor);
}
/**
* This test is just verifying that a client that is using an HTTP 100 continue followed
* by a network timeout generates a useful error message.
*/
@Test
public void testCreateWith100Continue() throws Exception {
Patient patient = new Patient();
@ -56,7 +85,6 @@ public class BlockingContentR4Test {
String resourceAsString = ourCtx.newJsonParser().encodeResourceToString(input);
// InputStream inputStream = new BlockingInputStream(resourceAsString.getBytes(Charsets.UTF_8));
byte[] bytes = resourceAsString.getBytes(Charsets.UTF_8);
InputStream inputStream = new ByteArrayInputStream(bytes);
HttpEntity entity = new InputStreamEntity(inputStream, ContentType.parse("application/fhir+json")){
@ -71,31 +99,11 @@ public class BlockingContentR4Test {
try (CloseableHttpResponse resp = client.execute(post)) {
ourLog.info(Arrays.asList(resp.getAllHeaders()).toString().replace(", ", "\n"));
ourLog.info(resp.toString());
ourLog.info(IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8));
await().until(()->myServerException, notNullValue());
}
}
}
assertThat(myServerException.toString(), containsString("Idle timeout expired"));
private static class BlockingInputStream extends InputStream {
private final ByteArrayInputStream myWrap;
private int myByteCount = 0;
public BlockingInputStream(byte[] theBytes) {
myWrap = new ByteArrayInputStream(theBytes);
}
@Override
public int read() throws IOException {
if (myByteCount++ == 10) {
ourLog.info("About to block...");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
ourLog.warn("Interrupted", e);
}
}
return myWrap.read();
}
}

View File

@ -82,6 +82,20 @@ public abstract class BaseJettyServerExtension<T extends BaseJettyServerExtensio
private AtomicLong myConnectionsOpenedCounter;
private Class<? extends WebSocketConfigurer> myEnableSpringWebsocketSupport;
private String myEnableSpringWebsocketContextPath;
private long myIdleTimeoutMillis = 30000;
/**
* Sets the Jetty server "idle timeout" in millis. This is the amount of time that
* the HTTP processor will allow a request to take before it hangs up on the
* client. This means the amount of time receiving the request over the network or
* streaming the response, not the amount of time spent actually processing the
* request (ie this is a network timeout, not a CPU timeout). Default is
* 30000.
*/
public T withIdleTimeout(long theIdleTimeoutMillis) {
myIdleTimeoutMillis = theIdleTimeoutMillis;
return (T) this;
}
@SuppressWarnings("unchecked")
public T withContextPath(String theContextPath) {
@ -135,6 +149,7 @@ public abstract class BaseJettyServerExtension<T extends BaseJettyServerExtensio
myConnectionsOpenedCounter = new AtomicLong(0);
ServerConnector connector = new ServerConnector(myServer);
connector.setIdleTimeout(myIdleTimeoutMillis);
connector.setPort(myPort);
myServer.setConnectors(new Connector[]{connector});

View File

@ -39,8 +39,8 @@ public class RestfulServerConfigurerExtension implements BeforeEachCallback {
private Supplier<RestfulServerExtension> myRestfulServerExtensionSupplier;
private RestfulServerExtension myRestfulServerExtension;
private final List<Consumer<RestfulServer>> myBeforeEachConsumers = new ArrayList<>();
private final List<Consumer<RestfulServer>> myBeforeAllConsumers = new ArrayList<>();
private final List<Consumer<RestfulServer>> myBeforeEachConsumers = new ArrayList<>();
/**
* Constructor
@ -61,18 +61,18 @@ public class RestfulServerConfigurerExtension implements BeforeEachCallback {
/**
* This callback will be invoked once after the server has started
*/
public RestfulServerConfigurerExtension withServerBeforeEach(Consumer<RestfulServer> theServer) {
public RestfulServerConfigurerExtension withServerBeforeAll(Consumer<RestfulServer> theServer) {
Assert.notNull(theServer, "theServer must not be null");
myBeforeEachConsumers.add(theServer);
myBeforeAllConsumers.add(theServer);
return this;
}
/**
* This callback will be invoked before each test but after the server has started
*/
public RestfulServerConfigurerExtension withServerBeforeAll(Consumer<RestfulServer> theServer) {
public RestfulServerConfigurerExtension withServerBeforeEach(Consumer<RestfulServer> theServer) {
Assert.notNull(theServer, "theServer must not be null");
myBeforeAllConsumers.add(theServer);
myBeforeEachConsumers.add(theServer);
return this;
}
@ -86,13 +86,13 @@ public class RestfulServerConfigurerExtension implements BeforeEachCallback {
if (!myRestfulServerExtension.getRunningServerUserData().containsKey(key)) {
myRestfulServerExtension.getRunningServerUserData().put(key, key);
for (Consumer<RestfulServer> next : myBeforeEachConsumers) {
for (Consumer<RestfulServer> next : myBeforeAllConsumers) {
myRestfulServerExtension.withServer(next::accept);
}
}
// Every time
for (Consumer<RestfulServer> next : myBeforeAllConsumers) {
for (Consumer<RestfulServer> next : myBeforeEachConsumers) {
myRestfulServerExtension.withServer(next::accept);
}
}

View File

@ -22,6 +22,9 @@ package ca.uhn.fhir.test.utilities.server;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
import ca.uhn.fhir.rest.server.IPagingProvider;
@ -192,4 +195,19 @@ public class RestfulServerExtension extends BaseJettyServerExtension<RestfulServ
withServer(t -> t.unregisterProvider(theProvider));
}
public Integer getDefaultPageSize() {
return myServlet.getDefaultPageSize();
}
public void setDefaultPageSize(Integer theInitialDefaultPageSize) {
myServlet.setDefaultPageSize(theInitialDefaultPageSize);
}
public IInterceptorService getInterceptorService() {
return myServlet.getInterceptorService();
}
public RestfulServerExtension registerAnonymousInterceptor(Pointcut thePointcut, IAnonymousInterceptor theInterceptor) {
return withServer(t -> t.getInterceptorService().registerAnonymousInterceptor(thePointcut, theInterceptor));
}
}