mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
Fix tests only - fix tests for SqlServer
This commit is contained in:
1 parent
3244314424
commit
e8524c5b1a
3 files changed
+20
-8
No files matched your search
@@ -1,6 +1,9 @@
|
||||
package org.etest;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.annotation.Transactional;
|
||||
import io.ebean.test.ForTests;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
@@ -10,7 +13,7 @@ import org.junit.jupiter.api.Test;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
public class ForTestsBeforeAfterTest {
|
||||
public class ForTestsBeforeAfterTest extends BaseTestCase {
|
||||
|
||||
private ForTests.RollbackAll rollbackAll;
|
||||
|
||||
@@ -25,10 +28,9 @@ public class ForTestsBeforeAfterTest {
|
||||
assertThat(getCount()).isEqualTo(0);
|
||||
}
|
||||
|
||||
|
||||
@IgnorePlatform(Platform.SQLSERVER)
|
||||
@Test
|
||||
public void createRollbackAll() {
|
||||
|
||||
doInsert();
|
||||
assertThat(getCount()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package org.etest;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.annotation.Transactional;
|
||||
import io.ebean.test.ForTests;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class ForTestsTest {
|
||||
public class ForTestsTest extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void noTransactional_expect_noTransactionEnterExitCalled() {
|
||||
@@ -33,6 +36,7 @@ public class ForTestsTest {
|
||||
assertThat(transaction).isNull();
|
||||
}
|
||||
|
||||
@IgnorePlatform(Platform.SQLSERVER)
|
||||
@Test
|
||||
public void rollbackTransactions() {
|
||||
|
||||
|
||||
@@ -66,8 +66,11 @@ public class TestQueryForUpdate extends BaseTestCase {
|
||||
List<String> sql = LoggedSql.stop();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("from o_order");
|
||||
assertThat(sql.get(1)).contains("from o_customer t0 where t0.id = ? for update");
|
||||
|
||||
if (isSqlServer()) {
|
||||
assertThat(sql.get(1)).contains("from o_customer t0 with (updlock) where t0.id = ?");
|
||||
} else {
|
||||
assertThat(sql.get(1)).contains("from o_customer t0 where t0.id = ? for update");
|
||||
}
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
@@ -98,8 +101,11 @@ public class TestQueryForUpdate extends BaseTestCase {
|
||||
List<String> sql = LoggedSql.stop();
|
||||
assertThat(sql).hasSize(2);
|
||||
assertThat(sql.get(0)).contains("from o_order");
|
||||
assertThat(sql.get(1)).contains("from o_customer t0 where t0.id = ? for update");
|
||||
|
||||
if (isSqlServer()) {
|
||||
assertThat(sql.get(1)).contains("from o_customer t0 with (updlock,nowait) where t0.id = ?");
|
||||
} else {
|
||||
assertThat(sql.get(1)).contains("from o_customer t0 where t0.id = ? for update");
|
||||
}
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user