mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Tests only - update tests for sql server
This commit is contained in:
@@ -29,8 +29,8 @@ public class TestM2MDistinct_sqlServer extends BaseTestCase {
|
||||
|
||||
List<String> sqls = LoggedSql.stop();
|
||||
assertThat(sqls.get(0)).startsWith("select distinct t0.id, t0.name, t0.version, t0.tenant_id, t0.name collate Latin1_General_CI_AS "
|
||||
+ "from mt_role t0 join mt_role_permission u1z_ on u1z_.mt_role_id = t0.id "
|
||||
+ "join mt_permission u1 on u1.id = u1z_.mt_permission_id where u1.id = ? "
|
||||
+ "from mt_role t0 join mt_role_permission u1z_ on u1z_.mt_role_id = t0.id "
|
||||
+ "join mt_permission u1 on u1.id = u1z_.mt_permission_id where u1.id = ? "
|
||||
+ "order by t0.name collate Latin1_General_CI_AS;");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.persistence.Table;
|
||||
public class EColAB extends Model {
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
private Integer id;
|
||||
|
||||
private String columnA;
|
||||
|
||||
@@ -24,11 +24,11 @@ public class EColAB extends Model {
|
||||
this.columnB = columnB;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package org.tests.model.json;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebeantest.LoggedSql;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestJacksonPlainBean {
|
||||
public class TestJacksonPlainBean extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void insertNullStayNull() {
|
||||
@@ -46,7 +47,11 @@ public class TestJacksonPlainBean {
|
||||
bean.setPlainBean2(new PlainBean("bar", 27));
|
||||
|
||||
DB.save(bean);
|
||||
expectedSql(0, "insert into ebasic_plain (attr, plain_bean, plain_bean2, version) values (?,?,?,?)");
|
||||
if (isSqlServer()) {
|
||||
expectedSql(0, "insert into ebasic_plain (id, attr, plain_bean, plain_bean2, version) values (?,?,?,?,?)");
|
||||
} else {
|
||||
expectedSql(0, "insert into ebasic_plain (attr, plain_bean, plain_bean2, version) values (?,?,?,?)");
|
||||
}
|
||||
|
||||
// inserted plainBean has not been mutated
|
||||
bean.setAttr("attr1");
|
||||
|
||||
@@ -302,6 +302,10 @@ public class TestQueryFilterMany extends BaseTestCase {
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
|
||||
assertThat(sql).hasSize(1);
|
||||
assertSql(sql.get(0)).contains(" from o_customer t0 left join contact t1 on t1.customer_id = t0.id where (t1.first_name is not null and lower(t1.email) like ? escape'|' ) order by t0.id; --bind(rob%)");
|
||||
if (isSqlServer()) {
|
||||
assertSql(sql.get(0)).contains(" from o_customer t0 left join contact t1 on t1.customer_id = t0.id where (t1.first_name is not null and lower(t1.email) like ? ) order by t0.id; --bind(rob%)");
|
||||
} else {
|
||||
assertSql(sql.get(0)).contains(" from o_customer t0 left join contact t1 on t1.customer_id = t0.id where (t1.first_name is not null and lower(t1.email) like ? escape'|' ) order by t0.id; --bind(rob%)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ public class TestSoftDeleteBasic extends BaseTestCase {
|
||||
.query();
|
||||
|
||||
List<EBasicSoftDelete> list = query.findList();
|
||||
if (isMySql() || isMariaDB()) {
|
||||
if (isMySql() || isMariaDB() || isSqlServer()) {
|
||||
assertSql(query).contains("t0.deleted = 0");
|
||||
assertSql(query).contains("u1.deleted = 0");
|
||||
} else {
|
||||
@@ -277,7 +277,7 @@ public class TestSoftDeleteBasic extends BaseTestCase {
|
||||
|
||||
List<EBasicNoSDChild> list = query.findList();
|
||||
// Make sure that query includes that the child mustn't've been deleted
|
||||
if (isMySql() || isMariaDB()) {
|
||||
if (isMySql() || isMariaDB() || isSqlServer()) {
|
||||
assertSql(query).contains("u1.deleted = 0");
|
||||
assertSql(query).contains("u2.deleted = 0");
|
||||
} else {
|
||||
|
||||
+5
-1
@@ -60,7 +60,11 @@ public class TestSoftDeleteOptionalRelationship extends BaseTestCase {
|
||||
|
||||
final List<String> sql = LoggedSqlCollector.stop();
|
||||
assertThat(sql).hasSize(1);
|
||||
assertThat(sql.get(0)).contains("left join esoft_del_z t1 on t1.id = t0.organization_id and t1.deleted = false where");
|
||||
if (isSqlServer()) {
|
||||
assertThat(sql.get(0)).contains("left join esoft_del_z t1 on t1.id = t0.organization_id and t1.deleted = 0 where");
|
||||
} else {
|
||||
assertThat(sql.get(0)).contains("left join esoft_del_z t1 on t1.id = t0.organization_id and t1.deleted = false where");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user