Update tests for running MySql

This commit is contained in:
rob bygrave
2018-10-24 22:59:48 +13:00
parent 1d1d479dda
commit 156469ae0f
3 changed files with 33 additions and 20 deletions
@@ -11,8 +11,8 @@ import javax.persistence.OneToOne;
@Entity
public class HsdSetting extends BaseDomain {
String key;
String val;
String code;
String content;
@SoftDelete
boolean deleted;
@@ -21,27 +21,27 @@ public class HsdSetting extends BaseDomain {
private HsdUser user;
public HsdSetting(String key) {
this.key = key;
public HsdSetting(String code) {
this.code = code;
}
public HsdSetting() {
}
public String getKey() {
return key;
public String getCode() {
return code;
}
public void setKey(String key) {
this.key = key;
public void setCode(String code) {
this.code = code;
}
public String getVal() {
return val;
public String getContent() {
return content;
}
public void setVal(String val) {
this.val = val;
public void setContent(String content) {
this.content = content;
}
public boolean isDeleted() {
@@ -16,11 +16,24 @@ public class TestQuotedIdentifierQuery extends BaseTestCase {
Ebean.save(bean);
Ebean.find(BWithQIdent.class)
.where()
.eq("name", "foo")
.raw("t0.\"Name\" = ?", "foo")
.raw("t0.\"CODE\" = ?", "bar")
.findList();
if (isMySql()) {
Ebean.find(BWithQIdent.class)
.where()
.eq("name", "foo")
.raw("t0.`Name` = ?", "foo")
.raw("t0.`CODE` = ?", "bar")
.findList();
} else if (isH2() || isPostgres()) {
Ebean.find(BWithQIdent.class)
.where()
.eq("name", "foo")
.raw("t0.\"Name\" = ?", "foo")
.raw("t0.\"CODE\" = ?", "bar")
.findList();
}
}
}
@@ -79,8 +79,8 @@ public class TestSoftDeleteBasic extends BaseTestCase {
List<String> sql = LoggedSqlCollector.stop();
assertThat(sql).hasSize(2);
assertThat(sql.get(0)).contains("from ebasic_sdchild t0 where t0.owner_id = ? and t0.deleted = false");
assertThat(sql.get(1)).contains("from ebasic_sdchild t0 where t0.owner_id = ? and t0.deleted = false");
assertThat(sql.get(0)).contains("from ebasic_sdchild t0 where t0.owner_id = ? and t0.deleted = ");
assertThat(sql.get(1)).contains("from ebasic_sdchild t0 where t0.owner_id = ? and t0.deleted = ");
}
@Test