Add 4.0.0 version enum

This commit is contained in:
James Agnew 2019-05-30 20:59:23 -04:00
parent 50a8c66bf5
commit f2be9f47a0
3 changed files with 41 additions and 8 deletions

View File

@ -30,6 +30,7 @@ public enum VersionEnum {
V3_5_0, V3_5_0,
V3_6_0, V3_6_0,
V3_7_0, V3_7_0,
V3_8_0 V3_8_0,
V4_0_0
} }

View File

@ -2,8 +2,8 @@ package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.entity.Search;
import ca.uhn.fhir.jpa.model.search.SearchStatusEnum;
import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.search.SearchStatusEnum;
import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.SearchTotalModeEnum; import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
@ -588,6 +588,24 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test {
} }
@Test
public void testSearchForTokenValueOnlyUsesValueHash() {
myCaptureQueriesListener.clear();
SearchParameterMap params = new SearchParameterMap();
params.add(Patient.SP_IDENTIFIER, new TokenParam("PT00000"));
IBundleProvider results = myPatientDao.search(params);
results.getResources(0, 1); // won't return anything
myCaptureQueriesListener.logSelectQueries();
String selectQuery = myCaptureQueriesListener.getSelectQueries().get(1).getSql(true, true);
assertThat(selectQuery, containsString("HASH_VALUE in"));
assertThat(selectQuery, not(containsString("HASH_SYS")));
}
/** /**
* A search with a big list of OR clauses for references should use a single SELECT ... WHERE .. IN * A search with a big list of OR clauses for references should use a single SELECT ... WHERE .. IN
@ -777,7 +795,6 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test {
}); });
myCaptureQueriesListener.clear(); myCaptureQueriesListener.clear();
p = new Patient(); p = new Patient();
p.setId(id); p.setId(id);
@ -956,16 +973,15 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test {
} }
@Test @Test
public void testReferenceOrLinksUseInList_ForcedIds() { public void testReferenceOrLinksUseInList_ForcedIds() {
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
Organization org = new Organization(); Organization org = new Organization();
org.setId("ORG"+i); org.setId("ORG" + i);
org.setActive(true); org.setActive(true);
runInTransaction(()->{ runInTransaction(() -> {
IIdType id = myOrganizationDao.update(org).getId(); IIdType id = myOrganizationDao.update(org).getId();
ids.add(id.getIdPart()); ids.add(id.getIdPart());
}); });
@ -974,14 +990,13 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test {
// assertTrue(org.getActive()); // assertTrue(org.getActive());
} }
runInTransaction(()->{ runInTransaction(() -> {
for (ResourceTable next : myResourceTableDao.findAll()) { for (ResourceTable next : myResourceTableDao.findAll()) {
ourLog.info("Resource pid {} of type {}", next.getId(), next.getResourceType()); ourLog.info("Resource pid {} of type {}", next.getId(), next.getResourceType());
} }
}); });
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
Patient pt = new Patient(); Patient pt = new Patient();
pt.setManagingOrganization(new Reference("Organization/" + ids.get(i))); pt.setManagingOrganization(new Reference("Organization/" + ids.get(i)));

View File

@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.entity.Search;
import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable; import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable;
import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.util.JpaConstants; import ca.uhn.fhir.jpa.util.JpaConstants;
import ca.uhn.fhir.jpa.util.TestUtil; import ca.uhn.fhir.jpa.util.TestUtil;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum; import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
@ -14,6 +15,7 @@ import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.parser.StrictErrorHandler;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.*; import ca.uhn.fhir.rest.api.*;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.client.api.IClientInterceptor; import ca.uhn.fhir.rest.client.api.IClientInterceptor;
import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.api.IHttpRequest; import ca.uhn.fhir.rest.client.api.IHttpRequest;
@ -112,6 +114,21 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds());
} }
@Test
public void testSearchForTokenValueOnlyUsesValueHash() {
myCaptureQueriesListener.clear();
ourClient
.loadPage()
.byUrl(ourServerBase + "/Practitioner?identifier=" + UrlUtil.escapeUrlParam("ABC|,DEF"))
.andReturnBundle(Bundle.class)
.execute();
myCaptureQueriesListener.logSelectQueries();
}
@Test @Test
public void testSearchWithContainsLowerCase() { public void testSearchWithContainsLowerCase() {
myDaoConfig.setAllowContainsSearches(true); myDaoConfig.setAllowContainsSearches(true);