#1051 - Remove ServerConfig h2ProductionMode ... means for testing with h2 explicitly set ddlGenerate and ddlRun

This commit is contained in:
rob bygrave
2017-07-02 11:42:56 +12:00
parent 4777ec46be
commit 15be31fd5f
10 changed files with 5 additions and 45 deletions
@@ -80,12 +80,6 @@ public class ServerConfig {
*/
private String name = "db";
/**
* When false (default) H2 automatically uses DDL generate and run
* (i.e. assumes we are running tests using in memory h2).
*/
private boolean h2ProductionMode;
/**
* Typically configuration type objects that are passed by this ServerConfig
* to plugins. For example - IgniteConfiguration passed to Ignite plugin.
@@ -527,27 +521,6 @@ public class ServerConfig {
this.name = name;
}
/**
* Return true if H2 should be used in production mode.
* <p>
* Otherwise it is assumed we are using H2 for testing and DDL generate and run is turned on.
* </p>
*/
public boolean isH2ProductionMode() {
return h2ProductionMode;
}
/**
* Set to true for H2 to be used in production mode.
* <p>
* Do this when we want to use H2 and not have the DDL generation and run automatically turned on.
* Otherwise it is assumed we are using H2 for testing purposes.
* </p>
*/
public void setH2ProductionMode(boolean h2ProductionMode) {
this.h2ProductionMode = h2ProductionMode;
}
/**
* Return the container / clustering configuration.
* <p/>
@@ -1567,11 +1540,6 @@ public class ServerConfig {
*/
public void setDatabasePlatform(DatabasePlatform databasePlatform) {
this.databasePlatform = databasePlatform;
if (!h2ProductionMode && databasePlatform != null && databasePlatform.isPlatform(Platform.H2)) {
// we are using H2 to run tests so turn on DDL generation and run
this.ddlGenerate = true;
this.ddlRun = true;
}
}
/**
@@ -2610,7 +2578,6 @@ public class ServerConfig {
jsonDateTime = JsonConfig.DateTime.MILLIS;
}
h2ProductionMode = p.getBoolean("h2ProductionMode", h2ProductionMode);
ddlGenerate = p.getBoolean("ddl.generate", ddlGenerate);
ddlRun = p.getBoolean("ddl.run", ddlRun);
ddlCreateOnly = p.getBoolean("ddl.createOnly", ddlCreateOnly);
@@ -20,7 +20,6 @@ public class EbeanServerFactory_ServerConfigStart_Test {
config.setName("h2");
config.loadFromProperties();
config.setName("h2other");
config.setH2ProductionMode(true);
config.setDdlGenerate(false);
config.setDdlRun(false);
config.setDefaultServer(false);
@@ -34,12 +34,10 @@ public class ServerConfigTest {
props.setProperty("jdbcFetchSizeFindList", "43");
props.setProperty("backgroundExecutorShutdownSecs", "98");
props.setProperty("backgroundExecutorSchedulePoolSize", "4");
props.setProperty("h2ProductionMode", "true");
props.setProperty("dbOffline", "true");
serverConfig.loadFromProperties(props);
assertTrue(serverConfig.isH2ProductionMode());
assertTrue(serverConfig.isDbOffline());
assertEquals(PersistBatch.INSERT, serverConfig.getPersistBatch());
assertEquals(PersistBatch.INSERT, serverConfig.getPersistBatchOnCascade());
@@ -31,7 +31,6 @@ public class ModelBuild_compoundKeyTest extends BaseTestCase {
config.setName("h2");
config.loadFromProperties();
config.setName("h2other");
config.setH2ProductionMode(true);
config.setDdlGenerate(false);
config.setDdlRun(false);
config.setDefaultServer(false);
@@ -25,7 +25,6 @@ public class ModelBuild_explicitSequencesTest extends BaseTestCase {
config.setName("h2");
config.loadFromProperties();
config.setName("h2other");
config.setH2ProductionMode(true);
config.setDdlGenerate(false);
config.setDdlRun(false);
config.setDefaultServer(false);
@@ -73,7 +73,6 @@ public class BeanPersistControllerTest {
ServerConfig config = new ServerConfig();
config.setName("h2ebasicver");
config.setH2ProductionMode(true);
config.loadFromProperties();
config.setDdlGenerate(true);
config.setDdlRun(true);
@@ -52,7 +52,6 @@ public class BeanPostLoadTest extends BaseTestCase {
config.setName("h2ebasicver");
config.loadFromProperties();
config.setH2ProductionMode(true);
config.setDdlGenerate(true);
config.setDdlRun(true);
@@ -43,7 +43,6 @@ public class TestAutoCommitDataSource extends BaseTestCase {
ServerConfig config = new ServerConfig();
config.setName("h2autocommit");
config.setH2ProductionMode(true);
config.loadFromProperties();
config.setDataSource(pool);
config.setDefaultServer(false);
+2 -1
View File
@@ -119,5 +119,6 @@ datasource.pg.username=unit
datasource.pg.password=unit
datasource.pg.databaseUrl=jdbc:postgresql://127.0.0.1:5432/unit
datasource.pg.databaseDriver=org.postgresql.Driver
datasource.pg.capturestacktrace=true
datasource.pg.maxStackTraceSize=50
+3 -3
View File
@@ -79,9 +79,9 @@
<logger name="org.tests" level="INFO"/>
<logger name="io.ebean" level="INFO"/>
<logger name="io.ebean.SQL" level="TRACE"/>
<logger name="io.ebean.TXN" level="TRACE"/>
<logger name="io.ebean.SUM" level="TRACE"/>
<!--<logger name="io.ebean.SQL" level="TRACE"/>-->
<!--<logger name="io.ebean.TXN" level="TRACE"/>-->
<!--<logger name="io.ebean.SUM" level="TRACE"/>-->
<!--<logger name="io.ebean.cache.QUERY" level="TRACE"/>-->
<!--<logger name="io.ebean.cache.BEAN" level="TRACE"/>-->