use of org.locationtech.geowave.core.geotime.store.query.TemporalConstraints in project geowave by locationtech.
the class ExtractTimeFilterVisitorTest method testAfter.
@Test
public void testAfter() throws CQLException, ParseException {
final ExtractTimeFilterVisitor visitor = new ExtractTimeFilterVisitor();
final Date time = DateUtilities.parseISO("2005-05-19T20:32:56Z");
final Filter filter = CQL.toFilter("when after 2005-05-19T20:32:56Z");
final Query query = new Query("type", filter);
TemporalConstraints range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(new Date(time.getTime() + 1), range.getStartRange().getStartTime());
range = (TemporalConstraints) query.getFilter().accept(visitorWithDescriptor, null);
assertNotNull(range);
assertEquals(new Date(time.getTime() + 1), range.getStartRange().getStartTime());
assertEquals("when", range.getName());
}
use of org.locationtech.geowave.core.geotime.store.query.TemporalConstraints in project geowave by locationtech.
the class ExtractTimeFilterVisitorTest method testGreaterThan.
@Test
public void testGreaterThan() throws CQLException, ParseException {
final ExtractTimeFilterVisitor visitor = new ExtractTimeFilterVisitor();
final Date stimeNotEqual = new Date(DateUtilities.parseISO("2005-05-19T20:32:56Z").getTime() + 1);
final Date stime = DateUtilities.parseISO("2005-05-19T20:32:56Z");
Filter filter = ECQL.toFilter("when > 2005-05-19T20:32:56Z");
Query query = new Query("type", filter);
TemporalConstraints range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(stimeNotEqual, range.getStartRange().getStartTime());
assertEquals(TemporalRange.END_TIME, range.getEndRange().getEndTime());
assertEquals("when", range.getName());
filter = ECQL.toFilter("2005-05-19T20:32:56Z < when");
query = new Query("type", filter);
range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(stimeNotEqual, range.getStartRange().getStartTime());
assertEquals(TemporalRange.END_TIME, range.getEndRange().getEndTime());
assertEquals("when", range.getName());
filter = ECQL.toFilter("2005-05-19T20:32:56Z <= when");
query = new Query("type", filter);
range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(stime, range.getStartRange().getStartTime());
assertEquals(TemporalRange.END_TIME, range.getEndRange().getEndTime());
assertEquals("when", range.getName());
}
use of org.locationtech.geowave.core.geotime.store.query.TemporalConstraints in project geowave by locationtech.
the class ExtractTimeFilterVisitorTest method testBefore.
@Test
public void testBefore() throws CQLException, ParseException {
final ExtractTimeFilterVisitor visitor = new ExtractTimeFilterVisitor();
final Date etime = new Date(DateUtilities.parseISO("2005-05-19T20:32:56Z").getTime() - 1);
final Filter filter = CQL.toFilter("when before 2005-05-19T20:32:56Z");
final Query query = new Query("type", filter);
TemporalConstraints range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(TemporalRange.START_TIME, range.getStartRange().getStartTime());
assertEquals(etime, range.getStartRange().getEndTime());
range = (TemporalConstraints) query.getFilter().accept(visitorWithDescriptor, null);
assertNotNull(range);
assertEquals(TemporalRange.START_TIME, range.getStartRange().getStartTime());
assertEquals(etime, range.getStartRange().getEndTime());
}
use of org.locationtech.geowave.core.geotime.store.query.TemporalConstraints in project geowave by locationtech.
the class ExtractTimeFilterVisitorTest method testEqual.
@Test
public void testEqual() throws CQLException, ParseException {
final ExtractTimeFilterVisitor visitor = new ExtractTimeFilterVisitor();
final Date etime = DateUtilities.parseISO("2005-05-19T21:32:56Z");
final Filter filter = ECQL.toFilter("when = 2005-05-19T21:32:56Z");
final Query query = new Query("type", filter);
final TemporalConstraints range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(etime, range.getStartRange().getStartTime());
assertEquals(etime, range.getEndRange().getEndTime());
}
use of org.locationtech.geowave.core.geotime.store.query.TemporalConstraints in project geowave by locationtech.
the class ExtractTimeFilterVisitorTest method testLessThan.
@Test
public void testLessThan() throws CQLException, ParseException {
final ExtractTimeFilterVisitor visitor = new ExtractTimeFilterVisitor();
final Date etimeNotEqual = new Date(DateUtilities.parseISO("2005-05-19T21:32:56Z").getTime() - 1);
final Date etime = DateUtilities.parseISO("2005-05-19T21:32:56Z");
Filter filter = ECQL.toFilter("when < 2005-05-19T21:32:56Z");
Query query = new Query("type", filter);
TemporalConstraints range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(TemporalRange.START_TIME, range.getStartRange().getStartTime());
assertEquals(etimeNotEqual, range.getEndRange().getEndTime());
assertEquals("when", range.getName());
filter = ECQL.toFilter(" 2005-05-19T21:32:56Z > when");
query = new Query("type", filter);
range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(TemporalRange.START_TIME, range.getStartRange().getStartTime());
assertEquals(etimeNotEqual, range.getEndRange().getEndTime());
assertEquals("when", range.getName());
filter = ECQL.toFilter(" 2005-05-19T21:32:56Z >= when");
query = new Query("type", filter);
range = (TemporalConstraints) query.getFilter().accept(visitor, null);
assertNotNull(range);
assertEquals(TemporalRange.START_TIME, range.getStartRange().getStartTime());
assertEquals(etime, range.getEndRange().getEndTime());
assertEquals("when", range.getName());
}
Aggregations