Search in sources :

Example 16 with IntervalLoadRule

use of io.druid.server.coordinator.rules.IntervalLoadRule in project druid by druid-io.

the class DruidCoordinatorRuleRunnerTest method testRunRuleDoesNotExist.

@Test
public void testRunRuleDoesNotExist() throws Exception {
    mockCoordinator();
    emitter.emit(EasyMock.<ServiceEventBuilder>anyObject());
    EasyMock.expectLastCall().times(1);
    EasyMock.replay(emitter);
    EasyMock.expect(databaseRuleManager.getRulesWithDefault(EasyMock.<String>anyObject())).andReturn(Lists.<Rule>newArrayList(new IntervalLoadRule(new Interval("2012-01-02T00:00:00.000Z/2012-01-03T00:00:00.000Z"), ImmutableMap.<String, Integer>of("normal", 1)))).atLeastOnce();
    EasyMock.replay(databaseRuleManager);
    DruidCluster druidCluster = new DruidCluster(ImmutableMap.of("normal", MinMaxPriorityQueue.orderedBy(Ordering.natural().reverse()).create(Arrays.asList(new ServerHolder(new DruidServer("serverNorm", "hostNorm", 1000, "historical", "normal", 0).toImmutableDruidServer(), mockPeon)))));
    DruidCoordinatorRuntimeParams params = new DruidCoordinatorRuntimeParams.Builder().withEmitter(emitter).withDruidCluster(druidCluster).withAvailableSegments(availableSegments).withDatabaseRuleManager(databaseRuleManager).withSegmentReplicantLookup(SegmentReplicantLookup.make(new DruidCluster())).build();
    ruleRunner.run(params);
    EasyMock.verify(emitter);
}
Also used : IntervalLoadRule(io.druid.server.coordinator.rules.IntervalLoadRule) ServiceEventBuilder(com.metamx.emitter.service.ServiceEventBuilder) DruidServer(io.druid.client.DruidServer) IntervalLoadRule(io.druid.server.coordinator.rules.IntervalLoadRule) ForeverLoadRule(io.druid.server.coordinator.rules.ForeverLoadRule) Rule(io.druid.server.coordinator.rules.Rule) IntervalDropRule(io.druid.server.coordinator.rules.IntervalDropRule) Interval(org.joda.time.Interval) Test(org.junit.Test)

Aggregations

IntervalLoadRule (io.druid.server.coordinator.rules.IntervalLoadRule)16 Rule (io.druid.server.coordinator.rules.Rule)16 Interval (org.joda.time.Interval)16 Test (org.junit.Test)16 DruidServer (io.druid.client.DruidServer)13 ForeverLoadRule (io.druid.server.coordinator.rules.ForeverLoadRule)13 IntervalDropRule (io.druid.server.coordinator.rules.IntervalDropRule)13 ListeningExecutorService (com.google.common.util.concurrent.ListeningExecutorService)12 DataSegment (io.druid.timeline.DataSegment)12 DateTime (org.joda.time.DateTime)12 ServiceEventBuilder (com.metamx.emitter.service.ServiceEventBuilder)10 AuditInfo (io.druid.audit.AuditInfo)3 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 AuditEntry (io.druid.audit.AuditEntry)2 DruidCoordinatorRuleRunner (io.druid.server.coordinator.helper.DruidCoordinatorRuleRunner)1 List (java.util.List)1