use of org.apache.druid.server.coordinator.rules.ForeverDropRule in project druid by druid-io.
the class CoordinatorRuleManagerTest method testAddingToRulesListThrowingError.
@Test
public void testAddingToRulesListThrowingError() {
final CoordinatorRuleManager manager = new CoordinatorRuleManager(objectMapper, () -> tieredBrokerConfig, mockClient());
manager.poll();
final Map<String, List<Rule>> rules = manager.getRules();
expectedException.expect(UnsupportedOperationException.class);
rules.get(DATASOURCE1).add(new ForeverDropRule());
}
use of org.apache.druid.server.coordinator.rules.ForeverDropRule in project druid by druid-io.
the class CoordinatorRuleManagerTest method mockClient.
private DruidLeaderClient mockClient() {
final Map<String, List<Rule>> rules = ImmutableMap.of(DATASOURCE1, ImmutableList.of(new ForeverLoadRule(null)), DATASOURCE2, ImmutableList.of(new ForeverLoadRule(null), new IntervalDropRule(Intervals.of("2020-01-01/2020-01-02"))), "datasource3", ImmutableList.of(new PeriodLoadRule(new Period("P1M"), true, null), new ForeverDropRule()), TieredBrokerConfig.DEFAULT_RULE_NAME, ImmutableList.of(new ForeverLoadRule(ImmutableMap.of("__default", 2))));
final StringFullResponseHolder holder = EasyMock.niceMock(StringFullResponseHolder.class);
EasyMock.expect(holder.getStatus()).andReturn(HttpResponseStatus.OK);
try {
EasyMock.expect(holder.getContent()).andReturn(objectMapper.writeValueAsString(rules));
final DruidLeaderClient client = EasyMock.niceMock(DruidLeaderClient.class);
EasyMock.expect(client.go(EasyMock.anyObject())).andReturn(holder);
EasyMock.replay(holder, client);
return client;
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
}
Aggregations