Search in sources :

Example 6 with DirectDruidClient

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

the class TierSelectorStrategyTest method testCustomPriorityTierSelectorStrategy.

@Test
public void testCustomPriorityTierSelectorStrategy() {
    DirectDruidClient client = EasyMock.createMock(DirectDruidClient.class);
    QueryableDruidServer lowPriority = new QueryableDruidServer(new DruidServer("test1", "localhost", null, 0, ServerType.HISTORICAL, DruidServer.DEFAULT_TIER, -1), client);
    QueryableDruidServer mediumPriority = new QueryableDruidServer(new DruidServer("test1", "localhost", null, 0, ServerType.HISTORICAL, DruidServer.DEFAULT_TIER, 0), client);
    QueryableDruidServer highPriority = new QueryableDruidServer(new DruidServer("test1", "localhost", null, 0, ServerType.HISTORICAL, DruidServer.DEFAULT_TIER, 1), client);
    testTierSelectorStrategy(new CustomTierSelectorStrategy(new ConnectionCountServerSelectorStrategy(), new CustomTierSelectorStrategyConfig() {

        @Override
        public List<Integer> getPriorities() {
            return Arrays.asList(2, 0, -1, 1);
        }
    }), mediumPriority, lowPriority, highPriority);
}
Also used : DirectDruidClient(org.apache.druid.client.DirectDruidClient) DruidServer(org.apache.druid.client.DruidServer) Test(org.junit.Test)

Example 7 with DirectDruidClient

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

the class TierSelectorStrategyTest method testHighestPriorityTierSelectorStrategy.

@Test
public void testHighestPriorityTierSelectorStrategy() {
    DirectDruidClient client = EasyMock.createMock(DirectDruidClient.class);
    QueryableDruidServer lowPriority = new QueryableDruidServer(new DruidServer("test1", "localhost", null, 0, ServerType.HISTORICAL, DruidServer.DEFAULT_TIER, 0), client);
    QueryableDruidServer highPriority = new QueryableDruidServer(new DruidServer("test1", "localhost", null, 0, ServerType.HISTORICAL, DruidServer.DEFAULT_TIER, 1), client);
    testTierSelectorStrategy(new HighestPriorityTierSelectorStrategy(new ConnectionCountServerSelectorStrategy()), highPriority, lowPriority);
}
Also used : DirectDruidClient(org.apache.druid.client.DirectDruidClient) DruidServer(org.apache.druid.client.DruidServer) Test(org.junit.Test)

Aggregations

DirectDruidClient (org.apache.druid.client.DirectDruidClient)7 DruidServer (org.apache.druid.client.DruidServer)7 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Nullable (javax.annotation.Nullable)1 Query (org.apache.druid.query.Query)1 DataSegment (org.apache.druid.timeline.DataSegment)1