mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
ADD encryption support for Between and InRange
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package org.tests.basic.encrypt;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.SqlRow;
|
||||
import io.ebean.xtest.ForPlatform;
|
||||
import io.ebean.xtest.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
import io.ebean.config.dbplatform.DbEncrypt;
|
||||
import io.ebean.test.LoggedSql;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.xtest.ForPlatform;
|
||||
import io.ebean.xtest.IgnorePlatform;
|
||||
import io.ebeaninternal.api.SpiEbeanServer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.EBasicEncrypt;
|
||||
@@ -109,7 +109,8 @@ public class TestEncrypt extends BaseTestCase {
|
||||
EBasicEncrypt e = new EBasicEncrypt();
|
||||
e.setName("testname");
|
||||
e.setDescription("testdesc");
|
||||
e.setDob(new Date(System.currentTimeMillis() - 100000));
|
||||
long refTime = System.currentTimeMillis() - 100000;
|
||||
e.setDob(new Date(refTime));
|
||||
|
||||
DB.save(e);
|
||||
|
||||
@@ -152,6 +153,32 @@ public class TestEncrypt extends BaseTestCase {
|
||||
list = DB.find(EBasicEncrypt.class).where().startsWith("description", "modde").findList();
|
||||
|
||||
assertEquals(1, list.size());
|
||||
|
||||
// Note, we only have "date" precision (See #2878)
|
||||
list = DB.find(EBasicEncrypt.class).where().between("dob",
|
||||
new Date(refTime - 2 * 86400000), new Date(refTime - 1 * 86400000)).findList();
|
||||
|
||||
assertEquals(0, list.size());
|
||||
|
||||
list = DB.find(EBasicEncrypt.class).where().inRange("dob",
|
||||
new Date(refTime - 2 * 86400000), new Date(refTime - 1 * 86400000)).findList();
|
||||
|
||||
assertEquals(0, list.size());
|
||||
|
||||
list = DB.find(EBasicEncrypt.class).where().between("dob",
|
||||
new Date(refTime - 2 * 86400000), new Date(refTime + 1 * 86400000)).findList();
|
||||
|
||||
assertEquals(1, list.size());
|
||||
|
||||
list = DB.find(EBasicEncrypt.class).where().inRange("dob",
|
||||
new Date(refTime - 2 * 86400000), new Date(refTime + 1 * 86400000)).findList();
|
||||
|
||||
assertEquals(1, list.size());
|
||||
|
||||
|
||||
//list = DB.find(EBasicEncrypt.class).where().inRange("dob", new Date(refTime), new Date(refTime+1)).findList();
|
||||
|
||||
//assertEquals(1, list.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user