@Test(dataProvider = "timeIntervals") public void testGetIncrement(TimeDimension interval, TimeDimension.Field field, long expectedValue) { TemporalAggregateFunction mock = mock(AbstractTimeAggregateFunction.class, withSettings() .useConstructor("", interval, field).defaultAnswer(CALLS_REAL_METHODS)); PropertyValue increment = mock.getIncrement(testElement); assertTrue(increment.isLong()); assertEquals(expectedValue, increment.getLong()); }
@Override public PropertyValue getIncrement(TemporalElement element) { final Tuple2<Long, Long> timeInterval; switch (timeDimension) { case TRANSACTION_TIME: timeInterval = element.getTransactionTime(); break; case VALID_TIME: timeInterval = element.getValidTime(); break; default: throw new IllegalArgumentException("Unknown dimension [" + timeDimension + "]."); } switch (field) { case FROM: return PropertyValue.create(timeInterval.f0); case TO: return PropertyValue.create(timeInterval.f1); default: throw new IllegalArgumentException("Field [" + field + "] is not supported for time intervals."); } }
AbstractTimeAggregateFunction extends BaseAggregateFunction implements TemporalAggregateFunction { @Override public PropertyValue getIncrement(TemporalElement element) { final Tuple2<Long, Long> timeInterval; switch (timeDimension) { case TRANSACTION_TIME: timeInterval = element.getTransactionTime(); break; case VALID_TIME: timeInterval = element.getValidTime(); break; default: throw new IllegalArgumentException("Unknown dimension [" + timeDimension + "]."); } switch (field) { case FROM: return PropertyValue.create(timeInterval.f0); case TO: return PropertyValue.create(timeInterval.f1); default: throw new IllegalArgumentException("Field [" + field + "] is not supported for time intervals."); } } }
AbstractTimeAggregateFunction extends BaseAggregateFunction implements TemporalAggregateFunction { @Override public PropertyValue getIncrement(TemporalElement element) { final Tuple2<Long, Long> timeInterval; switch (timeDimension) { case TRANSACTION_TIME: timeInterval = element.getTransactionTime(); break; case VALID_TIME: timeInterval = element.getValidTime(); break; default: throw new IllegalArgumentException("Unknown dimension [" + timeDimension + "]."); } switch (field) { case FROM: return PropertyValue.create(timeInterval.f0); case TO: return PropertyValue.create(timeInterval.f1); default: throw new IllegalArgumentException("Field [" + field + "] is not supported for time intervals."); } } AbstractTimeAggregateFunction(String aggregatePropertyKey, TimeDimension timeDimension,
    TimeDimension.Field field); }
AbstractTimeAggregateFunction extends BaseAggregateFunction implements TemporalAggregateFunction { @Override public PropertyValue getIncrement(TemporalElement element) { final Tuple2<Long, Long> timeInterval; switch (timeDimension) { case TRANSACTION_TIME: timeInterval = element.getTransactionTime(); break; case VALID_TIME: timeInterval = element.getValidTime(); break; default: throw new IllegalArgumentException("Unknown dimension [" + timeDimension + "]."); } switch (field) { case FROM: return PropertyValue.create(timeInterval.f0); case TO: return PropertyValue.create(timeInterval.f1); default: throw new IllegalArgumentException("Field [" + field + "] is not supported for time intervals."); } } AbstractTimeAggregateFunction(String aggregatePropertyKey, TimeDimension timeDimension,
    TimeDimension.Field field); @Override PropertyValue getIncrement(TemporalElement element); @Override String toString(); }
AbstractTimeAggregateFunction extends BaseAggregateFunction implements TemporalAggregateFunction { @Override public PropertyValue getIncrement(TemporalElement element) { final Tuple2<Long, Long> timeInterval; switch (timeDimension) { case TRANSACTION_TIME: timeInterval = element.getTransactionTime(); break; case VALID_TIME: timeInterval = element.getValidTime(); break; default: throw new IllegalArgumentException("Unknown dimension [" + timeDimension + "]."); } switch (field) { case FROM: return PropertyValue.create(timeInterval.f0); case TO: return PropertyValue.create(timeInterval.f1); default: throw new IllegalArgumentException("Field [" + field + "] is not supported for time intervals."); } } AbstractTimeAggregateFunction(String aggregatePropertyKey, TimeDimension timeDimension,
    TimeDimension.Field field); @Override PropertyValue getIncrement(TemporalElement element); @Override String toString();  }