use of org.apache.ranger.audit.provider.BaseAuditHandler in project ranger by apache.
the class AuditQueue method setParentPath.
@Override
public void setParentPath(String parentPath) {
super.setParentPath(parentPath);
if (consumer != null && consumer instanceof BaseAuditHandler) {
BaseAuditHandler base = (BaseAuditHandler) consumer;
base.setParentPath(getName());
}
}
use of org.apache.ranger.audit.provider.BaseAuditHandler in project ranger by apache.
the class AuditQueue method setName.
@Override
public void setName(String name) {
super.setName(name);
if (consumer != null && consumer instanceof BaseAuditHandler) {
BaseAuditHandler base = (BaseAuditHandler) consumer;
base.setParentPath(getName());
}
}
use of org.apache.ranger.audit.provider.BaseAuditHandler in project ranger by apache.
the class TestAuditQueue method testAuditSummaryByInfra.
@Test
public void testAuditSummaryByInfra() {
logger.debug("testAuditSummaryByInfra()...");
Properties props = new Properties();
// Destination
String propPrefix = AuditProviderFactory.AUDIT_DEST_BASE + ".test";
props.put(propPrefix, "enable");
props.put(BaseAuditHandler.PROP_DEFAULT_PREFIX + "." + "summary" + "." + "enabled", "true");
props.put(propPrefix + "." + BaseAuditHandler.PROP_NAME, "test");
props.put(propPrefix + "." + AuditQueue.PROP_QUEUE, "none");
props.put(BaseAuditHandler.PROP_DEFAULT_PREFIX + "." + AuditSummaryQueue.PROP_SUMMARY_INTERVAL, "" + 300);
props.put(propPrefix + "." + BaseAuditHandler.PROP_CLASS_NAME, TestConsumer.class.getName());
AuditProviderFactory factory = AuditProviderFactory.getInstance();
factory.init(props, "test");
AuditQueue queue = (AuditQueue) factory.getProvider();
BaseAuditHandler consumer = (BaseAuditHandler) queue.getConsumer();
while (consumer != null && consumer instanceof AuditQueue) {
AuditQueue cQueue = (AuditQueue) consumer;
consumer = (BaseAuditHandler) cQueue.getConsumer();
}
assertTrue("Consumer should be TestConsumer. class=" + consumer.getClass().getName(), consumer instanceof TestConsumer);
TestConsumer testConsumer = (TestConsumer) consumer;
commonTestSummary(testConsumer, queue);
}
Aggregations