Add a bit more test logging
This commit is contained in:
parent
471335341a
commit
4c84b8fc89
|
@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.entity;
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
|
@ -208,142 +208,6 @@ public class FhirResourceDaoDstu3UniqueSearchParamTest extends BaseJpaDstu3Test
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testIndexTransactionWithMatchUrl() {
|
|
||||||
Patient pt2 = new Patient();
|
|
||||||
pt2.setGender(Enumerations.AdministrativeGender.MALE);
|
|
||||||
pt2.setBirthDateElement(new DateType("2011-01-02"));
|
|
||||||
IIdType id2 = myPatientDao.create(pt2).getId().toUnqualifiedVersionless();
|
|
||||||
|
|
||||||
Coverage cov = new Coverage();
|
|
||||||
cov.getBeneficiary().setReference(id2.getValue());
|
|
||||||
cov.addIdentifier().setSystem("urn:foo:bar").setValue("123");
|
|
||||||
IIdType id3 = myCoverageDao.create(cov).getId().toUnqualifiedVersionless();
|
|
||||||
|
|
||||||
createUniqueIndexCoverageBeneficiary();
|
|
||||||
|
|
||||||
myResourceReindexingSvc.markAllResourcesForReindexing();
|
|
||||||
myResourceReindexingSvc.forceReindexingPass();
|
|
||||||
myResourceReindexingSvc.forceReindexingPass();
|
|
||||||
|
|
||||||
List<ResourceIndexedCompositeStringUnique> uniques = myResourceIndexedCompositeStringUniqueDao.findAll();
|
|
||||||
assertEquals(uniques.toString(), 1, uniques.size());
|
|
||||||
assertEquals("Coverage/" + id3.getIdPart(), uniques.get(0).getResource().getIdDt().toUnqualifiedVersionless().getValue());
|
|
||||||
assertEquals("Coverage?beneficiary=Patient%2F" + id2.getIdPart() + "&identifier=urn%3Afoo%3Abar%7C123", uniques.get(0).getIndexString());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testIndexTransactionWithMatchUrl2() {
|
|
||||||
createUniqueIndexCoverageBeneficiary();
|
|
||||||
|
|
||||||
String input = "{\n" +
|
|
||||||
" \"resourceType\": \"Bundle\",\n" +
|
|
||||||
" \"type\": \"transaction\",\n" +
|
|
||||||
" \"entry\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"fullUrl\": \"urn:uuid:d2a46176-8e15-405d-bbda-baea1a9dc7f3\",\n" +
|
|
||||||
" \"resource\": {\n" +
|
|
||||||
" \"resourceType\": \"Patient\",\n" +
|
|
||||||
" \"identifier\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"use\": \"official\",\n" +
|
|
||||||
" \"type\": {\n" +
|
|
||||||
" \"coding\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"system\": \"http://hl7.org/fhir/v2/0203\",\n" +
|
|
||||||
" \"code\": \"MR\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ]\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"system\": \"FOOORG:FOOSITE:patientid:MR:R\",\n" +
|
|
||||||
" \"value\": \"007811959\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ]\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"request\": {\n" +
|
|
||||||
" \"method\": \"PUT\",\n" +
|
|
||||||
" \"url\": \"/Patient?identifier=FOOORG%3AFOOSITE%3Apatientid%3AMR%3AR%7C007811959%2CFOOORG%3AFOOSITE%3Apatientid%3AMR%3AB%7C000929990%2CFOOORG%3AFOOSITE%3Apatientid%3API%3APH%7C00589363%2Chttp%3A%2F%2Fhl7.org%2Ffhir%2Fsid%2Fus-ssn%7C657-01-8133\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" },\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"fullUrl\": \"urn:uuid:b58ff639-11d1-4dac-942f-abf4f9a625d7\",\n" +
|
|
||||||
" \"resource\": {\n" +
|
|
||||||
" \"resourceType\": \"Coverage\",\n" +
|
|
||||||
" \"identifier\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"system\": \"FOOORG:FOOSITE:coverage:planId\",\n" +
|
|
||||||
" \"value\": \"0403-010101\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ],\n" +
|
|
||||||
" \"beneficiary\": {\n" +
|
|
||||||
" \"reference\": \"urn:uuid:d2a46176-8e15-405d-bbda-baea1a9dc7f3\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"request\": {\n" +
|
|
||||||
" \"method\": \"PUT\",\n" +
|
|
||||||
" \"url\": \"/Coverage?beneficiary=urn%3Auuid%3Ad2a46176-8e15-405d-bbda-baea1a9dc7f3&identifier=FOOORG%3AFOOSITE%3Acoverage%3AplanId%7C0403-010101\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" },\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"fullUrl\": \"urn:uuid:13f5da1a-6601-4c1a-82c9-41527be23fa0\",\n" +
|
|
||||||
" \"resource\": {\n" +
|
|
||||||
" \"resourceType\": \"Coverage\",\n" +
|
|
||||||
" \"contained\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"resourceType\": \"RelatedPerson\",\n" +
|
|
||||||
" \"id\": \"1\",\n" +
|
|
||||||
" \"name\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"family\": \"SMITH\",\n" +
|
|
||||||
" \"given\": [\n" +
|
|
||||||
" \"FAKER\"\n" +
|
|
||||||
" ]\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ]\n" +
|
|
||||||
" },\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"resourceType\": \"Organization\",\n" +
|
|
||||||
" \"id\": \"2\",\n" +
|
|
||||||
" \"name\": \"MEDICAID\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ],\n" +
|
|
||||||
" \"identifier\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"system\": \"FOOORG:FOOSITE:coverage:planId\",\n" +
|
|
||||||
" \"value\": \"0404-010101\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ],\n" +
|
|
||||||
" \"policyHolder\": {\n" +
|
|
||||||
" \"reference\": \"#1\"\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"beneficiary\": {\n" +
|
|
||||||
" \"reference\": \"urn:uuid:d2a46176-8e15-405d-bbda-baea1a9dc7f3\"\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"payor\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"reference\": \"#2\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ]\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"request\": {\n" +
|
|
||||||
" \"method\": \"PUT\",\n" +
|
|
||||||
" \"url\": \"/Coverage?beneficiary=urn%3Auuid%3Ad2a46176-8e15-405d-bbda-baea1a9dc7f3&identifier=FOOORG%3AFOOSITE%3Acoverage%3AplanId%7C0404-010101\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ]\n" +
|
|
||||||
"}";
|
|
||||||
|
|
||||||
Bundle inputBundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
|
|
||||||
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(inputBundle));
|
|
||||||
mySystemDao.transaction(mySrd, inputBundle);
|
|
||||||
|
|
||||||
inputBundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
|
|
||||||
mySystemDao.transaction(mySrd, inputBundle);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReplaceOneWithAnother() {
|
public void testReplaceOneWithAnother() {
|
||||||
createUniqueBirthdateAndGenderSps();
|
createUniqueBirthdateAndGenderSps();
|
||||||
|
@ -473,38 +337,6 @@ public class FhirResourceDaoDstu3UniqueSearchParamTest extends BaseJpaDstu3Test
|
||||||
assertEquals("Patient?birthdate=2011-01-01&gender=http%3A%2F%2Fhl7.org%2Ffhir%2Fadministrative-gender%7Cmale", uniques.get(0).getIndexString());
|
assertEquals("Patient?birthdate=2011-01-01&gender=http%3A%2F%2Fhl7.org%2Ffhir%2Fadministrative-gender%7Cmale", uniques.get(0).getIndexString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUniqueValuesAreIndexed_StringAndReference() {
|
|
||||||
createUniqueNameAndManagingOrganizationSps();
|
|
||||||
|
|
||||||
Organization org = new Organization();
|
|
||||||
org.setId("Organization/ORG");
|
|
||||||
org.setName("ORG");
|
|
||||||
myOrganizationDao.update(org);
|
|
||||||
|
|
||||||
Patient pt1 = new Patient();
|
|
||||||
pt1.addName()
|
|
||||||
.setFamily("FAMILY1")
|
|
||||||
.addGiven("GIVEN1")
|
|
||||||
.addGiven("GIVEN2")
|
|
||||||
.addGiven("GIVEN2"); // GIVEN2 happens twice
|
|
||||||
pt1.setManagingOrganization(new Reference("Organization/ORG"));
|
|
||||||
IIdType id1 = myPatientDao.create(pt1).getId().toUnqualifiedVersionless();
|
|
||||||
|
|
||||||
List<ResourceIndexedCompositeStringUnique> uniques = myResourceIndexedCompositeStringUniqueDao.findAll();
|
|
||||||
Collections.sort(uniques);
|
|
||||||
|
|
||||||
assertEquals(3, uniques.size());
|
|
||||||
assertEquals("Patient/" + id1.getIdPart(), uniques.get(0).getResource().getIdDt().toUnqualifiedVersionless().getValue());
|
|
||||||
assertEquals("Patient?name=FAMILY1&organization=Organization%2FORG", uniques.get(0).getIndexString());
|
|
||||||
|
|
||||||
assertEquals("Patient/" + id1.getIdPart(), uniques.get(1).getResource().getIdDt().toUnqualifiedVersionless().getValue());
|
|
||||||
assertEquals("Patient?name=GIVEN1&organization=Organization%2FORG", uniques.get(1).getIndexString());
|
|
||||||
|
|
||||||
assertEquals("Patient/" + id1.getIdPart(), uniques.get(2).getResource().getIdDt().toUnqualifiedVersionless().getValue());
|
|
||||||
assertEquals("Patient?name=GIVEN2&organization=Organization%2FORG", uniques.get(2).getIndexString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClassClearContext() {
|
public static void afterClassClearContext() {
|
||||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||||
|
|
|
@ -557,11 +557,12 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
|
||||||
|
|
||||||
createUniqueIndexCoverageBeneficiary();
|
createUniqueIndexCoverageBeneficiary();
|
||||||
|
|
||||||
myResourceReindexingSvc.markAllResourcesForReindexing();
|
myResourceReindexingSvc.markAllResourcesForReindexing("Coverage");
|
||||||
myResourceReindexingSvc.forceReindexingPass();
|
assertEquals(1, myResourceReindexingSvc.forceReindexingPass());
|
||||||
myResourceReindexingSvc.forceReindexingPass();
|
assertEquals(0, myResourceReindexingSvc.forceReindexingPass());
|
||||||
|
|
||||||
List<ResourceIndexedCompositeStringUnique> uniques = myResourceIndexedCompositeStringUniqueDao.findAll();
|
List<ResourceIndexedCompositeStringUnique> uniques = myResourceIndexedCompositeStringUniqueDao.findAll();
|
||||||
|
ourLog.info("** Uniques: {}", uniques);
|
||||||
assertEquals(uniques.toString(), 1, uniques.size());
|
assertEquals(uniques.toString(), 1, uniques.size());
|
||||||
assertEquals("Coverage/" + id3.getIdPart(), uniques.get(0).getResource().getIdDt().toUnqualifiedVersionless().getValue());
|
assertEquals("Coverage/" + id3.getIdPart(), uniques.get(0).getResource().getIdDt().toUnqualifiedVersionless().getValue());
|
||||||
assertEquals("Coverage?beneficiary=Patient%2F" + id2.getIdPart() + "&identifier=urn%3Afoo%3Abar%7C123", uniques.get(0).getIndexString());
|
assertEquals("Coverage?beneficiary=Patient%2F" + id2.getIdPart() + "&identifier=urn%3Afoo%3Abar%7C123", uniques.get(0).getIndexString());
|
||||||
|
|
Loading…
Reference in New Issue