mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
Refactor move tests from ebean-core to ebean-test
This commit is contained in:
1 parent
0b00a14fd3
commit
eab56d323b
1650 files changed
+185
-147
No files matched your search
@@ -0,0 +1,46 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.Model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
public class EIdUidBean extends Model {
|
||||
|
||||
@Id
|
||||
private long id;
|
||||
|
||||
@GeneratedValue
|
||||
@Column(unique = true)
|
||||
private UUID uuid;
|
||||
|
||||
String name;
|
||||
|
||||
public EIdUidBean(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Database;
|
||||
import org.tests.model.basic.EBasic;
|
||||
import org.tests.model.basic.EBasic.Status;
|
||||
|
||||
public class MainDbCopy {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Database defaultServer = DB.getDefault();
|
||||
|
||||
EBasic e = new EBasic();
|
||||
e.setName("blah");
|
||||
e.setStatus(Status.NEW);
|
||||
e.setDescription(null);
|
||||
|
||||
defaultServer.save(e);
|
||||
|
||||
EBasic e1 = defaultServer.find(EBasic.class, e.getId());
|
||||
|
||||
Database serverDest = DB.byName("mysql");
|
||||
serverDest.insert(e1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class OnlyIdEntity {
|
||||
|
||||
@Id
|
||||
long id;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.plugin.Property;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.draftable.Document;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestInsertCheckUnique extends BaseTestCase {
|
||||
|
||||
@BeforeEach
|
||||
public void clearDb() {
|
||||
DB.find(Document.class).asDraft().where().contains("title", "UniqueKey").delete();
|
||||
DB.find(Document.class).asDraft().where().isNull("title").delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insert_duplicateKey() {
|
||||
|
||||
try (Transaction transaction = DB.beginTransaction()) {
|
||||
Document doc1 = new Document();
|
||||
doc1.setTitle("AUniqueKey_duplicateCheck");
|
||||
doc1.setBody("one");
|
||||
|
||||
assertThat(DB.checkUniqueness(doc1)).isEmpty();
|
||||
doc1.save();
|
||||
|
||||
Document doc2 = new Document();
|
||||
doc2.setTitle("AUniqueKey_duplicateCheck");
|
||||
doc2.setBody("clashes with doc1");
|
||||
|
||||
assertThat(DB.checkUniqueness(doc2)).isEmpty();
|
||||
|
||||
DB.getDefault().publish(doc1.getClass(), doc1.getId());
|
||||
|
||||
assertThat(DB.checkUniqueness(doc2).toString()).contains("title");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insert_duplicateNull() {
|
||||
try (Transaction transaction = DB.beginTransaction()) {
|
||||
Document doc1 = new Document();
|
||||
doc1.setTitle(null);
|
||||
doc1.setBody("one");
|
||||
|
||||
assertThat(DB.checkUniqueness(doc1)).isEmpty();
|
||||
doc1.save();
|
||||
|
||||
Document doc2 = new Document();
|
||||
doc2.setTitle(null);
|
||||
doc2.setBody("clashes with doc1");
|
||||
|
||||
assertThat(DB.checkUniqueness(doc2)).isEmpty();
|
||||
|
||||
DB.getDefault().publish(doc1.getClass(), doc1.getId());
|
||||
|
||||
assertThat(DB.checkUniqueness(doc2)).isEmpty();
|
||||
|
||||
doc2.save();
|
||||
DB.getDefault().publish(doc2.getClass(), doc2.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void example() {
|
||||
|
||||
try (Transaction transaction = DB.beginTransaction()) {
|
||||
Document doc1 = new Document();
|
||||
doc1.setTitle("One flew over the cuckoo's nest");
|
||||
doc1.setBody("one");
|
||||
doc1.save();
|
||||
|
||||
DB.getDefault().publish(doc1.getClass(), doc1.getId());
|
||||
|
||||
Document doc2 = new Document();
|
||||
doc2.setTitle("One flew over the cuckoo's nest");
|
||||
doc2.setBody("clashes with doc1");
|
||||
|
||||
Set<Property> properties = DB.checkUniqueness(doc2);
|
||||
if (properties.isEmpty()) {
|
||||
// it is unique ... carry on
|
||||
} else {
|
||||
// build a user friendly message
|
||||
// to return message back to user
|
||||
|
||||
String uniqueProperties = properties.toString();
|
||||
|
||||
StringBuilder msg = new StringBuilder();
|
||||
|
||||
properties.forEach((it)-> {
|
||||
Object propertyValue = it.value(doc2);
|
||||
String propertyName = it.name();
|
||||
msg.append(" property["+propertyName+"] value["+propertyValue+"]");
|
||||
});
|
||||
|
||||
System.out.println("uniqueProperties > "+uniqueProperties);
|
||||
System.out.println(" custom msg > " + msg.toString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
assertThat(DB.checkUniqueness(doc2).toString()).contains("title");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TestInsertCollection extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
Customer cust1 = new Customer();
|
||||
cust1.setName("jim");
|
||||
|
||||
Customer cust2 = new Customer();
|
||||
cust2.setName("bob");
|
||||
|
||||
List<Customer> customers = new ArrayList<>();
|
||||
customers.add(cust1);
|
||||
customers.add(cust2);
|
||||
|
||||
DB.insertAll(customers);
|
||||
|
||||
assertNotNull(cust1.getId());
|
||||
assertNotNull(cust2.getId());
|
||||
|
||||
Customer cust1Check = DB.find(Customer.class, cust1.getId());
|
||||
assertEquals(cust1.getName(), cust1Check.getName());
|
||||
Customer cust2Check = DB.find(Customer.class, cust2.getId());
|
||||
assertEquals(cust2.getName(), cust2Check.getName());
|
||||
|
||||
cust1.setName("jim-changed");
|
||||
cust2.setName("bob-changed");
|
||||
|
||||
DB.updateAll(customers);
|
||||
awaitL2Cache();
|
||||
|
||||
Customer cust1Check2 = DB.find(Customer.class, cust1.getId());
|
||||
assertEquals("jim-changed", cust1Check2.getName());
|
||||
Customer cust2Check2 = DB.find(Customer.class, cust2.getId());
|
||||
assertEquals("bob-changed", cust2Check2.getName());
|
||||
|
||||
|
||||
cust1Check2.setName("jim-updated");
|
||||
Customer cust3 = new Customer();
|
||||
cust3.setName("mac");
|
||||
|
||||
List<Customer> saveList = new ArrayList<>();
|
||||
saveList.add(cust1Check2);
|
||||
saveList.add(cust3);
|
||||
|
||||
DB.saveAll(saveList);
|
||||
awaitL2Cache();
|
||||
|
||||
|
||||
Customer cust1Check3 = DB.find(Customer.class, cust1.getId());
|
||||
assertEquals("jim-updated", cust1Check3.getName());
|
||||
Customer cust3Check = DB.find(Customer.class, cust3.getId());
|
||||
assertEquals("mac", cust3Check.getName());
|
||||
|
||||
List<Customer> deleteList = new ArrayList<>();
|
||||
deleteList.add(cust1Check3);
|
||||
deleteList.add(cust3);
|
||||
deleteList.add(cust2Check2);
|
||||
|
||||
DB.deleteAll(deleteList);
|
||||
awaitL2Cache();
|
||||
|
||||
assertNull(DB.find(Customer.class, cust1Check3.getId()));
|
||||
assertNull(DB.find(Customer.class, cust2Check2.getId()));
|
||||
assertNull(DB.find(Customer.class, cust3.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.DataIntegrityException;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class TestInsertDataIntegrityException extends BaseTestCase {
|
||||
|
||||
|
||||
@IgnorePlatform(Platform.NUODB)
|
||||
@Test
|
||||
public void insert_invalidForeignKey() {
|
||||
ResetBasicData.reset();
|
||||
|
||||
// an invalid foreign key value
|
||||
Customer invalidCustomer = DB.reference(Customer.class, 900000);
|
||||
|
||||
Order order = new Order();
|
||||
order.setStatus(Order.Status.NEW);
|
||||
order.setCustomer(invalidCustomer);
|
||||
|
||||
assertThrows(DataIntegrityException.class, () -> DB.save(order));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DuplicateKeyException;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.annotation.Transactional;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.tests.model.draftable.Document;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class TestInsertDuplicateKey extends BaseTestCase {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(TestInsertDuplicateKey.class);
|
||||
|
||||
@BeforeEach
|
||||
public void clearDb() {
|
||||
server().find(Document.class).asDraft().where().contains("title", "UniqueKey").delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insert_duplicateKey() {
|
||||
Document doc1 = new Document();
|
||||
doc1.setTitle("ThisIsAUniqueKey");
|
||||
doc1.setBody("one");
|
||||
doc1.save();
|
||||
|
||||
assertThrows(DuplicateKeyException.class, () -> {
|
||||
Document doc2 = new Document();
|
||||
doc2.setTitle("ThisIsAUniqueKey");
|
||||
doc2.setBody("clashes with doc1");
|
||||
doc2.save();
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insertBatch_duplicateKey() {
|
||||
assertThrows(DuplicateKeyException.class, this::insertBatch_duplicateKey_action);
|
||||
}
|
||||
|
||||
@Transactional(batchSize = 100)
|
||||
void insertBatch_duplicateKey_action() {
|
||||
Document doc1 = new Document();
|
||||
doc1.setTitle("ThisIsASecondUniqueKey");
|
||||
doc1.setBody("one");
|
||||
doc1.save();
|
||||
|
||||
Document doc2 = new Document();
|
||||
doc2.setTitle("ThisIsASecondUniqueKey");
|
||||
doc2.setBody("clash when batch flushed");
|
||||
doc2.save();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void insertBatch_duplicateKey_catchAndContinue() {
|
||||
|
||||
insertTheBatch_duplicateKey_catchAndContinue();
|
||||
|
||||
List<Document> found = DB.getDefault()
|
||||
.find(Document.class)
|
||||
.asDraft()
|
||||
.where().startsWith("body", "insertTheBatch_duplicateKey_catchAndContinue")
|
||||
.findList();
|
||||
|
||||
assertThat(found).hasSize(1);
|
||||
assertThat(found.get(0).getTitle()).isEqualTo("ThisIsAThirdUniqueKey");
|
||||
assertThat(found.get(0).getBody()).isEqualTo("insertTheBatch_duplicateKey_catchAndContinue-1");
|
||||
}
|
||||
|
||||
@Transactional//(batchSize = 100)
|
||||
private void insertTheBatch_duplicateKey_catchAndContinue() {
|
||||
|
||||
Document doc1 = new Document();
|
||||
doc1.setTitle("ThisIsAThirdUniqueKey");
|
||||
doc1.setBody("insertTheBatch_duplicateKey_catchAndContinue-1");
|
||||
doc1.save();
|
||||
|
||||
try {
|
||||
Document doc2 = new Document();
|
||||
doc2.setTitle("ThisIsAThirdUniqueKey");
|
||||
doc2.setBody("insertTheBatch_duplicateKey_catchAndContinue-2");
|
||||
doc2.save();
|
||||
|
||||
// flush at this point, fails
|
||||
DB.getDefault().currentTransaction().flush();
|
||||
} catch (DuplicateKeyException e) {
|
||||
log.info("duplicate failed but just continue" + e.getMessage());
|
||||
try {
|
||||
// typically we would use transaction.commitAndContinue()
|
||||
// ... this is a rollback and continue type scenario
|
||||
// ... more sensible to use a second transaction that do this
|
||||
DB.getDefault().currentTransaction().connection().rollback();
|
||||
} catch (SQLException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Document doc0 = new Document();
|
||||
doc0.setTitle("ThisIsAThirdUniqueKey");
|
||||
doc0.setBody("insertTheBatch_duplicateKey_catchAndContinue-1");
|
||||
doc0.save();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import org.tests.model.orderentity.OrderEntity;
|
||||
import org.tests.model.orderentity.OrderItemEntity;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class TestInsertOnStringKey extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
|
||||
OrderEntity orderEntity = new OrderEntity();
|
||||
orderEntity.setId("anyOrderId" + new Random().nextInt());
|
||||
|
||||
OrderItemEntity orderItemEntity = new OrderItemEntity();
|
||||
orderItemEntity.setId("anyOrderItemId" + new Random().nextInt());
|
||||
orderItemEntity.setVariantId("anyVariantId");
|
||||
orderItemEntity.setAmount(BigDecimal.ONE);
|
||||
|
||||
orderEntity.setItems(toList(orderItemEntity));
|
||||
|
||||
DB.save(orderEntity);
|
||||
|
||||
}
|
||||
|
||||
private List<OrderItemEntity> toList(OrderItemEntity orderItemEntity) {
|
||||
List<OrderItemEntity> list = new ArrayList<>();
|
||||
list.add(orderItemEntity);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestInsertWithIdAndUuid extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void insert() {
|
||||
|
||||
EIdUidBean bean = new EIdUidBean("one");
|
||||
bean.save();
|
||||
|
||||
assertThat(bean.getId()).isGreaterThan(0);
|
||||
assertThat(bean.getUuid()).isNotNull();
|
||||
|
||||
final EIdUidBean found = DB.find(EIdUidBean.class, bean.getId());
|
||||
|
||||
assertThat(bean.getId()).isEqualTo(found.getId());
|
||||
assertThat(bean.getUuid()).isEqualTo(found.getUuid());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Database;
|
||||
import io.ebean.annotation.ForPlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestOnlyIdEntity extends BaseTestCase {
|
||||
|
||||
@ForPlatform({Platform.H2, Platform.POSTGRES})
|
||||
@Test
|
||||
public void insert() {
|
||||
|
||||
final Database database = DB.getDefault();
|
||||
|
||||
LoggedSqlCollector.start();
|
||||
OnlyIdEntity bean = new OnlyIdEntity();
|
||||
database.save(bean);
|
||||
|
||||
List<String> sql = LoggedSqlCollector.stop();
|
||||
|
||||
assertThat(bean.getId()).isGreaterThan(0);
|
||||
assertThat(sql).hasSize(1);
|
||||
assertSql(sql.get(0)).contains("insert into only_id_entity default values");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package org.tests.insert;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
// CURRENTLY this test is failing with an upgrade of H2 so investigating that ...
|
||||
|
||||
public class TestSaveWithDaylightSavings extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
// // For it to fail, the time has to match the time at which the daylight saving changes
|
||||
// // are applied in that time zone. Therefore specify it explicitly.
|
||||
//
|
||||
// TimeZone defaultTimeZone = TimeZone.getDefault();
|
||||
// try {
|
||||
//
|
||||
// TimeZone.setDefault(TimeZone.getTimeZone("EET"));
|
||||
//
|
||||
// // Run the code and see how there is a 3600 second change
|
||||
// Timestamp daylightSavingDate = new Timestamp(1351382400000l);
|
||||
// // On a second run comment in the following date and see
|
||||
// // how there is a 0 second change
|
||||
// // daylightSavingDate = new Date(1361382400000l);
|
||||
//
|
||||
// EBasic e = new EBasic();
|
||||
// e.setSomeDate(daylightSavingDate);
|
||||
//
|
||||
// DB.save(e);
|
||||
// Assert.assertNotNull(e.getId());
|
||||
//
|
||||
// // Reload the entity from database
|
||||
// EBasic e2 = DB.find(EBasic.class, e.getId());
|
||||
//
|
||||
// long diffMillis = e2.getSomeDate().getTime() - e.getSomeDate().getTime();
|
||||
//
|
||||
// System.out.println("The date I created " + daylightSavingDate);
|
||||
// System.out.println(" --- the date i put in : " + e.getSomeDate());
|
||||
// System.out.println(" as millis : " + e.getSomeDate().getTime());
|
||||
// System.out.println(" --- the date i get back : " + e2.getSomeDate());
|
||||
// System.out.println(" as millis : " + e2.getSomeDate().getTime());
|
||||
// System.out.println("The difference is " + diffMillis / 1000 + " seconds");
|
||||
//
|
||||
// assertEquals(0L, diffMillis);
|
||||
//
|
||||
// } finally {
|
||||
// TimeZone.setDefault(defaultTimeZone);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirect() throws SQLException {
|
||||
|
||||
// // For it to fail, the time has to match the time at which the daylight saving changes
|
||||
// // are applied in that time zone. Therefore specify it explicitly.
|
||||
//
|
||||
// Database server = DB.getDefault();
|
||||
//
|
||||
// Transaction transaction = server.createTransaction();
|
||||
// Connection connection = transaction.getConnection();
|
||||
//
|
||||
// PreparedStatement pstmt = connection.prepareStatement("create table dls_test (id bigint auto_increment not null, myts timestamp)");
|
||||
// pstmt.execute();
|
||||
// pstmt.close();
|
||||
//
|
||||
// TimeZone defaultTimeZone = TimeZone.getDefault();
|
||||
// try {
|
||||
//
|
||||
// TimeZone.setDefault(TimeZone.getTimeZone("EET"));
|
||||
//
|
||||
// // Run the code and see how there is a 3600 second change
|
||||
// Timestamp daylightSavingDate = new Timestamp(1351382400000l);
|
||||
// // On a second run comment in the following date and see
|
||||
// // how there is a 0 second change
|
||||
// // daylightSavingDate = new Date(1361382400000l);
|
||||
//
|
||||
// pstmt = connection.prepareStatement("insert into dls_test (myts) values (?)");
|
||||
// pstmt.setTimestamp(1, daylightSavingDate);
|
||||
// assertEquals(1, pstmt.executeUpdate());
|
||||
// pstmt.close();
|
||||
//
|
||||
// pstmt = connection.prepareStatement("select myts from dls_test ");
|
||||
// ResultSet rset = pstmt.executeQuery();
|
||||
// rset.next();
|
||||
// Timestamp timestampBack = rset.getTimestamp(1);
|
||||
// pstmt.close();
|
||||
// rset.close();
|
||||
//
|
||||
//
|
||||
// long diffMillis = daylightSavingDate.getTime() - timestampBack.getTime();
|
||||
//
|
||||
// System.out.println(" --- the date i put in : " + daylightSavingDate);
|
||||
// System.out.println(" as millis : " + daylightSavingDate.getTime());
|
||||
// System.out.println(" --- the date i get back : " + timestampBack);
|
||||
// System.out.println(" as millis : " + timestampBack.getTime());
|
||||
// System.out.println("The difference is " + diffMillis / 1000 + " seconds");
|
||||
//
|
||||
// assertEquals(0L, diffMillis);
|
||||
//
|
||||
// } finally {
|
||||
// TimeZone.setDefault(defaultTimeZone);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user