diff --git a/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java b/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java index 0e6a276b8..3da2f3eee 100644 --- a/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java +++ b/ebean-test/src/main/java/io/ebean/test/config/platform/Config.java @@ -4,7 +4,7 @@ import io.ebean.config.DatabaseConfig; import io.ebean.datasource.DataSourceConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; + import java.util.Properties; /** @@ -18,7 +18,7 @@ class Config { * Common optional docker parameters that we just transfer to docker properties. */ private static final String[] DOCKER_TEST_PARAMS = {"fastStartMode", "inMemory", "initSqlFile", "seedSqlFile", "adminUser", "adminPassword", "extraDb", "extraDb.dbName", "extraDb.username", "extraDb.password", "extraDb.initSqlFile", "extraDb.seedSqlFile"}; - private static final String[] DOCKER_PLATFORM_PARAMS = {"containerName", "image", "internalPort", "startMode", "stopMode", "shutdown", "maxReadyAttempts", "tmpfs", "collation", "characterSet"}; + private static final String[] DOCKER_PLATFORM_PARAMS = {"containerName", "image", "internalPort", "startMode", "shutdownMode", "maxReadyAttempts", "tmpfs", "collation", "characterSet"}; private static final String DDL_MODE_OPTIONS = "dropCreate, create, none, migration, createOnly or migrationDropCreate"; @@ -388,11 +388,10 @@ class Config { } private void setDockerOptionalParameters() { - // check for shutdown mode on all containers - String mode = properties.getProperty("ebean.test.shutdown"); - if (mode != null && !ignoreDockerShutdown()) { - dockerProperties.setProperty(dockerKey("shutdown"), mode); + String mode = properties.getProperty("ebean.test.shutdownMode"); + if (mode != null) { + dockerProperties.setProperty(dockerKey("shutdownMode"), mode); } for (String key : DOCKER_TEST_PARAMS) { String val = getKey(key, null); @@ -410,26 +409,6 @@ class Config { } } - /** - * For local development we might want to ignore docker shutdown. - *
- * So we just want the shutdown mode to be used on the CI server.
- */
- boolean ignoreDockerShutdown() {
- String localDev = properties.getProperty("ebean.test.localDevelopment", "~/.ebean/ignore-docker-shutdown");
- return ignoreDockerShutdown(localDev);
- }
-
- boolean ignoreDockerShutdown(String localDev) {
-
- if (localDev.startsWith("~/")) {
- File homeDir = new File(System.getProperty("user.home"));
- return new File(homeDir, localDev.substring(2)).exists();
- }
-
- return new File(localDev).exists();
- }
-
private String dockerKey(String key) {
return dockerPlatform + "." + key;
}
diff --git a/ebean-test/src/main/java/io/ebean/test/config/platform/ElasticSearchSetup.java b/ebean-test/src/main/java/io/ebean/test/config/platform/ElasticSearchSetup.java
index c8324d868..94799d009 100644
--- a/ebean-test/src/main/java/io/ebean/test/config/platform/ElasticSearchSetup.java
+++ b/ebean-test/src/main/java/io/ebean/test/config/platform/ElasticSearchSetup.java
@@ -9,7 +9,7 @@ import java.util.Properties;
*/
class ElasticSearchSetup {
- private static final String[] DOCKER_PARAMS = {"containerName", "image", "internalPort", "startMode", "shutdown"};
+ private static final String[] DOCKER_PARAMS = {"containerName", "image", "internalPort", "startMode", "shutdownMode"};
private final Properties config;
@@ -30,9 +30,9 @@ class ElasticSearchSetup {
private Properties populateDockerProperties(String version) {
PropertiesBuilder properties = new PropertiesBuilder();
- String mode = config.getProperty("ebean.test.shutdown");
+ String mode = config.getProperty("ebean.test.shutdownMode");
if (mode != null) {
- properties.set("shutdown", mode);
+ properties.set("shutdownMode", mode);
}
properties.set("version", version);
diff --git a/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java b/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java
index e84ae203b..7971c2bb7 100644
--- a/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java
+++ b/ebean-test/src/test/java/io/ebean/test/config/platform/ConfigTest.java
@@ -6,7 +6,6 @@ import io.ebean.datasource.DataSourceConfig;
import io.ebeaninternal.api.DbOffline;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.Properties;
@@ -140,42 +139,6 @@ class ConfigTest {
assertThat(centralProps.getProperty("datasource.central.username")).isEqualTo("central");
}
- @Test
- void ignoreDockerShutdown() {
- Properties sourceProperties = new Properties();
- DatabaseConfig serverConfig = new DatabaseConfig();
- serverConfig.loadFromProperties(sourceProperties);
-
- Config config = new Config("main", "postgres", "main", serverConfig);
-
- assertThat(config.ignoreDockerShutdown("./src/test/resources/logback-test.xml")).isTrue();
- assertThat(config.ignoreDockerShutdown("./src/test/resources/file-does-not-exist")).isFalse();
- }
-
- @Disabled
- @Test
- void run_local_only_ignoreDockerShutdown() {
- Properties sourceProperties = new Properties();
- DatabaseConfig serverConfig = new DatabaseConfig();
- serverConfig.loadFromProperties(sourceProperties);
-
- Config config = new Config("main", "postgres", "main", serverConfig);
- assertThat(config.ignoreDockerShutdown("~/.ebean/ignore-docker-shutdown")).isTrue();
- assertThat(config.ignoreDockerShutdown()).isTrue();
- }
-
- @Test
- void ignoreDockerShutdown_viaProperties() {
- Properties sourceProperties = new Properties();
- sourceProperties.setProperty("ebean.test.localDevelopment", "./src/test/resources/logback-test.xml");
-
- DatabaseConfig serverConfig = new DatabaseConfig();
- serverConfig.loadFromProperties(sourceProperties);
-
- Config config = new Config("main", "postgres", "main", serverConfig);
- assertThat(config.ignoreDockerShutdown()).isTrue();
- }
-
@Test
void readImage_fromPlatform() {
Properties p = new Properties();
diff --git a/ebean-test/src/test/resources/logback-test.xml b/ebean-test/src/test/resources/logback-test.xml
index 3f022e12c..e95579b21 100644
--- a/ebean-test/src/test/resources/logback-test.xml
+++ b/ebean-test/src/test/resources/logback-test.xml
@@ -75,7 +75,7 @@