More test fixes
This commit is contained in:
parent
c9fee23e48
commit
7ff895de77
|
@ -36,6 +36,7 @@ import ca.uhn.fhir.rest.param.TokenParam;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
|
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.ServerOperationInterceptorAdapter;
|
import ca.uhn.fhir.rest.server.interceptor.ServerOperationInterceptorAdapter;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
@ -375,6 +376,11 @@ public abstract class BaseSubscriptionInterceptor<S extends IBaseResource> exten
|
||||||
myResourceDaos = theResourceDaos;
|
myResourceDaos = theResourceDaos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public void setTxManager(PlatformTransactionManager theTxManager) {
|
||||||
|
myTxManager = theTxManager;
|
||||||
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void start() {
|
public void start() {
|
||||||
for (IFhirResourceDao<?> next : myResourceDaos) {
|
for (IFhirResourceDao<?> next : myResourceDaos) {
|
||||||
|
|
|
@ -303,7 +303,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
|
||||||
Patient pt1 = new Patient();
|
Patient pt1 = new Patient();
|
||||||
pt1.setGender(Enumerations.AdministrativeGender.MALE);
|
pt1.setGender(Enumerations.AdministrativeGender.MALE);
|
||||||
pt1.setBirthDateElement(new DateType("2011-01-01"));
|
pt1.setBirthDateElement(new DateType("2011-01-01"));
|
||||||
String id1 = myPatientDao.create(pt1).getId().toUnqualifiedVersionless().getIdPart();
|
String id1 = myPatientDao.create(pt1).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
Patient pt2 = new Patient();
|
Patient pt2 = new Patient();
|
||||||
pt2.setGender(Enumerations.AdministrativeGender.MALE);
|
pt2.setGender(Enumerations.AdministrativeGender.MALE);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.web.context.ContextLoader;
|
import org.springframework.web.context.ContextLoader;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||||
|
@ -47,6 +48,7 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test {
|
||||||
protected static GenericWebApplicationContext ourWebApplicationContext;
|
protected static GenericWebApplicationContext ourWebApplicationContext;
|
||||||
protected static SubscriptionRestHookInterceptor ourRestHookSubscriptionInterceptor;
|
protected static SubscriptionRestHookInterceptor ourRestHookSubscriptionInterceptor;
|
||||||
protected static DatabaseBackedPagingProvider ourPagingProvider;
|
protected static DatabaseBackedPagingProvider ourPagingProvider;
|
||||||
|
protected static PlatformTransactionManager ourTxManager;
|
||||||
|
|
||||||
public BaseResourceProviderDstu2Test() {
|
public BaseResourceProviderDstu2Test() {
|
||||||
super();
|
super();
|
||||||
|
@ -98,6 +100,7 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test {
|
||||||
ourWebApplicationContext.refresh();
|
ourWebApplicationContext.refresh();
|
||||||
|
|
||||||
ourRestHookSubscriptionInterceptor = ourWebApplicationContext.getBean(SubscriptionRestHookInterceptor.class);
|
ourRestHookSubscriptionInterceptor = ourWebApplicationContext.getBean(SubscriptionRestHookInterceptor.class);
|
||||||
|
ourTxManager = ourWebApplicationContext.getBean(PlatformTransactionManager.class);
|
||||||
|
|
||||||
proxyHandler.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ourWebApplicationContext);
|
proxyHandler.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ourWebApplicationContext);
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
mySubscriber.setEmailSender(emailSender);
|
mySubscriber.setEmailSender(emailSender);
|
||||||
mySubscriber.setResourceDaos(myResourceDaos);
|
mySubscriber.setResourceDaos(myResourceDaos);
|
||||||
mySubscriber.setFhirContext(myFhirCtx);
|
mySubscriber.setFhirContext(myFhirCtx);
|
||||||
|
mySubscriber.setTxManager(ourTxManager);
|
||||||
mySubscriber.start();
|
mySubscriber.start();
|
||||||
ourRestServer.registerInterceptor(mySubscriber);
|
ourRestServer.registerInterceptor(mySubscriber);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue