mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
Yugabyte - Tidy tests
This commit is contained in:
1 parent
3a84cb8623
commit
567ad92050
4 files changed
+26
-33
No files matched your search
@@ -11,6 +11,7 @@ public class StartYugabyte {
|
||||
YugabyteConfig config = new YugabyteConfig("2.11.2.0-b89");
|
||||
config.setDbName("unit");
|
||||
config.setUser("unit");
|
||||
config.setExtensions("pgcrypto");
|
||||
|
||||
YugabyteContainer container = new YugabyteContainer(config);
|
||||
container.start();
|
||||
|
||||
@@ -49,7 +49,7 @@ public class TestMetaAnnotation extends BaseTestCase {
|
||||
* This test writes 101 spaces to "line1" which is annotated with @Size(max=100).
|
||||
*/
|
||||
@Test
|
||||
@IgnorePlatform({Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB, Platform.DB2}) // pg & mssql does not fail if string is too long.
|
||||
@IgnorePlatform({Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB, Platform.DB2, Platform.YUGABYTE}) // pg & mssql does not fail if string is too long.
|
||||
public void testWrite101SpacesToLine1() {
|
||||
|
||||
Address address = new Address();
|
||||
@@ -66,7 +66,7 @@ public class TestMetaAnnotation extends BaseTestCase {
|
||||
* This test writes 101 spaces to "line1" which is meta-annotated with {@link SizeMedium}.
|
||||
*/
|
||||
@Test
|
||||
@IgnorePlatform({Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB, Platform.DB2})
|
||||
@IgnorePlatform({Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL, Platform.MARIADB, Platform.DB2, Platform.YUGABYTE})
|
||||
public void testWrite101SpacesToLine2() {
|
||||
|
||||
Address address = new Address();
|
||||
|
||||
@@ -2,29 +2,21 @@ package org.tests.expression.bitwise;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestBitwiseExpressions extends BaseTestCase {
|
||||
class TestBitwiseExpressions extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void where() {
|
||||
|
||||
setup();
|
||||
bitwiseNot();
|
||||
bitwiseAnd();
|
||||
bitwiseAny();
|
||||
bitwiseAll();
|
||||
}
|
||||
|
||||
private void bitwiseNot() {
|
||||
|
||||
void bitwiseNot() {
|
||||
List<BwBean> notColour = DB.find(BwBean.class)
|
||||
// HAS_COLOUR not set ...
|
||||
.where().bitwiseNot("flags", BwFlags.HAS_COLOUR)
|
||||
.orderBy("name")
|
||||
.findList();
|
||||
|
||||
assertThat(notColour).hasSize(2);
|
||||
@@ -32,8 +24,8 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
assertThat(notColour.get(1).getName()).isEqualTo("SizeOnly");
|
||||
}
|
||||
|
||||
private void bitwiseAnd() {
|
||||
|
||||
@Test
|
||||
void bitwiseAnd() {
|
||||
List<BwBean> list = DB.find(BwBean.class)
|
||||
// not bulk set AND size set
|
||||
.where().bitwiseAnd("flags", BwFlags.HAS_BULK + BwFlags.HAS_SIZE, BwFlags.HAS_SIZE)
|
||||
@@ -59,10 +51,11 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
assertThat(list.get(0).getName()).isEqualTo("ColourOnly");
|
||||
}
|
||||
|
||||
private void bitwiseAny() {
|
||||
|
||||
@Test
|
||||
void bitwiseAny() {
|
||||
List<BwBean> list = DB.find(BwBean.class)
|
||||
.where().bitwiseAny("flags", BwFlags.HAS_BULK + BwFlags.HAS_SIZE)
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(3);
|
||||
@@ -70,21 +63,23 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
assertThat(list.get(1).getName()).isEqualTo("ColourAndBulk");
|
||||
assertThat(list.get(2).getName()).isEqualTo("Everything");
|
||||
|
||||
|
||||
list = DB.find(BwBean.class)
|
||||
.where().bitwiseAny("flags", BwFlags.HAS_BULK + BwFlags.HAS_SIZE + BwFlags.HAS_COLOUR)
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(4);
|
||||
|
||||
list = DB.find(BwBean.class)
|
||||
.where().bitwiseAny("flags", BwFlags.HAS_SIZE + BwFlags.HAS_COLOUR)
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(4);
|
||||
|
||||
list = DB.find(BwBean.class)
|
||||
.where().bitwiseAny("flags", BwFlags.HAS_SIZE)
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(2);
|
||||
@@ -93,6 +88,7 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
|
||||
list = DB.find(BwBean.class)
|
||||
.where().bitwiseAny("flags", BwFlags.HAS_COLOUR)
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
assertThat(list).hasSize(3);
|
||||
@@ -101,8 +97,8 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
assertThat(list.get(2).getName()).isEqualTo("Everything");
|
||||
}
|
||||
|
||||
private void bitwiseAll() {
|
||||
|
||||
@Test
|
||||
void bitwiseAll() {
|
||||
List<BwBean> list = DB.find(BwBean.class)
|
||||
.where().bitwiseAll("flags", BwFlags.HAS_BULK + BwFlags.HAS_SIZE)
|
||||
.findList();
|
||||
@@ -137,11 +133,10 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
assertThat(list.get(0).getName()).isEqualTo("ColourOnly");
|
||||
assertThat(list.get(1).getName()).isEqualTo("ColourAndBulk");
|
||||
assertThat(list.get(2).getName()).isEqualTo("Everything");
|
||||
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
DB.find(BwBean.class).delete();
|
||||
|
||||
new BwBean("Nothing", BwFlags.NOTHING).save();
|
||||
@@ -149,6 +144,5 @@ public class TestBitwiseExpressions extends BaseTestCase {
|
||||
new BwBean("SizeOnly", BwFlags.HAS_SIZE).save();
|
||||
new BwBean("ColourAndBulk", BwFlags.HAS_COLOUR + BwFlags.HAS_BULK).save();
|
||||
new BwBean("Everything", BwFlags.HAS_COLOUR + BwFlags.HAS_BULK + BwFlags.HAS_SIZE).save();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,14 @@ import org.tests.model.m2m.MnyB;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
public class TestCommitAndContinue extends BaseTestCase {
|
||||
class TestCommitAndContinue extends BaseTestCase {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("org.avaje.ebean.TXN");
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
@IgnorePlatform({Platform.SQLSERVER, Platform.HSQLDB, Platform.COCKROACH}) // they will dead lock
|
||||
public void transactional_partialSuccess() {
|
||||
void transactional_partialSuccess() {
|
||||
|
||||
MnyB a = new MnyB("a100");
|
||||
MnyB b = new MnyB("b200");
|
||||
@@ -58,7 +58,7 @@ public class TestCommitAndContinue extends BaseTestCase {
|
||||
*/
|
||||
@Test
|
||||
@IgnorePlatform({Platform.SQLSERVER, Platform.HSQLDB, Platform.COCKROACH}) // they will dead lock
|
||||
public void tryFinally_partialSuccess() {
|
||||
void tryFinally_partialSuccess() {
|
||||
|
||||
MnyB a = new MnyB("a100");
|
||||
MnyB b = new MnyB("b200");
|
||||
@@ -69,7 +69,6 @@ public class TestCommitAndContinue extends BaseTestCase {
|
||||
a.save();
|
||||
// commit at this point
|
||||
txn.commitAndContinue();
|
||||
|
||||
try {
|
||||
b.save();
|
||||
|
||||
@@ -102,7 +101,7 @@ public class TestCommitAndContinue extends BaseTestCase {
|
||||
@Test
|
||||
@Transactional
|
||||
@IgnorePlatform({Platform.SQLSERVER, Platform.HSQLDB, Platform.COCKROACH}) // they will dead lock
|
||||
public void transactional_partialSuccess_secondTransactionInsert() {
|
||||
void transactional_partialSuccess_secondTransactionInsert() {
|
||||
|
||||
MnyB a = new MnyB("a100");
|
||||
MnyB b = new MnyB("b200");
|
||||
@@ -150,8 +149,7 @@ public class TestCommitAndContinue extends BaseTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void basic() {
|
||||
|
||||
void basic() {
|
||||
MnyB a = new MnyB("a");
|
||||
MnyB b = new MnyB("b");
|
||||
MnyB c = new MnyB("c");
|
||||
@@ -176,7 +174,7 @@ public class TestCommitAndContinue extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void runTransactional() {
|
||||
void runTransactional() {
|
||||
|
||||
new MnyB("a100").save();
|
||||
new MnyB("a101").save();
|
||||
|
||||
Reference in new issue
Block a user