diff --git a/hapi-fhir-cobertura/pom.xml b/hapi-fhir-cobertura/pom.xml
index a781cd16f1d..0203a427fea 100644
--- a/hapi-fhir-cobertura/pom.xml
+++ b/hapi-fhir-cobertura/pom.xml
@@ -296,7 +296,7 @@
maven-surefire-plugin
alphabetical
- -Xms512m -Xmx1024m
+ -Xmx1024m
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu21Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu21Config.java
index a5d6f593af2..3705b270a30 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu21Config.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseDstu21Config.java
@@ -96,8 +96,13 @@ public class BaseDstu21Config extends BaseConfig {
@Bean
public IValidationSupport validationSupportChainDstu21() {
- return new ValidationSupportChain(new DefaultProfileValidationSupport(), jpaValidationSupportDstu21());
+ return new ValidationSupportChain(defaultProfileValidationSupport(), jpaValidationSupportDstu21());
// return new ValidationSupportChain();
}
+ @Bean(destroyMethod="flush")
+ public DefaultProfileValidationSupport defaultProfileValidationSupport() {
+ return new DefaultProfileValidationSupport();
+ }
+
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/WebsocketDstu21Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/WebsocketDstu21Config.java
index 08af4256877..19fcf303deb 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/WebsocketDstu21Config.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/WebsocketDstu21Config.java
@@ -47,7 +47,7 @@ public class WebsocketDstu21Config implements WebSocketConfigurer {
return new PerConnectionWebSocketHandler(SubscriptionWebsocketHandlerDstu21.class);
}
- @Bean
+ @Bean(destroyMethod="destroy")
public TaskScheduler websocketTaskScheduler() {
ThreadPoolTaskScheduler retVal = new ThreadPoolTaskScheduler();
retVal.setPoolSize(5);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
index 66da8173438..7a656fa4d0a 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.dao;
import java.io.IOException;
import java.io.InputStream;
+import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
@@ -86,6 +87,7 @@ public class BaseJpaTest {
@AfterClass
public static void afterClassShutdownDerby() throws SQLException {
+// DriverManager.getConnection("jdbc:derby:;shutdown=true");
// try {
// DriverManager.getConnection("jdbc:derby:memory:myUnitTestDB;drop=true");
// } catch (SQLNonTransientConnectionException e) {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu21/BaseResourceProviderDstu21Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu21/BaseResourceProviderDstu21Test.java
index 9865951f48b..a52bbed47d4 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu21/BaseResourceProviderDstu21Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu21/BaseResourceProviderDstu21Test.java
@@ -12,16 +12,19 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
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.BundleEntryComponent;
import org.hl7.fhir.dstu21.model.Patient;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
+import org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.context.support.GenericWebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.DispatcherServlet;
import ca.uhn.fhir.jpa.config.WebsocketDstu21Config;
@@ -43,6 +46,7 @@ public abstract class BaseResourceProviderDstu21Test extends BaseJpaDstu21Test {
private static Server ourServer;
protected static String ourServerBase;
protected static RestfulServer ourRestServer;
+ private static DefaultProfileValidationSupport myValidationSupport;
public BaseResourceProviderDstu21Test() {
super();
@@ -66,6 +70,7 @@ public abstract class BaseResourceProviderDstu21Test extends BaseJpaDstu21Test {
ourHttpClient.close();
ourServer = null;
ourHttpClient = null;
+ myValidationSupport.flush();
}
@After
@@ -126,6 +131,9 @@ public abstract class BaseResourceProviderDstu21Test extends BaseJpaDstu21Test {
server.setHandler(proxyHandler);
server.start();
+
+ WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(subsServletHolder.getServlet().getServletConfig().getServletContext());
+ myValidationSupport = wac.getBean(DefaultProfileValidationSupport.class);
ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase);
ourClient.registerInterceptor(new LoggingInterceptor(true));
diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu21/hapi/validation/DefaultProfileValidationSupport.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu21/hapi/validation/DefaultProfileValidationSupport.java
index f03e430b082..892b6abc116 100644
--- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu21/hapi/validation/DefaultProfileValidationSupport.java
+++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu21/hapi/validation/DefaultProfileValidationSupport.java
@@ -27,8 +27,8 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
public class DefaultProfileValidationSupport implements IValidationSupport {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DefaultProfileValidationSupport.class);
+
private Map myCodeSystems;
-
private Map myDefaultValueSets;
@Override
@@ -153,4 +153,9 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
return new CodeValidationResult(IssueSeverity.INFORMATION, "Unknown code: " + theCodeSystem + " / " + theCode);
}
+ public void flush() {
+ myCodeSystems = null;
+ myDefaultValueSets = null;
+ }
+
}