Search in sources :

Example 11 with ImmutableSegmentLoadInfo

use of org.apache.druid.client.ImmutableSegmentLoadInfo in project druid by druid-io.

the class DataSourcesResourceTest method testSegmentLoadChecksForAssignableServer.

@Test
public void testSegmentLoadChecksForAssignableServer() {
    Interval interval = Intervals.of("2011-04-01/2011-04-02");
    Assert.assertTrue(DataSourcesResource.isSegmentLoaded(Collections.singletonList(new ImmutableSegmentLoadInfo(createSegment(interval, "v1", 2), Sets.newHashSet(createHistoricalServerMetadata("a")))), new SegmentDescriptor(interval, "v1", 2)));
    Assert.assertFalse(DataSourcesResource.isSegmentLoaded(Collections.singletonList(new ImmutableSegmentLoadInfo(createSegment(interval, "v1", 2), Sets.newHashSet(createRealtimeServerMetadata("a")))), new SegmentDescriptor(interval, "v1", 2)));
}
Also used : SegmentDescriptor(org.apache.druid.query.SegmentDescriptor) ImmutableSegmentLoadInfo(org.apache.druid.client.ImmutableSegmentLoadInfo) Interval(org.joda.time.Interval) Test(org.junit.Test)

Example 12 with ImmutableSegmentLoadInfo

use of org.apache.druid.client.ImmutableSegmentLoadInfo in project druid by druid-io.

the class DataSourcesResourceTest method testSegmentLoadChecksForPartitionNumber.

@Test
public void testSegmentLoadChecksForPartitionNumber() {
    Interval interval = Intervals.of("2011-04-01/2011-04-02");
    Assert.assertTrue(DataSourcesResource.isSegmentLoaded(Collections.singletonList(new ImmutableSegmentLoadInfo(createSegment(interval, "v1", 1), Sets.newHashSet(createHistoricalServerMetadata("a")))), new SegmentDescriptor(interval, "v1", 1)));
    Assert.assertFalse(DataSourcesResource.isSegmentLoaded(Collections.singletonList(new ImmutableSegmentLoadInfo(createSegment(interval, "v1", 1), Sets.newHashSet(createHistoricalServerMetadata("a")))), new SegmentDescriptor(interval, "v1", 2)));
}
Also used : SegmentDescriptor(org.apache.druid.query.SegmentDescriptor) ImmutableSegmentLoadInfo(org.apache.druid.client.ImmutableSegmentLoadInfo) Interval(org.joda.time.Interval) Test(org.junit.Test)

Aggregations

ImmutableSegmentLoadInfo (org.apache.druid.client.ImmutableSegmentLoadInfo)12 SegmentDescriptor (org.apache.druid.query.SegmentDescriptor)10 Test (org.junit.Test)9 Interval (org.joda.time.Interval)8 ResourceFilters (com.sun.jersey.spi.container.ResourceFilters)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 SegmentLoadInfo (org.apache.druid.client.SegmentLoadInfo)2 TableDataSource (org.apache.druid.query.TableDataSource)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 Executor (java.util.concurrent.Executor)1 Pair (org.apache.druid.java.util.common.Pair)1 UnknownSegmentIdsException (org.apache.druid.metadata.UnknownSegmentIdsException)1 DruidServerMetadata (org.apache.druid.server.coordination.DruidServerMetadata)1 LoadRule (org.apache.druid.server.coordinator.rules.LoadRule)1 Rule (org.apache.druid.server.coordinator.rules.Rule)1