mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-02-17 02:15:22 +00:00
Beef up logging in tests
This commit is contained in:
parent
395c8b6acc
commit
f91977cbac
@ -56,6 +56,30 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
|||||||
myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical());
|
myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See #773
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDeleteResourceWithOutboundDeletedResources() {
|
||||||
|
myDaoConfig.setEnforceReferentialIntegrityOnDelete(false);
|
||||||
|
|
||||||
|
Organization org = new Organization();
|
||||||
|
org.setId("ORG");
|
||||||
|
org.setName("ORG");
|
||||||
|
myOrganizationDao.update(org);
|
||||||
|
|
||||||
|
Patient pat = new Patient();
|
||||||
|
pat.setId("PAT");
|
||||||
|
pat.setActive(true);
|
||||||
|
pat.setManagingOrganization(new ResourceReferenceDt("Organization/ORG"));
|
||||||
|
myPatientDao.update(pat);
|
||||||
|
|
||||||
|
myOrganizationDao.delete(new IdDt("Organization/ORG"));
|
||||||
|
|
||||||
|
myPatientDao.delete(new IdDt("Patient/PAT"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void assertGone(IIdType theId) {
|
private void assertGone(IIdType theId) {
|
||||||
try {
|
try {
|
||||||
assertNotGone(theId);
|
assertNotGone(theId);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package ca.uhn.fhir.jpa.provider.dstu3;
|
package ca.uhn.fhir.jpa.provider.dstu3;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.provider.r4.ResourceProviderInterceptorR4Test;
|
import ca.uhn.fhir.jpa.provider.r4.ResourceProviderInterceptorR4Test;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Conformance;
|
|
||||||
import ca.uhn.fhir.parser.IParser;
|
import ca.uhn.fhir.parser.IParser;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||||
@ -61,8 +60,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
|
|||||||
public void before() throws Exception {
|
public void before() throws Exception {
|
||||||
super.before();
|
super.before();
|
||||||
|
|
||||||
myServerInterceptor = mock(IServerInterceptor.class);
|
myServerInterceptor = mock(IServerInterceptor.class, withSettings().verboseLogging());
|
||||||
myDaoInterceptor = mock(IServerInterceptor.class);
|
myDaoInterceptor = mock(IServerInterceptor.class, withSettings().verboseLogging());
|
||||||
|
|
||||||
resetServerInterceptor();
|
resetServerInterceptor();
|
||||||
|
|
||||||
@ -125,6 +124,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
|
|||||||
public void testCreateResourceInTransaction() throws IOException, ServletException {
|
public void testCreateResourceInTransaction() throws IOException, ServletException {
|
||||||
String methodName = "testCreateResourceInTransaction";
|
String methodName = "testCreateResourceInTransaction";
|
||||||
|
|
||||||
|
ourLog.info("** Starting {}", methodName);
|
||||||
|
|
||||||
Patient pt = new Patient();
|
Patient pt = new Patient();
|
||||||
pt.addName().setFamily(methodName);
|
pt.addName().setFamily(methodName);
|
||||||
|
|
||||||
@ -140,6 +141,11 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
|
|||||||
|
|
||||||
resetServerInterceptor();
|
resetServerInterceptor();
|
||||||
|
|
||||||
|
ArgumentCaptor<ActionRequestDetails> ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
||||||
|
ArgumentCaptor<RestOperationTypeEnum> opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
||||||
|
verify(myDaoInterceptor, times(0)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture());
|
||||||
|
verify(myServerInterceptor, times(0)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture());
|
||||||
|
|
||||||
HttpPost post = new HttpPost(ourServerBase + "/");
|
HttpPost post = new HttpPost(ourServerBase + "/");
|
||||||
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
CloseableHttpResponse response = ourHttpClient.execute(post);
|
CloseableHttpResponse response = ourHttpClient.execute(post);
|
||||||
@ -153,8 +159,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
|
|||||||
* Server Interceptor
|
* Server Interceptor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ArgumentCaptor<ActionRequestDetails> ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class);
|
||||||
ArgumentCaptor<RestOperationTypeEnum> opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
|
||||||
verify(myServerInterceptor, times(2)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture());
|
verify(myServerInterceptor, times(2)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture());
|
||||||
assertEquals(RestOperationTypeEnum.TRANSACTION, opTypeCaptor.getAllValues().get(0));
|
assertEquals(RestOperationTypeEnum.TRANSACTION, opTypeCaptor.getAllValues().get(0));
|
||||||
assertEquals(null, ardCaptor.getAllValues().get(0).getResourceType());
|
assertEquals(null, ardCaptor.getAllValues().get(0).getResourceType());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user