Try to reduce unit test memory for Travis

This commit is contained in:
jamesagnew 2016-01-07 23:03:54 -05:00
parent e7adebe8d7
commit fbcf366ffa
6 changed files with 24 additions and 4 deletions

View File

@ -296,7 +296,7 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<runOrder>alphabetical</runOrder> <runOrder>alphabetical</runOrder>
<argLine>-Xms512m -Xmx1024m</argLine> <argLine>-Xmx1024m</argLine>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -96,8 +96,13 @@ public class BaseDstu21Config extends BaseConfig {
@Bean @Bean
public IValidationSupport validationSupportChainDstu21() { public IValidationSupport validationSupportChainDstu21() {
return new ValidationSupportChain(new DefaultProfileValidationSupport(), jpaValidationSupportDstu21()); return new ValidationSupportChain(defaultProfileValidationSupport(), jpaValidationSupportDstu21());
// return new ValidationSupportChain(); // return new ValidationSupportChain();
} }
@Bean(destroyMethod="flush")
public DefaultProfileValidationSupport defaultProfileValidationSupport() {
return new DefaultProfileValidationSupport();
}
} }

View File

@ -47,7 +47,7 @@ public class WebsocketDstu21Config implements WebSocketConfigurer {
return new PerConnectionWebSocketHandler(SubscriptionWebsocketHandlerDstu21.class); return new PerConnectionWebSocketHandler(SubscriptionWebsocketHandlerDstu21.class);
} }
@Bean @Bean(destroyMethod="destroy")
public TaskScheduler websocketTaskScheduler() { public TaskScheduler websocketTaskScheduler() {
ThreadPoolTaskScheduler retVal = new ThreadPoolTaskScheduler(); ThreadPoolTaskScheduler retVal = new ThreadPoolTaskScheduler();
retVal.setPoolSize(5); retVal.setPoolSize(5);

View File

@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.dao;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.sql.DriverManager;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -86,6 +87,7 @@ public class BaseJpaTest {
@AfterClass @AfterClass
public static void afterClassShutdownDerby() throws SQLException { public static void afterClassShutdownDerby() throws SQLException {
// DriverManager.getConnection("jdbc:derby:;shutdown=true");
// try { // try {
// DriverManager.getConnection("jdbc:derby:memory:myUnitTestDB;drop=true"); // DriverManager.getConnection("jdbc:derby:memory:myUnitTestDB;drop=true");
// } catch (SQLNonTransientConnectionException e) { // } catch (SQLNonTransientConnectionException e) {

View File

@ -12,16 +12,19 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlet.ServletHolder;
import org.hl7.fhir.dstu21.hapi.validation.DefaultProfileValidationSupport;
import org.hl7.fhir.dstu21.model.Bundle; import org.hl7.fhir.dstu21.model.Bundle;
import org.hl7.fhir.dstu21.model.Bundle.BundleEntryComponent; import org.hl7.fhir.dstu21.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu21.model.Patient; import org.hl7.fhir.dstu21.model.Patient;
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.jdbc.support.incrementer.MySQLMaxValueIncrementer;
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;
import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.DispatcherServlet;
import ca.uhn.fhir.jpa.config.WebsocketDstu21Config; import ca.uhn.fhir.jpa.config.WebsocketDstu21Config;
@ -43,6 +46,7 @@ public abstract class BaseResourceProviderDstu21Test extends BaseJpaDstu21Test {
private static Server ourServer; private static Server ourServer;
protected static String ourServerBase; protected static String ourServerBase;
protected static RestfulServer ourRestServer; protected static RestfulServer ourRestServer;
private static DefaultProfileValidationSupport myValidationSupport;
public BaseResourceProviderDstu21Test() { public BaseResourceProviderDstu21Test() {
super(); super();
@ -66,6 +70,7 @@ public abstract class BaseResourceProviderDstu21Test extends BaseJpaDstu21Test {
ourHttpClient.close(); ourHttpClient.close();
ourServer = null; ourServer = null;
ourHttpClient = null; ourHttpClient = null;
myValidationSupport.flush();
} }
@After @After
@ -126,6 +131,9 @@ public abstract class BaseResourceProviderDstu21Test extends BaseJpaDstu21Test {
server.setHandler(proxyHandler); server.setHandler(proxyHandler);
server.start(); server.start();
WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(subsServletHolder.getServlet().getServletConfig().getServletContext());
myValidationSupport = wac.getBean(DefaultProfileValidationSupport.class);
ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase); ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase);
ourClient.registerInterceptor(new LoggingInterceptor(true)); ourClient.registerInterceptor(new LoggingInterceptor(true));

View File

@ -27,8 +27,8 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
public class DefaultProfileValidationSupport implements IValidationSupport { public class DefaultProfileValidationSupport implements IValidationSupport {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DefaultProfileValidationSupport.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DefaultProfileValidationSupport.class);
private Map<String, ValueSet> myCodeSystems; private Map<String, ValueSet> myCodeSystems;
private Map<String, ValueSet> myDefaultValueSets; private Map<String, ValueSet> myDefaultValueSets;
@Override @Override
@ -153,4 +153,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
return new CodeValidationResult(IssueSeverity.INFORMATION, "Unknown code: " + theCodeSystem + " / " + theCode); return new CodeValidationResult(IssueSeverity.INFORMATION, "Unknown code: " + theCodeSystem + " / " + theCode);
} }
public void flush() {
myCodeSystems = null;
myDefaultValueSets = null;
}
} }