mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1695 Add StartMyServer - docker mysql with collation options
- Adjust TestWhereLikeWithSlash ignoring slash escaping assert for mysql (due to dependency on no_backslash_escapes setting)
This commit is contained in:
@@ -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.<db>.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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -26,10 +26,11 @@ public class TestWhereLikeWithSlash extends BaseTestCase {
|
||||
Query<EBasic> query1 = Ebean.find(EBasic.class).where().like("name", "slash\\mon%").query();
|
||||
List<EBasic> 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
|
||||
|
||||
Reference in New Issue
Block a user