mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2357 - Update tests to move away from deprecated methods
This commit is contained in:
+3
-8
@@ -1,7 +1,6 @@
|
||||
package io.ebeaninternal.server.cluster.binarymessage;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.EbeanServer;
|
||||
import io.ebeaninternal.api.TDSpiEbeanServer;
|
||||
import io.ebeaninternal.api.TransactionEventTable;
|
||||
@@ -26,11 +25,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class BinaryTransactionEventReadWriteTest extends BaseTestCase {
|
||||
|
||||
private BeanDescriptor<Customer> customerBeanDescriptor = getBeanDescriptor(Customer.class);
|
||||
|
||||
private TDEbeanServer mockEbeanServer = new TDEbeanServer();
|
||||
|
||||
private BinaryTransactionEventReader reader = new BinaryTransactionEventReader(new TDServerLookup());
|
||||
private final BeanDescriptor<Customer> customerBeanDescriptor = getBeanDescriptor(Customer.class);
|
||||
private final TDEbeanServer mockEbeanServer = new TDEbeanServer();
|
||||
private final BinaryTransactionEventReader reader = new BinaryTransactionEventReader(new TDServerLookup());
|
||||
|
||||
@Override
|
||||
protected <T> BeanDescriptor<T> getBeanDescriptor(Class<T> cls) {
|
||||
@@ -80,7 +77,6 @@ public class BinaryTransactionEventReadWriteTest extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void readWrite_RemoteTableMod() throws IOException {
|
||||
|
||||
RemoteTransactionEvent event = new RemoteTransactionEvent("db");
|
||||
|
||||
Set<String> tables = new HashSet<>();
|
||||
@@ -96,7 +92,6 @@ public class BinaryTransactionEventReadWriteTest extends BaseTestCase {
|
||||
}
|
||||
|
||||
class TDServerLookup implements ServerLookup {
|
||||
|
||||
@Override
|
||||
public EbeanServer getServer(String name) {
|
||||
return mockEbeanServer;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class TestM2MVanilla extends BaseTestCase {
|
||||
@Test
|
||||
public void testVanilla() {
|
||||
|
||||
DB.createSqlUpdate("delete from mrole_muser").execute();
|
||||
DB.sqlUpdate("delete from mrole_muser").execute();
|
||||
DB.sqlUpdate("delete from mrole").execute();
|
||||
DB.sqlUpdate("delete from muser").execute();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TestEncryptBinary extends BaseTestCase {
|
||||
|
||||
DB.save(e);
|
||||
|
||||
SqlRow row = DB.createSqlQuery("select * from e_basicenc_bin where id = :id")
|
||||
SqlRow row = DB.sqlQuery("select * from e_basicenc_bin where id = :id")
|
||||
.setParameter("id", e.getId())
|
||||
.findOne();
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class TestBatchOnCascadeExceptionHandling extends BaseTestCase {
|
||||
Transaction txn = server().beginTransaction();
|
||||
try {
|
||||
EBasicWithUniqueCon v2 = createEntityWithName("conflict", "after");
|
||||
txn.flushBatch();
|
||||
txn.flush();
|
||||
Savepoint sp = txn.getConnection().setSavepoint();
|
||||
try {
|
||||
server().save(v2); // unique key violation
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.tests.model.basic.mapsuper;
|
||||
|
||||
import io.ebean.annotation.CreatedTimestamp;
|
||||
import io.ebean.annotation.WhenCreated;
|
||||
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.Version;
|
||||
@@ -9,7 +9,7 @@ import java.sql.Timestamp;
|
||||
@MappedSuperclass
|
||||
public class MapSuperNoId {
|
||||
|
||||
@CreatedTimestamp
|
||||
@WhenCreated
|
||||
Timestamp whenCreated;
|
||||
|
||||
@Version
|
||||
|
||||
@@ -17,11 +17,11 @@ public class TestDeleteUnloadedChildren extends BaseTestCase {
|
||||
SqlUpdate delete;
|
||||
|
||||
sql = "delete from td_child";
|
||||
delete = DB.createSqlUpdate(sql);
|
||||
delete = DB.sqlUpdate(sql);
|
||||
delete.execute();
|
||||
|
||||
sql = "delete from td_parent";
|
||||
delete = DB.createSqlUpdate(sql);
|
||||
delete = DB.sqlUpdate(sql);
|
||||
delete.execute();
|
||||
|
||||
EdParent parent = new EdParent();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.tests.model.embedded;
|
||||
|
||||
import io.ebean.Model;
|
||||
import io.ebean.annotation.CreatedTimestamp;
|
||||
import io.ebean.annotation.WhenCreated;
|
||||
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
@@ -13,7 +13,7 @@ public class UserInterestLive extends Model {
|
||||
@EmbeddedId
|
||||
private final UserInterestLiveKey key;
|
||||
|
||||
@CreatedTimestamp
|
||||
@WhenCreated
|
||||
private Date createdAt;
|
||||
|
||||
public UserInterestLive(UserInterestLiveKey key) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.tests.model.joda;
|
||||
|
||||
import io.ebean.annotation.CreatedTimestamp;
|
||||
import io.ebean.annotation.UpdatedTimestamp;
|
||||
import io.ebean.annotation.WhenCreated;
|
||||
import io.ebean.annotation.WhenModified;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
@@ -19,10 +19,10 @@ public class BasicJodaEntity {
|
||||
|
||||
String name;
|
||||
|
||||
@CreatedTimestamp
|
||||
@WhenCreated
|
||||
LocalDateTime created;
|
||||
|
||||
@UpdatedTimestamp
|
||||
@WhenModified
|
||||
DateTime updated;
|
||||
|
||||
Period period;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.tests.model.noid;
|
||||
|
||||
import io.ebean.annotation.CreatedTimestamp;
|
||||
import io.ebean.annotation.WhenCreated;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
@@ -14,7 +14,7 @@ public class NoIdBean {
|
||||
|
||||
String subject;
|
||||
|
||||
@CreatedTimestamp
|
||||
@WhenCreated
|
||||
Timestamp whenCreated;
|
||||
|
||||
public String getName() {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TestOneToManyJoinTable extends BaseTestCase {
|
||||
|
||||
long intersectionRows = DB.sqlQuery("select count(*) as total from troop_monkey where troop_pid = ?")
|
||||
.setParameter(1, troop.getPid())
|
||||
.findSingleLong();
|
||||
.mapToScalar(Long.class).findOne();
|
||||
|
||||
assertThat(intersectionRows).isEqualTo(2L);
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ public class TestQueryFindNative extends BaseTestCase {
|
||||
|
||||
List<Integer> ids = DB.sqlQuery(sql)
|
||||
.setParameter(1, "J%")
|
||||
.findSingleAttributeList(Integer.class);
|
||||
.mapToScalar(Integer.class).findList();
|
||||
|
||||
List<Integer> idsScalar =
|
||||
server()
|
||||
|
||||
Reference in New Issue
Block a user