Test fix
This commit is contained in:
parent
432b249225
commit
f2fa8659c4
|
@ -368,8 +368,12 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClassClearContextBaseJpaDstu3Test() {
|
public static void afterClassClearContextBaseJpaDstu3Test() {
|
||||||
ourValueSetDao.purgeCaches();
|
if (ourValueSetDao != null) {
|
||||||
ourJpaValidationSupportChainDstu3.invalidateCaches();
|
ourValueSetDao.purgeCaches();
|
||||||
|
}
|
||||||
|
if (ourJpaValidationSupportChainDstu3 != null) {
|
||||||
|
ourJpaValidationSupportChainDstu3.invalidateCaches();
|
||||||
|
}
|
||||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import ca.uhn.fhir.jpa.model.util.JpaConstants;
|
||||||
import ca.uhn.fhir.jpa.model.util.ProviderConstants;
|
import ca.uhn.fhir.jpa.model.util.ProviderConstants;
|
||||||
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
|
||||||
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
||||||
|
import ca.uhn.fhir.jpa.subscription.triggering.ISubscriptionTriggeringSvc;
|
||||||
import ca.uhn.fhir.jpa.subscription.triggering.SubscriptionTriggeringSvcImpl;
|
import ca.uhn.fhir.jpa.subscription.triggering.SubscriptionTriggeringSvcImpl;
|
||||||
import ca.uhn.fhir.rest.annotation.Create;
|
import ca.uhn.fhir.rest.annotation.Create;
|
||||||
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
||||||
|
@ -17,6 +18,7 @@ import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.test.utilities.JettyUtil;
|
import ca.uhn.fhir.test.utilities.JettyUtil;
|
||||||
|
import ca.uhn.fhir.test.utilities.ProxyUtil;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
|
@ -71,7 +73,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscriptionTestUtil mySubscriptionTestUtil;
|
private SubscriptionTestUtil mySubscriptionTestUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubscriptionTriggeringSvcImpl mySubscriptionTriggeringSvc;
|
private ISubscriptionTriggeringSvc mySubscriptionTriggeringSvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchedulerService mySchedulerService;
|
private ISchedulerService mySchedulerService;
|
||||||
|
|
||||||
|
@ -93,8 +95,9 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
|
|
||||||
mySubscriptionTestUtil.unregisterSubscriptionInterceptor();
|
mySubscriptionTestUtil.unregisterSubscriptionInterceptor();
|
||||||
|
|
||||||
mySubscriptionTriggeringSvc.cancelAll();
|
SubscriptionTriggeringSvcImpl svc = ProxyUtil.getSingletonTarget(mySubscriptionTriggeringSvc, SubscriptionTriggeringSvcImpl.class);
|
||||||
mySubscriptionTriggeringSvc.setMaxSubmitPerPass(null);
|
svc.cancelAll();
|
||||||
|
svc.setMaxSubmitPerPass(null);
|
||||||
|
|
||||||
myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds());
|
myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds());
|
||||||
}
|
}
|
||||||
|
@ -224,7 +227,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
waitForSize(50, ourUpdatedPatients);
|
waitForSize(50, ourUpdatedPatients);
|
||||||
beforeReset();
|
beforeReset();
|
||||||
|
|
||||||
mySubscriptionTriggeringSvc.setMaxSubmitPerPass(33);
|
SubscriptionTriggeringSvcImpl svc = ProxyUtil.getSingletonTarget(mySubscriptionTriggeringSvc, SubscriptionTriggeringSvcImpl.class);
|
||||||
|
svc.setMaxSubmitPerPass(33);
|
||||||
|
|
||||||
Parameters response = ourClient
|
Parameters response = ourClient
|
||||||
.operation()
|
.operation()
|
||||||
|
@ -294,7 +298,9 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
mySubscriptionTriggeringSvc.runDeliveryPass();
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
mySubscriptionTriggeringSvc.runDeliveryPass();
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
mySubscriptionTriggeringSvc.runDeliveryPass();
|
mySubscriptionTriggeringSvc.runDeliveryPass();
|
||||||
assertEquals(0, mySubscriptionTriggeringSvc.getActiveJobCount());
|
|
||||||
|
SubscriptionTriggeringSvcImpl svc = ProxyUtil.getSingletonTarget(mySubscriptionTriggeringSvc, SubscriptionTriggeringSvcImpl.class);
|
||||||
|
assertEquals(0, svc.getActiveJobCount());
|
||||||
|
|
||||||
assertEquals(0, ourCreatedPatients.size());
|
assertEquals(0, ourCreatedPatients.size());
|
||||||
await().until(() -> ourUpdatedPatients.size() == 3);
|
await().until(() -> ourUpdatedPatients.size() == 3);
|
||||||
|
@ -361,7 +367,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
waitForSize(50, ourUpdatedPatients);
|
waitForSize(50, ourUpdatedPatients);
|
||||||
beforeReset();
|
beforeReset();
|
||||||
|
|
||||||
mySubscriptionTriggeringSvc.setMaxSubmitPerPass(33);
|
SubscriptionTriggeringSvcImpl svc = ProxyUtil.getSingletonTarget(mySubscriptionTriggeringSvc, SubscriptionTriggeringSvcImpl.class);
|
||||||
|
svc.setMaxSubmitPerPass(33);
|
||||||
|
|
||||||
Parameters response = ourClient
|
Parameters response = ourClient
|
||||||
.operation()
|
.operation()
|
||||||
|
@ -427,7 +434,8 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te
|
||||||
waitForSize(0, ourUpdatedPatients);
|
waitForSize(0, ourUpdatedPatients);
|
||||||
beforeReset();
|
beforeReset();
|
||||||
|
|
||||||
mySubscriptionTriggeringSvc.setMaxSubmitPerPass(50);
|
SubscriptionTriggeringSvcImpl svc = ProxyUtil.getSingletonTarget(mySubscriptionTriggeringSvc, SubscriptionTriggeringSvcImpl.class);
|
||||||
|
svc.setMaxSubmitPerPass(50);
|
||||||
|
|
||||||
Parameters response = ourClient
|
Parameters response = ourClient
|
||||||
.operation()
|
.operation()
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package ca.uhn.fhir.test.utilities;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.Validate;
|
||||||
|
import org.springframework.aop.framework.AopProxyUtils;
|
||||||
|
|
||||||
|
public class ProxyUtil {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T> T getSingletonTarget(Object theSource, Class<T> theSubscriptionTriggeringSvcClass) {
|
||||||
|
Validate.notNull(theSource);
|
||||||
|
if (theSubscriptionTriggeringSvcClass.isAssignableFrom(theSource.getClass())) {
|
||||||
|
return (T) theSource;
|
||||||
|
}
|
||||||
|
return (T) AopProxyUtils.getSingletonTarget(theSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue