Perf work
This commit is contained in:
parent
1d9e0dc4cc
commit
fbbe792726
|
@ -315,7 +315,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
|
||||||
ourLog.info("Completed search for {} resources in {}ms", mySyncedPids.size(), sw.getMillis());
|
ourLog.info("Completed search for {} resources in {}ms", mySyncedPids.size(), sw.getMillis());
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
ourLog.error("Failed during search loading after {}ms", t, sw.getMillis());
|
ourLog.error("Failed during search loading after {}ms", sw.getMillis(), t);
|
||||||
myUnsyncedPids.clear();
|
myUnsyncedPids.clear();
|
||||||
|
|
||||||
mySearch.setStatus(SearchStatusEnum.FAILED);
|
mySearch.setStatus(SearchStatusEnum.FAILED);
|
||||||
|
|
|
@ -29,6 +29,9 @@ import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
|
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
|
||||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
|
@ -72,7 +75,6 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchForExtension() {
|
public void testSearchForExtension() {
|
||||||
SearchParameter eyeColourSp = new SearchParameter();
|
SearchParameter eyeColourSp = new SearchParameter();
|
||||||
|
@ -87,12 +89,12 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
|
||||||
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(eyeColourSp));
|
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(eyeColourSp));
|
||||||
|
|
||||||
ourClient
|
ourClient
|
||||||
.create()
|
.create()
|
||||||
.resource(eyeColourSp)
|
.resource(eyeColourSp)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
// mySearchParamRegsitry.forceRefresh();
|
// mySearchParamRegsitry.forceRefresh();
|
||||||
|
|
||||||
Patient p1 = new Patient();
|
Patient p1 = new Patient();
|
||||||
p1.setActive(true);
|
p1.setActive(true);
|
||||||
p1.addExtension().setUrl("http://acme.org/eyecolour").setValue(new CodeType("blue"));
|
p1.addExtension().setUrl("http://acme.org/eyecolour").setValue(new CodeType("blue"));
|
||||||
|
@ -106,21 +108,21 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
|
||||||
IIdType p2id = myPatientDao.create(p2).getId().toUnqualifiedVersionless();
|
IIdType p2id = myPatientDao.create(p2).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
Bundle bundle = ourClient
|
Bundle bundle = ourClient
|
||||||
.search()
|
.search()
|
||||||
.forResource(Patient.class)
|
.forResource(Patient.class)
|
||||||
.where(new TokenClientParam("eyecolour").exactly().code("blue"))
|
.where(new TokenClientParam("eyecolour").exactly().code("blue"))
|
||||||
.returnBundle(Bundle.class)
|
.returnBundle(Bundle.class)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(bundle));
|
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(bundle));
|
||||||
|
|
||||||
List<String> foundResources = toUnqualifiedVersionlessIdValues(bundle);
|
List<String> foundResources = toUnqualifiedVersionlessIdValues(bundle);
|
||||||
assertThat(foundResources, contains(p1id.getValue()));
|
assertThat(foundResources, contains(p1id.getValue()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderCustomSearchParamDstu3Test.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderCustomSearchParamDstu3Test.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Before
|
@Before
|
||||||
public void beforeResetConfig() {
|
public void beforeResetConfig() {
|
||||||
|
@ -146,29 +148,45 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
|
||||||
param = map.get("gender");
|
param = map.get("gender");
|
||||||
assertNotNull(param);
|
assertNotNull(param);
|
||||||
|
|
||||||
// Add a custom search parameter
|
TransactionTemplate txTemplate = newTxTemplate();
|
||||||
SearchParameter fooSp = new SearchParameter();
|
txTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||||
fooSp.addBase("Patient");
|
@Override
|
||||||
fooSp.setCode("foo");
|
protected void doInTransactionWithoutResult(TransactionStatus theStatus) {
|
||||||
fooSp.setType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN);
|
// Add a custom search parameter
|
||||||
fooSp.setTitle("FOO SP");
|
SearchParameter fooSp = new SearchParameter();
|
||||||
fooSp.setExpression("Patient.gender");
|
fooSp.addBase("Patient");
|
||||||
fooSp.setXpathUsage(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL);
|
fooSp.setCode("foo");
|
||||||
fooSp.setStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE);
|
fooSp.setType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN);
|
||||||
mySearchParameterDao.create(fooSp, mySrd);
|
fooSp.setTitle("FOO SP");
|
||||||
|
fooSp.setExpression("Patient.gender");
|
||||||
|
fooSp.setXpathUsage(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL);
|
||||||
|
fooSp.setStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE);
|
||||||
|
mySearchParameterDao.create(fooSp, mySrd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Disable an existing parameter
|
// Disable an existing parameter
|
||||||
fooSp = new SearchParameter();
|
txTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||||
fooSp.addBase("Patient");
|
@Override
|
||||||
fooSp.setCode("gender");
|
protected void doInTransactionWithoutResult(TransactionStatus theStatus) {
|
||||||
fooSp.setType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN);
|
SearchParameter fooSp = new SearchParameter();
|
||||||
fooSp.setTitle("Gender");
|
fooSp.addBase("Patient");
|
||||||
fooSp.setExpression("Patient.gender");
|
fooSp.setCode("gender");
|
||||||
fooSp.setXpathUsage(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL);
|
fooSp.setType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN);
|
||||||
fooSp.setStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED);
|
fooSp.setTitle("Gender");
|
||||||
mySearchParameterDao.create(fooSp, mySrd);
|
fooSp.setExpression("Patient.gender");
|
||||||
|
fooSp.setXpathUsage(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL);
|
||||||
|
fooSp.setStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED);
|
||||||
|
mySearchParameterDao.create(fooSp, mySrd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mySearchParamRegsitry.forceRefresh();
|
txTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||||
|
@Override
|
||||||
|
protected void doInTransactionWithoutResult(TransactionStatus theStatus) {
|
||||||
|
mySearchParamRegsitry.forceRefresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
conformance = ourClient
|
conformance = ourClient
|
||||||
.fetchConformance()
|
.fetchConformance()
|
||||||
|
@ -187,7 +205,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
|
||||||
@Test
|
@Test
|
||||||
public void testConformanceOverrideNotAllowed() {
|
public void testConformanceOverrideNotAllowed() {
|
||||||
myDaoConfig.setDefaultSearchParamsCanBeOverridden(false);
|
myDaoConfig.setDefaultSearchParamsCanBeOverridden(false);
|
||||||
|
|
||||||
CapabilityStatement conformance = ourClient
|
CapabilityStatement conformance = ourClient
|
||||||
.fetchConformance()
|
.fetchConformance()
|
||||||
.ofType(CapabilityStatement.class)
|
.ofType(CapabilityStatement.class)
|
||||||
|
@ -288,7 +306,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv
|
||||||
.where(new TokenClientParam("foo").exactly().code("male"))
|
.where(new TokenClientParam("foo").exactly().code("male"))
|
||||||
.returnBundle(Bundle.class)
|
.returnBundle(Bundle.class)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
foundResources = toUnqualifiedVersionlessIdValues(result);
|
foundResources = toUnqualifiedVersionlessIdValues(result);
|
||||||
assertThat(foundResources, contains(patId.getValue()));
|
assertThat(foundResources, contains(patId.getValue()));
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<!-- Set to 'trace' to enable SQL logging -->
|
<!-- Set to 'trace' to enable SQL logging -->
|
||||||
<logger name="org.hibernate.SQL" additivity="false" level="info">
|
<logger name="org.hibernate.SQL" additivity="false" level="trace">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
</logger>
|
</logger>
|
||||||
<!-- Set to 'trace' to enable SQL Value logging -->
|
<!-- Set to 'trace' to enable SQL Value logging -->
|
||||||
|
|
Loading…
Reference in New Issue