Remove duplicate test class
This commit is contained in:
parent
ce0c84db03
commit
2bfbea4e6b
|
@ -3,6 +3,7 @@ package ca.uhn.fhir.jpa.config;
|
|||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.subscription.SubscriptionTestUtil;
|
||||
import ca.uhn.fhir.jpa.subscription.module.config.UnregisterScheduledProcessor;
|
||||
import ca.uhn.fhir.jpa.subscription.module.subscriber.SubscriptionDeliveringRestHookSubscriber;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
@ -10,6 +10,7 @@ import ca.uhn.fhir.jpa.searchparam.JpaRuntimeSearchParam;
|
|||
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
|
||||
import ca.uhn.fhir.jpa.subscription.module.config.UnregisterScheduledProcessor;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.param.DateParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||
|
@ -45,7 +46,7 @@ import static org.junit.Assert.*;
|
|||
@TestPropertySource(properties = {
|
||||
// Since scheduled tasks can cause searches, which messes up the
|
||||
// value returned by SearchBuilder.getLastHandlerMechanismForUnitTest()
|
||||
"scheduling_disabled=true"
|
||||
UnregisterScheduledProcessor.SCHEDULING_DISABLED_EQUALS_TRUE
|
||||
})
|
||||
public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package ca.uhn.fhir.jpa.stresstest;
|
||||
|
||||
import ca.uhn.fhir.jpa.config.TestR4Config;
|
||||
import ca.uhn.fhir.jpa.config.UnregisterScheduledProcessor;
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.provider.r4.BaseResourceProviderR4Test;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.subscription.module.config.UnregisterScheduledProcessor;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||
|
@ -52,7 +52,7 @@ import static org.junit.Assert.fail;
|
|||
@TestPropertySource(properties = {
|
||||
// Since scheduled tasks can cause searches, which messes up the
|
||||
// value returned by SearchBuilder.getLastHandlerMechanismForUnitTest()
|
||||
UnregisterScheduledProcessor.SCHEDULING_DISABLED + "=true",
|
||||
UnregisterScheduledProcessor.SCHEDULING_DISABLED_EQUALS_TRUE,
|
||||
"max_db_connections=10"
|
||||
})
|
||||
public class StressTestR4Test extends BaseResourceProviderR4Test {
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package ca.uhn.fhir.jpa.subscription.module.config;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
|
||||
import org.springframework.scheduling.concurrent.ExecutorConfigurationSupport;
|
||||
|
||||
/**
|
||||
* This bean postprocessor disables all scheduled tasks. It is intended
|
||||
* only to be used in unit tests in circumstances where scheduled
|
||||
* tasks cause issues.
|
||||
*/
|
||||
// TODO KHS duplicated from jpaserver-base
|
||||
public class UnregisterScheduledProcessor implements BeanFactoryPostProcessor {
|
||||
|
||||
private final Environment myEnvironment;
|
||||
|
||||
public UnregisterScheduledProcessor(Environment theEnv) {
|
||||
myEnvironment = theEnv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
String schedulingDisabled = myEnvironment.getProperty("scheduling_disabled");
|
||||
if ("true".equals(schedulingDisabled)) {
|
||||
for (String beanName : beanFactory.getBeanNamesForType(ScheduledAnnotationBeanPostProcessor.class)) {
|
||||
((DefaultListableBeanFactory) beanFactory).removeBeanDefinition(beanName);
|
||||
}
|
||||
|
||||
for (String beanName : beanFactory.getBeanNamesForType(ExecutorConfigurationSupport.class)) {
|
||||
ExecutorConfigurationSupport executorConfigSupport = ((DefaultListableBeanFactory) beanFactory).getBean(beanName, ExecutorConfigurationSupport.class);
|
||||
executorConfigSupport.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
|
@ -18,6 +19,7 @@
|
|||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Logging -->
|
||||
|
@ -30,6 +32,16 @@
|
|||
<artifactId>logback-classic</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package ca.uhn.fhir.jpa.config;
|
||||
package ca.uhn.fhir.jpa.subscription.module.config;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
|
@ -16,6 +16,7 @@ import org.springframework.scheduling.concurrent.ExecutorConfigurationSupport;
|
|||
public class UnregisterScheduledProcessor implements BeanFactoryPostProcessor {
|
||||
|
||||
public static final String SCHEDULING_DISABLED = "scheduling_disabled";
|
||||
public static final String SCHEDULING_DISABLED_EQUALS_TRUE = "scheduling_disabled=true";
|
||||
|
||||
private final Environment myEnvironment;
|
||||
|
Loading…
Reference in New Issue