Fix broken test
This commit is contained in:
parent
490e4cb94d
commit
5dccf93506
|
@ -5,10 +5,12 @@ import ca.uhn.fhir.validation.ResultSeverityEnum;
|
|||
import net.ttddyy.dsproxy.listener.SingleQueryCountHolder;
|
||||
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
|
@ -25,7 +27,7 @@ import static org.junit.Assert.fail;
|
|||
public class TestR4Config extends BaseJavaConfigR4 {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TestR4Config.class);
|
||||
private static int ourMaxThreads;
|
||||
public static Integer ourMaxThreads;
|
||||
|
||||
static {
|
||||
/*
|
||||
|
@ -33,7 +35,9 @@ public class TestR4Config extends BaseJavaConfigR4 {
|
|||
* and catch any potential deadlocks caused by database connection
|
||||
* starvation
|
||||
*/
|
||||
ourMaxThreads = (int) (Math.random() * 6.0) + 1;
|
||||
if (ourMaxThreads == null) {
|
||||
ourMaxThreads = (int) (Math.random() * 6.0) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
private Exception myLastStackTrace;
|
||||
|
@ -90,7 +94,6 @@ public class TestR4Config extends BaseJavaConfigR4 {
|
|||
retVal.setMaxWaitMillis(10000);
|
||||
retVal.setUsername("");
|
||||
retVal.setPassword("");
|
||||
|
||||
retVal.setMaxTotal(ourMaxThreads);
|
||||
|
||||
DataSource dataSource = ProxyDataSourceBuilder
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ResourceProviderDstu3BundleTest extends BaseResourceProviderDstu3Te
|
|||
.setName("content")
|
||||
.setResource(bundle);
|
||||
try {
|
||||
ourClient.operation().onType(MessageHeader.class).named(JpaConstants.OPERATION_PROCESS_MESSAGE).withParameters(parameters).execute();
|
||||
ourClient.operation().onServer().named(JpaConstants.OPERATION_PROCESS_MESSAGE).withParameters(parameters).execute();
|
||||
fail();
|
||||
} catch (NotImplementedOperationException e) {
|
||||
assertThat(e.getMessage(), containsString("This operation is not yet implemented on this server"));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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;
|
||||
|
@ -51,10 +52,15 @@ 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 + "=true",
|
||||
"max_db_connections=10"
|
||||
})
|
||||
public class StressTestR4Test extends BaseResourceProviderR4Test {
|
||||
|
||||
static {
|
||||
TestR4Config.ourMaxThreads = 10;
|
||||
}
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StressTestR4Test.class);
|
||||
private RequestValidatingInterceptor myRequestValidatingInterceptor;
|
||||
@Autowired
|
||||
|
|
Loading…
Reference in New Issue