use of uk.gov.gchq.gaffer.time.TimestampSet in project gaffer-doc by gchq.
the class BoundedTimestampSetElementGenerator method _apply.
@Override
public Iterable<Element> _apply(final String line) {
final List<Element> elements = new ArrayList<>();
for (int i = 0; i < 3; i++) {
final TimestampSet timestampSet = new BoundedTimestampSet(CommonTimeUtil.TimeBucket.MINUTE, 25);
timestampSet.add(START_OF_2017.plusSeconds(RANDOM.nextInt(SECONDS_IN_YEAR)));
final Edge edge = new Edge.Builder().group("red").source("A").dest("B").property("boundedTimestampSet", timestampSet).build();
elements.add(edge);
}
for (int i = 0; i < 1000; i++) {
final TimestampSet timestampSet = new BoundedTimestampSet(CommonTimeUtil.TimeBucket.MINUTE, 25);
timestampSet.add(START_OF_2017.plusSeconds(RANDOM.nextInt(SECONDS_IN_YEAR)));
final Edge edge = new Edge.Builder().group("red").source("A").dest("C").property("boundedTimestampSet", timestampSet).build();
elements.add(edge);
}
return elements;
}
use of uk.gov.gchq.gaffer.time.TimestampSet in project Gaffer by gchq.
the class ToTimestampSetTest method shouldCreateNonBoundedSet.
@Test
public void shouldCreateNonBoundedSet() {
// Given
final ToTimestampSet toTimestampSet = new ToTimestampSet(TimeBucket.DAY, false);
// When
TimestampSet result = toTimestampSet.apply(TEST_TIMESTAMP);
// Then
TimestampSet expected = new RBMBackedTimestampSet.Builder().timeBucket(TimeBucket.DAY).build();
expected.add(Instant.ofEpochMilli(TEST_TIMESTAMP));
assertEquals(expected, result);
}
use of uk.gov.gchq.gaffer.time.TimestampSet in project Gaffer by gchq.
the class ToTimestampSetTest method shouldCreateEmptySetWhenNull.
@Test
public void shouldCreateEmptySetWhenNull() {
// Given
final ToTimestampSet toTimestampSet = new ToTimestampSet(TimeBucket.DAY, false);
// When
TimestampSet result = toTimestampSet.apply(null);
// Then
TimestampSet expected = new RBMBackedTimestampSet.Builder().timeBucket(TimeBucket.DAY).build();
assertEquals(expected, result);
}
use of uk.gov.gchq.gaffer.time.TimestampSet in project Gaffer by gchq.
the class ToTimestampSetTest method shouldCreateBoundedSet.
@Test
public void shouldCreateBoundedSet() {
// Given
final ToTimestampSet toTimestampSet = new ToTimestampSet(TimeBucket.DAY, 10);
// When
TimestampSet result = toTimestampSet.apply(TEST_TIMESTAMP);
// Then
TimestampSet expected = new BoundedTimestampSet.Builder().timeBucket(TimeBucket.DAY).maxSize(10).build();
expected.add(Instant.ofEpochMilli(TEST_TIMESTAMP));
assertEquals(expected, result);
}
use of uk.gov.gchq.gaffer.time.TimestampSet in project gaffer-doc by gchq.
the class TimestampSetElementGenerator method _apply.
@Override
public Iterable<Element> _apply(final String line) {
final Set<Element> elements = new HashSet<>();
for (int i = 0; i < 25; i++) {
final TimestampSet timestampSet = new RBMBackedTimestampSet(CommonTimeUtil.TimeBucket.MINUTE);
timestampSet.add(START_OF_2017.plusSeconds(RANDOM.nextInt(SECONDS_IN_YEAR)));
final Edge edge = new Edge.Builder().group("red").source("A").dest("B").property("timestampSet", timestampSet).build();
elements.add(edge);
}
return elements;
}
Aggregations