Search in sources :

Example 1 with BaseAuditHandler

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());
    }
}
Also used : BaseAuditHandler(org.apache.ranger.audit.provider.BaseAuditHandler)

Example 2 with BaseAuditHandler

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());
    }
}
Also used : BaseAuditHandler(org.apache.ranger.audit.provider.BaseAuditHandler)

Example 3 with BaseAuditHandler

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);
}
Also used : BaseAuditHandler(org.apache.ranger.audit.provider.BaseAuditHandler) AuditQueue(org.apache.ranger.audit.queue.AuditQueue) AuditProviderFactory(org.apache.ranger.audit.provider.AuditProviderFactory) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

BaseAuditHandler (org.apache.ranger.audit.provider.BaseAuditHandler)3 Properties (java.util.Properties)1 AuditProviderFactory (org.apache.ranger.audit.provider.AuditProviderFactory)1 AuditQueue (org.apache.ranger.audit.queue.AuditQueue)1 Test (org.junit.Test)1