@Test public void testUsedOverlapHigh() throws IOException { coordinator.announceHistoricalSegments(SEGMENTS); Assert.assertEquals( SEGMENTS, ImmutableSet.copyOf( coordinator.getUsedSegmentsForInterval( defaultSegment.getDataSource(), Intervals.of("2015-1-1T23:59:59.999Z/2015-02-01T00Z") ) ) ); }
@Test public void testSimpleUsedList() throws IOException { coordinator.announceHistoricalSegments(SEGMENTS); Assert.assertEquals( SEGMENTS, ImmutableSet.copyOf( coordinator.getUsedSegmentsForInterval( defaultSegment.getDataSource(), defaultSegment.getInterval() ) ) ); }
@Test public void testUsedOverlapLow() throws IOException { coordinator.announceHistoricalSegments(SEGMENTS); Set<DataSegment> actualSegments = ImmutableSet.copyOf( coordinator.getUsedSegmentsForInterval( defaultSegment.getDataSource(), Intervals.of("2014-12-31T23:59:59.999Z/2015-01-01T00:00:00.001Z") // end is exclusive ) ); Assert.assertEquals( SEGMENTS, actualSegments ); }
@Test public void testUsedOutOfBoundsHigh() throws IOException { coordinator.announceHistoricalSegments(SEGMENTS); Assert.assertTrue( coordinator.getUsedSegmentsForInterval( defaultSegment.getDataSource(), new Interval(defaultSegment.getInterval().getEnd(), defaultSegment.getInterval().getEnd().plusDays(10)) ).isEmpty() ); }
@Test public void testUsedOutOfBoundsLow() throws IOException { coordinator.announceHistoricalSegments(SEGMENTS); Assert.assertTrue( coordinator.getUsedSegmentsForInterval( defaultSegment.getDataSource(), new Interval(defaultSegment.getInterval().getStart().minus(1), defaultSegment.getInterval().getStart()) ).isEmpty() ); }
@Test public void testUsedWithinBoundsEnd() throws IOException { coordinator.announceHistoricalSegments(SEGMENTS); Assert.assertEquals( SEGMENTS, ImmutableSet.copyOf( coordinator.getUsedSegmentsForInterval( defaultSegment.getDataSource(), defaultSegment.getInterval().withEnd(defaultSegment.getInterval().getEnd().minusMillis(1)) ) ) ); }
@Test public void testUsedOverlapEnd() throws IOException { coordinator.announceHistoricalSegments(SEGMENTS); Assert.assertEquals( SEGMENTS, ImmutableSet.copyOf( coordinator.getUsedSegmentsForInterval( defaultSegment.getDataSource(), defaultSegment.getInterval().withEnd(defaultSegment.getInterval().getEnd().plusMillis(1)) ) ) ); }