use of uk.gov.gchq.gaffer.time.LongTimeSeries in project Gaffer by gchq.
the class DeltaLongTimeSeriesSerialiserTest method testConsistent.
@Test
public void testConsistent() throws SerialisationException {
// Given
final LongTimeSeries timeSeries1 = new LongTimeSeries(TimeBucket.SECOND);
timeSeries1.upsert(Instant.ofEpochMilli(1000L), 10L);
final LongTimeSeries timeSeries2 = new LongTimeSeries(TimeBucket.SECOND);
timeSeries2.upsert(Instant.ofEpochMilli(1000L), 5L);
timeSeries2.upsert(Instant.ofEpochMilli(1000L), 5L);
// When
final byte[] serialised1 = SERIALISER.serialise(timeSeries1);
final byte[] serialised2 = SERIALISER.serialise(timeSeries2);
// Then
assertArrayEquals(serialised1, serialised2);
}
use of uk.gov.gchq.gaffer.time.LongTimeSeries in project Gaffer by gchq.
the class DeltaLongTimeSeriesSerialiserTest method getExampleValueWeek.
private LongTimeSeries getExampleValueWeek() {
final LongTimeSeries timeSeries = new LongTimeSeries(TimeBucket.WEEK);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_DAY * 7), 7L);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_DAY * 70), 70L);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_DAY * 700), 700L);
return timeSeries;
}
use of uk.gov.gchq.gaffer.time.LongTimeSeries in project Gaffer by gchq.
the class LongTimeSeriesAggregatorTest method testCantMergeIfDifferentTimeBucket.
@Test
public void testCantMergeIfDifferentTimeBucket() {
try {
final LongTimeSeries timeSeries1 = new LongTimeSeries(TimeBucket.SECOND);
final LongTimeSeries timeSeries2 = new LongTimeSeries(TimeBucket.MINUTE);
LONG_TIME_SERIES_AGGREGATOR._apply(timeSeries1, timeSeries2);
} catch (final RuntimeException e) {
// Expected
}
}
use of uk.gov.gchq.gaffer.time.LongTimeSeries in project Gaffer by gchq.
the class DeltaLongTimeSeriesSerialiserTest method getExampleValueMinute.
private LongTimeSeries getExampleValueMinute() {
final LongTimeSeries timeSeries = new LongTimeSeries(TimeBucket.MINUTE);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_MINUTE * 100), 100L);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_MINUTE * 10_000), 10_000L);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_MINUTE * 1_000_000), 1_000_000L);
return timeSeries;
}
use of uk.gov.gchq.gaffer.time.LongTimeSeries in project Gaffer by gchq.
the class DeltaLongTimeSeriesSerialiserTest method getExampleValueHour.
private LongTimeSeries getExampleValueHour() {
final LongTimeSeries timeSeries = new LongTimeSeries(TimeBucket.HOUR);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_HOUR * 100), 100L);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_HOUR * 1_000), 1_000L);
timeSeries.upsert(Instant.ofEpochMilli(CommonTimeUtil.MILLISECONDS_IN_HOUR * 1_000_000), 1_000_000L);
return timeSeries;
}
Aggregations