Search in sources :

Example 1 with SingleElementPartitionChunk

use of org.apache.druid.timeline.partition.SingleElementPartitionChunk in project druid by druid-io.

the class BrokerServerViewTest method assertValues.

private void assertValues(List<Pair<Interval, Pair<String, Pair<DruidServer, DataSegment>>>> expected, List<TimelineObjectHolder> actual) {
    Assert.assertEquals(expected.size(), actual.size());
    for (int i = 0; i < expected.size(); ++i) {
        Pair<Interval, Pair<String, Pair<DruidServer, DataSegment>>> expectedPair = expected.get(i);
        TimelineObjectHolder<String, ServerSelector> actualTimelineObjectHolder = actual.get(i);
        Assert.assertEquals(expectedPair.lhs, actualTimelineObjectHolder.getInterval());
        Assert.assertEquals(expectedPair.rhs.lhs, actualTimelineObjectHolder.getVersion());
        PartitionHolder<ServerSelector> actualPartitionHolder = actualTimelineObjectHolder.getObject();
        Assert.assertTrue(actualPartitionHolder.isComplete());
        Assert.assertEquals(1, Iterables.size(actualPartitionHolder));
        ServerSelector selector = ((SingleElementPartitionChunk<ServerSelector>) actualPartitionHolder.iterator().next()).getObject();
        Assert.assertFalse(selector.isEmpty());
        Assert.assertEquals(expectedPair.rhs.rhs.lhs, selector.pick(null).getServer());
        Assert.assertEquals(expectedPair.rhs.rhs.rhs, selector.getSegment());
    }
}
Also used : ServerSelector(org.apache.druid.client.selector.ServerSelector) DataSegment(org.apache.druid.timeline.DataSegment) SingleElementPartitionChunk(org.apache.druid.timeline.partition.SingleElementPartitionChunk) Interval(org.joda.time.Interval) Pair(org.apache.druid.java.util.common.Pair)

Aggregations

ServerSelector (org.apache.druid.client.selector.ServerSelector)1 Pair (org.apache.druid.java.util.common.Pair)1 DataSegment (org.apache.druid.timeline.DataSegment)1 SingleElementPartitionChunk (org.apache.druid.timeline.partition.SingleElementPartitionChunk)1 Interval (org.joda.time.Interval)1