diff --git a/src/test/java/main/StartMyServer.java b/src/test/java/main/StartMyServer.java new file mode 100644 index 000000000..de04e1625 --- /dev/null +++ b/src/test/java/main/StartMyServer.java @@ -0,0 +1,28 @@ +package main; + +import io.ebean.docker.commands.MySqlConfig; +import io.ebean.docker.commands.MySqlContainer; + +public class StartMyServer { + + public static void main(String[] args) { + + MySqlConfig config = new MySqlConfig("5.7"); + config.setDbName("unit"); + config.setUser("unit"); + config.setPassword("unit"); + + // by default this mysql docker collation is case sensitive + // using utf8mb4_bin + // + // when changing to a CI collation (e.g. utf8mb4_unicode_ci) we also set + // ebean..caseSensitiveCollation=false + // ... such that tests now take that into account +// config.setCollation("default"); +// config.setCollation("utf8mb4_unicode_ci"); +// config.setCharacterSet("utf8mb4"); + + MySqlContainer container = new MySqlContainer(config); + container.start(); + } +} diff --git a/src/test/java/main/StartSqlServer.java b/src/test/java/main/StartSqlServer.java index a158133ae..7eea22376 100644 --- a/src/test/java/main/StartSqlServer.java +++ b/src/test/java/main/StartSqlServer.java @@ -17,6 +17,8 @@ public class StartSqlServer { // when changing to a CI collation also use // ebean.sqlserver.caseSensitiveCollation=false // ... such that tests now take that into account + + //config.setCollation("default"); //config.setCollation("Latin1_General_100_CI"); SqlServerContainer container = new SqlServerContainer(config); diff --git a/src/test/java/org/tests/query/other/TestWhereLikeWithSlash.java b/src/test/java/org/tests/query/other/TestWhereLikeWithSlash.java index f08e57eec..328682e7a 100644 --- a/src/test/java/org/tests/query/other/TestWhereLikeWithSlash.java +++ b/src/test/java/org/tests/query/other/TestWhereLikeWithSlash.java @@ -26,10 +26,11 @@ public class TestWhereLikeWithSlash extends BaseTestCase { Query query1 = Ebean.find(EBasic.class).where().like("name", "slash\\mon%").query(); List list1 = query1.findList(); - // This doesn't work in the latest version of H2 so disable for now. - // Still good on Postgres which was the original issue - assertEquals(1, list1.size()); - + if (!isMySql()) { + // For mysql this assert depends on no_backslash_escapes setting so we won't assert here + // Still good on Postgres which was the original issue + assertEquals(1, list1.size()); + } } @Test diff --git a/src/test/resources/ebean.properties b/src/test/resources/ebean.properties index 3943c47f4..43fd2954c 100644 --- a/src/test/resources/ebean.properties +++ b/src/test/resources/ebean.properties @@ -131,10 +131,10 @@ datasource.hsqldb.databaseDriver=org.hsqldb.jdbcDriver # Set caseSensitiveCollation to false when using # MySql with case insenstive collation -ebean.mysql.caseSensitiveCollation=false +#ebean.mysql.caseSensitiveCollation=false datasource.mysql.username=unit datasource.mysql.password=unit -datasource.mysql.databaseUrl=jdbc:mysql://127.0.0.1:3306/unit +datasource.mysql.databaseUrl=jdbc:mysql://127.0.0.1:4306/unit #datasource.mysql.username=test_ebean #datasource.mysql.password=test #datasource.mysql.databaseUrl=jdbc:mysql://127.0.0.1:4306/test_ebean