Connection handling cleanup for new tests
This commit is contained in:
parent
0e2cecfbd0
commit
a4cbda357e
|
@ -60,7 +60,7 @@ public class FhirResourceDaoSearchParameterR4 extends FhirResourceDaoR4<SearchPa
|
||||||
ourLog.info("Marking all resources of type {} for reindexing due to updated search parameter with path: {}", expression);
|
ourLog.info("Marking all resources of type {} for reindexing due to updated search parameter with path: {}", expression);
|
||||||
|
|
||||||
TransactionTemplate txTemplate = new TransactionTemplate(myPlatformTransactionManager);
|
TransactionTemplate txTemplate = new TransactionTemplate(myPlatformTransactionManager);
|
||||||
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
||||||
int updatedCount = txTemplate.execute(new TransactionCallback<Integer>() {
|
int updatedCount = txTemplate.execute(new TransactionCallback<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer doInTransaction(TransactionStatus theStatus) {
|
public Integer doInTransaction(TransactionStatus theStatus) {
|
||||||
|
|
|
@ -10,6 +10,8 @@ import org.hl7.fhir.r4.model.Appointment.AppointmentStatus;
|
||||||
import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender;
|
import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
import org.springframework.transaction.support.*;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
||||||
import ca.uhn.fhir.model.api.Include;
|
import ca.uhn.fhir.model.api.Include;
|
||||||
|
@ -474,7 +476,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchForExtensionTwoDeepDecimal() {
|
public void testSearchForExtensionTwoDeepDecimal() {
|
||||||
SearchParameter siblingSp = new SearchParameter();
|
final SearchParameter siblingSp = new SearchParameter();
|
||||||
siblingSp.addBase("Patient");
|
siblingSp.addBase("Patient");
|
||||||
siblingSp.setCode("foobar");
|
siblingSp.setCode("foobar");
|
||||||
siblingSp.setType(org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER);
|
siblingSp.setType(org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER);
|
||||||
|
@ -482,11 +484,18 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||||
siblingSp.setExpression("Patient.extension('http://acme.org/foo').extension('http://acme.org/bar')");
|
siblingSp.setExpression("Patient.extension('http://acme.org/foo').extension('http://acme.org/bar')");
|
||||||
siblingSp.setXpathUsage(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL);
|
siblingSp.setXpathUsage(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL);
|
||||||
siblingSp.setStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE);
|
siblingSp.setStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE);
|
||||||
|
|
||||||
|
TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
|
||||||
|
txTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW);
|
||||||
|
txTemplate.execute(new TransactionCallbackWithoutResult() {
|
||||||
|
@Override
|
||||||
|
protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
|
||||||
mySearchParameterDao.create(siblingSp, mySrd);
|
mySearchParameterDao.create(siblingSp, mySrd);
|
||||||
|
|
||||||
mySearchParamRegsitry.forceRefresh();
|
mySearchParamRegsitry.forceRefresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Patient patient = new Patient();
|
final Patient patient = new Patient();
|
||||||
patient.addName().setFamily("P2");
|
patient.addName().setFamily("P2");
|
||||||
Extension extParent = patient
|
Extension extParent = patient
|
||||||
.addExtension()
|
.addExtension()
|
||||||
|
@ -496,7 +505,12 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||||
.setUrl("http://acme.org/bar")
|
.setUrl("http://acme.org/bar")
|
||||||
.setValue(new DecimalType("2.1"));
|
.setValue(new DecimalType("2.1"));
|
||||||
|
|
||||||
IIdType p2id = myPatientDao.create(patient).getId().toUnqualifiedVersionless();
|
IIdType p2id = txTemplate.execute(new TransactionCallback<IIdType>() {
|
||||||
|
@Override
|
||||||
|
public IIdType doInTransaction(TransactionStatus theArg0) {
|
||||||
|
return myPatientDao.create(patient).getId().toUnqualifiedVersionless();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
SearchParameterMap map;
|
SearchParameterMap map;
|
||||||
IBundleProvider results;
|
IBundleProvider results;
|
||||||
|
@ -590,8 +604,6 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchForExtensionReferenceWithoutTarget() {
|
public void testSearchForExtensionReferenceWithoutTarget() {
|
||||||
SearchParameter siblingSp = new SearchParameter();
|
SearchParameter siblingSp = new SearchParameter();
|
||||||
|
@ -644,7 +656,6 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
||||||
foundResources = toUnqualifiedVersionlessIdValues(results);
|
foundResources = toUnqualifiedVersionlessIdValues(results);
|
||||||
assertThat(foundResources, containsInAnyOrder(appid.getValue()));
|
assertThat(foundResources, containsInAnyOrder(appid.getValue()));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue