use of io.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testUpdateLookupAdds.
@Test
public void testUpdateLookupAdds() throws Exception {
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, discoverer, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, Map<String, Object>>> getKnownLookups() {
return EMPTY_TIERED_LOOKUP;
}
};
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
EasyMock.reset(configManager);
EasyMock.expect(configManager.set(EasyMock.eq(LookupCoordinatorManager.LOOKUP_CONFIG_KEY), EasyMock.eq(TIERED_LOOKUP_MAP), EasyMock.eq(auditInfo))).andReturn(true).once();
EasyMock.replay(configManager);
manager.updateLookup(LOOKUP_TIER, SINGLE_LOOKUP_NAME, SINGLE_LOOKUP_SPEC, auditInfo);
EasyMock.verify(configManager);
}
use of io.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testUpdateLookupFailsUnitialized.
@Test
public void testUpdateLookupFailsUnitialized() throws Exception {
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, discoverer, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, Map<String, Object>>> getKnownLookups() {
return null;
}
};
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
expectedException.expect(ISE.class);
manager.updateLookups(TIERED_LOOKUP_MAP, auditInfo);
}
use of io.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testDeleteLookupIgnoresMissing.
@Test
public void testDeleteLookupIgnoresMissing() throws Exception {
final Map<String, Object> ignore = ImmutableMap.<String, Object>of("lookup", "ignore");
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, discoverer, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, Map<String, Object>>> getKnownLookups() {
return ImmutableMap.<String, Map<String, Map<String, Object>>>of(LOOKUP_TIER, ImmutableMap.of("ignore", ignore));
}
};
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
Assert.assertFalse(manager.deleteLookup(LOOKUP_TIER, "foo", auditInfo));
}
use of io.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testUpdateLookupsAddsNewTier.
@Test
public void testUpdateLookupsAddsNewTier() throws Exception {
final Map<String, Object> ignore = ImmutableMap.<String, Object>of("prop", "old");
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, discoverer, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, Map<String, Object>>> getKnownLookups() {
return ImmutableMap.<String, Map<String, Map<String, Object>>>of(LOOKUP_TIER + "2", ImmutableMap.of("ignore", ignore));
}
};
final Map<String, Object> newSpec = ImmutableMap.<String, Object>of("prop", "new");
EasyMock.reset(configManager);
EasyMock.expect(configManager.set(EasyMock.eq(LookupCoordinatorManager.LOOKUP_CONFIG_KEY), EasyMock.eq(ImmutableMap.<String, Map<String, Map<String, Object>>>of(LOOKUP_TIER + "1", ImmutableMap.of("foo", newSpec), LOOKUP_TIER + "2", ImmutableMap.of("ignore", ignore))), EasyMock.eq(auditInfo))).andReturn(true).once();
EasyMock.replay(configManager);
Assert.assertTrue(manager.updateLookups(ImmutableMap.<String, Map<String, Map<String, Object>>>of(LOOKUP_TIER + "1", ImmutableMap.<String, Map<String, Object>>of("foo", newSpec)), auditInfo));
EasyMock.verify(configManager);
}
use of io.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testUpdateLookupUpdates.
@Test
public void testUpdateLookupUpdates() throws Exception {
final Map<String, Object> ignore = ImmutableMap.<String, Object>of("prop", "old");
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, discoverer, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, Map<String, Object>>> getKnownLookups() {
return ImmutableMap.<String, Map<String, Map<String, Object>>>of(LOOKUP_TIER, ImmutableMap.of("foo", ImmutableMap.<String, Object>of("prop", "old"), "ignore", ignore));
}
};
final Map<String, Object> newSpec = ImmutableMap.<String, Object>of("prop", "new");
final Map<String, Map<String, Object>> lookup = ImmutableMap.<String, Map<String, Object>>of("foo", newSpec, "ignore", ignore);
final Map<String, Map<String, Map<String, Object>>> tier = ImmutableMap.of(LOOKUP_TIER, lookup);
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
EasyMock.reset(configManager);
EasyMock.expect(configManager.set(EasyMock.eq(LookupCoordinatorManager.LOOKUP_CONFIG_KEY), EasyMock.eq(ImmutableMap.of(LOOKUP_TIER, ImmutableMap.of("foo", newSpec, "ignore", ignore))), EasyMock.eq(auditInfo))).andReturn(true).once();
EasyMock.replay(configManager);
manager.updateLookups(tier, auditInfo);
EasyMock.verify(configManager);
}
Aggregations