Repository: zest-java Updated Branches: refs/heads/develop 379100175 -> 00267a146
ZEST-124 - Fixed some of the refactoring bugs. Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/00267a14 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/00267a14 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/00267a14 Branch: refs/heads/develop Commit: 00267a1465170e8bbf54f959c0565d7be99c0683 Parents: 3791001 Author: Niclas Hedhman <[email protected]> Authored: Sun Jun 12 15:28:10 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Sun Jun 12 15:28:10 2016 +0800 ---------------------------------------------------------------------- .../zest/test/indexing/AbstractQueryTest.java | 34 +++++++++++--------- .../sql/postgresql/PostgreSQLQueryTest.java | 8 ++--- 2 files changed, 22 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/00267a14/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java ---------------------------------------------------------------------- diff --git a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java index 8a0dc57..1175bc4 100644 --- a/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java +++ b/core/testsupport/src/main/java/org/apache/zest/test/indexing/AbstractQueryTest.java @@ -22,6 +22,7 @@ package org.apache.zest.test.indexing; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; +import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZoneId; @@ -79,7 +80,6 @@ public abstract class AbstractQueryTest { @Structure Module moduleInstance; - private ZonedDateTime refDate; @Test public void showNetwork() @@ -573,35 +573,37 @@ public abstract class AbstractQueryTest { QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); - refDate = ZonedDateTime.of( 2010, 3, 4, 13, 24, 35, 0, UTC ); + Instant refInstant = ZonedDateTime.of( 2010, 3, 4, 13, 24, 35, 0, UTC ).toInstant(); + System.out.println( refInstant ); Query<Person> query = unitOfWork.newQuery( qb.where( - eq( person.instantValue(), refDate.toInstant() ) ) ); + eq( person.instantValue(), refInstant ) ) ); System.out.println( "*** script40_Date: " + query ); verifyUnorderedResults( query, "Jack Doe" ); } @Test - public void script41_Date() + public void script41_Instant() { QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); + Instant refInstant = ZonedDateTime.of( 2010, 3, 4, 13, 24, 35, 0, UTC ).toInstant(); Query<Person> query = unitOfWork.newQuery( qb.where( - ne( person.instantValue(), refDate.toInstant() ) ) ); - System.out.println( "*** script41_Date: " + query ); + ne( person.instantValue(), refInstant ) ) ); + System.out.println( "*** script41_Instant: " + query ); verifyUnorderedResults( query, "Joe Doe" ); } @Test - public void script42_Date() + public void script42_Instant() { QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); ZonedDateTime cetTime = ZonedDateTime.of( 2010, 3, 4, 14, 24, 35, 0, ZoneId.of( "CET" ) ); Query<Person> query = unitOfWork.newQuery( qb.where( ne( person.instantValue(), cetTime.toInstant() ) ) ); - System.out.println( "*** script42_Date: " + query ); + System.out.println( "*** script42_Instant: " + query ); verifyUnorderedResults( query, "Joe Doe" ); } @@ -704,9 +706,9 @@ public abstract class AbstractQueryTest { QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); - ZonedDateTime time = ZonedDateTime.of( 2010, 3, 4, 13, 24, 35, 0, ZoneId.of( "CET" ) ); + LocalDateTime time = LocalDateTime.of( 2010, 3, 4, 13, 23, 0 ); Query<Person> query = unitOfWork.newQuery( qb.where( - ne( person.localDateTimeValue(), time.toLocalDateTime() ) ) ); + ne( person.localDateTimeValue(), time ) ) ); System.out.println( "*** script42_LocalDateTime: " + query ); verifyUnorderedResults( query, "Joe Doe" ); @@ -733,7 +735,7 @@ public abstract class AbstractQueryTest QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); Query<Person> query = unitOfWork.newQuery( qb.where( - eq( person.localDateValue(), LocalDate.of( 2010,3,4 ) ) ) ); + eq( person.localDateValue(), LocalDate.of( 2010, 3, 4 ) ) ) ); System.out.println( "*** script40_LocalDate: " + query ); verifyUnorderedResults( query, "Jack Doe" ); @@ -745,7 +747,7 @@ public abstract class AbstractQueryTest QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); Query<Person> query = unitOfWork.newQuery( qb.where( - ne( person.localDateValue(), LocalDate.of( 2010,3,4 ) ) ) ); + ne( person.localDateValue(), LocalDate.of( 2010, 3, 4 ) ) ) ); System.out.println( "*** script41_LocalDate: " + query ); verifyUnorderedResults( query, "Joe Doe" ); @@ -756,7 +758,7 @@ public abstract class AbstractQueryTest { QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); - LocalDate time = ZonedDateTime.of(2010,3,4,13,24,35,0, ZoneId.of("CET")).toLocalDate(); + LocalDate time = ZonedDateTime.of( 2010, 3, 4, 13, 24, 35, 0, ZoneId.of( "CET" ) ).toLocalDate(); Query<Person> query = unitOfWork.newQuery( qb.where( ne( person.localDateValue(), time ) ) ); System.out.println( "*** script42_LocalDate: " + query ); @@ -769,10 +771,10 @@ public abstract class AbstractQueryTest { QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class ); Person person = templateFor( Person.class ); - LocalDate start = ZonedDateTime.of(2010,3,4,13,24,35,0,UTC).toLocalDate(); - LocalDate end = ZonedDateTime.of(2010,3,4,13,24,35,0,UTC).toLocalDate(); + LocalDate start = ZonedDateTime.of( 2005, 3, 4, 13, 24, 35, 0, UTC ).toLocalDate(); + LocalDate end = ZonedDateTime.of( 2015, 3, 4, 13, 24, 35, 0, UTC ).toLocalDate(); Query<Person> query = unitOfWork.newQuery( qb.where( - and( gt( person.localDateValue(), start), + and( gt( person.localDateValue(), start ), lt( person.localDateValue(), end ) ) ) ); System.out.println( "*** script43_LocalDate: " + query ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/00267a14/extensions/indexing-sql/src/test/java/org/apache/zest/index/sql/postgresql/PostgreSQLQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/test/java/org/apache/zest/index/sql/postgresql/PostgreSQLQueryTest.java b/extensions/indexing-sql/src/test/java/org/apache/zest/index/sql/postgresql/PostgreSQLQueryTest.java index 013c498..503269f 100644 --- a/extensions/indexing-sql/src/test/java/org/apache/zest/index/sql/postgresql/PostgreSQLQueryTest.java +++ b/extensions/indexing-sql/src/test/java/org/apache/zest/index/sql/postgresql/PostgreSQLQueryTest.java @@ -158,9 +158,9 @@ public class PostgreSQLQueryTest @Test @Ignore( "NeSpecification is not supported by SQL Indexing" ) @Override - public void script41_Date() + public void script41_Instant() { - super.script41_Date(); + super.script41_Instant(); } @Test @@ -190,9 +190,9 @@ public class PostgreSQLQueryTest @Test @Ignore( "NeSpecification is not supported by SQL Indexing" ) @Override - public void script42_Date() + public void script42_Instant() { - super.script42_Date(); + super.script42_Instant(); } @Test
