From 5c35d89fd1c1d4196addcbc2aa35e13ec565a48d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 5 Oct 2015 11:07:47 +0100 Subject: [PATCH] Revert "Update tests to shut down in-memory databases proactively" For reasons I don't (yet?) understand, shutting down the databases proactively triggers a StackOverflowError in Jersey. Reverting the change while I try to figure out what's going in. --- .../autoconfigure/jdbc/DataSourceInitializerTests.java | 3 +-- .../orm/jpa/AbstractJpaAutoConfigurationTests.java | 9 --------- .../security/SecurityAutoConfigurationTests.java | 2 +- .../autoconfigure/security/jpa/JpaUserDetailsTests.java | 2 -- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java index 93040a8a01..46261a89e3 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerTests.java @@ -56,8 +56,7 @@ public class DataSourceInitializerTests { EmbeddedDatabaseConnection.override = null; EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.initialize:false", - "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt() - + ";shutdown=true"); + "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt()); } @After diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java index 49b29eebbc..3d9ae030a2 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/AbstractJpaAutoConfigurationTests.java @@ -19,14 +19,12 @@ package org.springframework.boot.autoconfigure.orm.jpa; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; -import java.util.Random; import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; import org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -73,13 +71,6 @@ public abstract class AbstractJpaAutoConfigurationTests { protected AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); - @Before - public void setup() { - EnvironmentTestUtils.addEnvironment(this.context, - "spring.datasource.url:jdbc:hsqldb:mem:testdb-" + new Random().nextInt() - + ";shutdown=true"); - } - @After public void close() { this.context.close(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java index 0b9e0c53b1..66a89918ee 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java @@ -297,7 +297,7 @@ public class SecurityAutoConfigurationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.setServletContext(new MockServletContext()); EnvironmentTestUtils.addEnvironment(this.context, - "spring.datasource.url:jdbc:hsqldb:mem:testsecdb;shutdown=true"); + "spring.datasource.url:jdbc:hsqldb:mem:testsecdb"); this.context.register(EntityConfiguration.class, PropertyPlaceholderAutoConfiguration.class, DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java index 69fc819e93..e7b6c90365 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/jpa/JpaUserDetailsTests.java @@ -29,7 +29,6 @@ import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; /** @@ -43,7 +42,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(JpaUserDetailsTests.Main.class) @DirtiesContext -@TestPropertySource(properties = "spring.datasource.url:jdbc:hsqldb:mem:testdb;shutdown=true") public class JpaUserDetailsTests { @Test