use of org.apache.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testUpdateLookupsFailsUnitialized.
@Test
public void testUpdateLookupsFailsUnitialized() {
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, druidNodeDiscoveryProvider, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, LookupExtractorFactoryMapContainer>> getKnownLookups() {
return null;
}
};
manager.start();
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
expectedException.expect(ISE.class);
manager.updateLookups(TIERED_LOOKUP_MAP_V0, auditInfo);
}
use of org.apache.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testDeleteLookupIgnoresMissing.
@Test
public void testDeleteLookupIgnoresMissing() {
final LookupExtractorFactoryMapContainer ignore = new LookupExtractorFactoryMapContainer("v0", ImmutableMap.of("lookup", "ignore"));
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, druidNodeDiscoveryProvider, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, LookupExtractorFactoryMapContainer>> getKnownLookups() {
return ImmutableMap.of(LOOKUP_TIER, ImmutableMap.of("ignore", ignore));
}
};
manager.start();
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
Assert.assertFalse(manager.deleteLookup(LOOKUP_TIER, "foo", auditInfo));
}
use of org.apache.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testUpdateLookupsAddsNewLookup.
@Test
public void testUpdateLookupsAddsNewLookup() {
final LookupExtractorFactoryMapContainer ignore = new LookupExtractorFactoryMapContainer("v0", ImmutableMap.of("prop", "old"));
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, druidNodeDiscoveryProvider, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, LookupExtractorFactoryMapContainer>> getKnownLookups() {
return ImmutableMap.of(LOOKUP_TIER + "1", ImmutableMap.of("foo1", new LookupExtractorFactoryMapContainer("v0", ImmutableMap.of("prop", "old"))), LOOKUP_TIER + "2", ImmutableMap.of("ignore", ignore));
}
};
manager.start();
final LookupExtractorFactoryMapContainer newSpec = new LookupExtractorFactoryMapContainer("v1", ImmutableMap.of("prop", "new"));
EasyMock.reset(configManager);
EasyMock.expect(configManager.set(EasyMock.eq(LookupCoordinatorManager.LOOKUP_CONFIG_KEY), EasyMock.eq(ImmutableMap.<String, Map<String, LookupExtractorFactoryMapContainer>>of(LOOKUP_TIER + "1", ImmutableMap.of("foo1", ignore, "foo2", newSpec), LOOKUP_TIER + "2", ImmutableMap.of("ignore", ignore))), EasyMock.eq(auditInfo))).andReturn(SetResult.ok()).once();
EasyMock.replay(configManager);
Assert.assertTrue(manager.updateLookups(ImmutableMap.of(LOOKUP_TIER + "1", ImmutableMap.of("foo2", newSpec)), auditInfo));
EasyMock.verify(configManager);
}
use of org.apache.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testDeleteTier.
@Test
public void testDeleteTier() {
final LookupExtractorFactoryMapContainer foo1 = new LookupExtractorFactoryMapContainer("v0", ImmutableMap.of("lookup", "foo1"));
final LookupExtractorFactoryMapContainer foo2 = new LookupExtractorFactoryMapContainer("v0", ImmutableMap.of("lookup", "foo2"));
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, druidNodeDiscoveryProvider, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, LookupExtractorFactoryMapContainer>> getKnownLookups() {
return ImmutableMap.of(LOOKUP_TIER, ImmutableMap.of("foo1", foo1, "foo2", foo2));
}
};
manager.start();
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
EasyMock.reset(configManager);
EasyMock.expect(configManager.set(EasyMock.eq(LookupCoordinatorManager.LOOKUP_CONFIG_KEY), EasyMock.eq(ImmutableMap.<String, Map<String, LookupExtractorFactoryMapContainer>>of()), EasyMock.eq(auditInfo))).andReturn(SetResult.ok()).once();
EasyMock.replay(configManager);
Assert.assertTrue(manager.deleteTier(LOOKUP_TIER, auditInfo));
EasyMock.verify(configManager);
}
use of org.apache.druid.audit.AuditInfo in project druid by druid-io.
the class LookupCoordinatorManagerTest method testUpdateLookupFailsSameVersionUpdates.
@Test
public void testUpdateLookupFailsSameVersionUpdates() {
final LookupCoordinatorManager manager = new LookupCoordinatorManager(client, druidNodeDiscoveryProvider, mapper, configManager, lookupCoordinatorManagerConfig) {
@Override
public Map<String, Map<String, LookupExtractorFactoryMapContainer>> getKnownLookups() {
return TIERED_LOOKUP_MAP_V0;
}
};
manager.start();
final AuditInfo auditInfo = new AuditInfo("author", "comment", "localhost");
try {
manager.updateLookups(TIERED_LOOKUP_MAP_V0, auditInfo);
Assert.fail();
} catch (IAE ex) {
}
}
Aggregations