Add some tests
This commit is contained in:
parent
d375977410
commit
f58a03dacf
|
@ -373,6 +373,11 @@ public class DaoConfig {
|
||||||
* This feature may be enabled on servers where supporting the use of the :missing parameter is
|
* This feature may be enabled on servers where supporting the use of the :missing parameter is
|
||||||
* of higher importance than raw write performance
|
* of higher importance than raw write performance
|
||||||
* </p>
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* Note that this setting also has an impact on sorting (i.e. using the
|
||||||
|
* <code>_sort</code> parameter on searches): If the server is configured
|
||||||
|
* to not index missing field.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public void setIndexMissingFields(IndexEnabledEnum theIndexMissingFields) {
|
public void setIndexMissingFields(IndexEnabledEnum theIndexMissingFields) {
|
||||||
Validate.notNull(theIndexMissingFields, "theIndexMissingFields must not be null");
|
Validate.notNull(theIndexMissingFields, "theIndexMissingFields must not be null");
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
|
||||||
retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseDstu2");
|
retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseDstu2");
|
||||||
retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseDstu2");
|
retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseDstu2");
|
||||||
retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
|
retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
|
||||||
|
retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
|
||||||
retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseDstu3");
|
retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseDstu3");
|
||||||
retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseDstu3");
|
retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseDstu3");
|
||||||
retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
|
retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
|
||||||
|
retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,27 @@ public class JsonParserDstu2Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParseEmptyString() {
|
||||||
|
try {
|
||||||
|
String tmp = "{\"resourceType\":\"Bundle\",\"entry\":[{\"fullUrl\":\"\",\"resource\":{\"resourceType\":\"Patient\",\"id\":\"patxuzos\"}}]}";
|
||||||
|
ourCtx.getParserOptions().setOverrideResourceIdWithBundleEntryFullUrl(false);
|
||||||
|
ca.uhn.fhir.model.dstu2.resource.Bundle bundle = (ca.uhn.fhir.model.dstu2.resource.Bundle) ourCtx.newJsonParser().parseResource(tmp);
|
||||||
|
assertEquals(1, bundle.getEntry().size());
|
||||||
|
{
|
||||||
|
Patient o1 = (Patient) bundle.getEntry().get(0).getResource();
|
||||||
|
IIdType o1Id = o1.getIdElement();
|
||||||
|
assertFalse(o1Id.hasBaseUrl());
|
||||||
|
assertEquals("Patient", o1Id.getResourceType());
|
||||||
|
assertEquals("patxuzos", o1Id.getIdPart());
|
||||||
|
assertFalse(o1Id.hasVersionIdPart());
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
// ensure we cleanup ourCtx so other tests continue to work
|
||||||
|
ourCtx = FhirContext.forDstu2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOverrideResourceIdWithBundleEntryFullUrlDisabled_ConfiguredOnParser() {
|
public void testOverrideResourceIdWithBundleEntryFullUrlDisabled_ConfiguredOnParser() {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue