@Test public void testAuditFilteredThrowsException() { AuditEntry logEntry = AuditEntry.newBuilder().build(); when(mockFilter.isWhitelisted(logEntry)).thenThrow(new ReadTimeoutException(ConsistencyLevel.QUORUM, 1, 1, false)); long timeTaken = timedOperation(() -> auditor.audit(logEntry), CassandraException.class); verify(mockAuditMetrics).filterAuditRequest(timingCaptor.capture(), eq(TimeUnit.NANOSECONDS)); verifyNoMoreInteractions(mockAuditMetrics); verifyZeroInteractions(mockLogger, mockObfuscator); long timeMeasured = timingCaptor.getValue(); assertThat(timeMeasured).isLessThanOrEqualTo(timeTaken); }
@Override public void audit(AuditEntry logEntry) { if (shouldAudit(logEntry)) { AuditEntry obfuscatedEntry = obfuscator.obfuscate(logEntry); performAudit(obfuscatedEntry); } }
DefaultAuditor implements Auditor { @Override public void audit(AuditEntry logEntry) { if (shouldAudit(logEntry)) { AuditEntry obfuscatedEntry = obfuscator.obfuscate(logEntry); performAudit(obfuscatedEntry); } } }
DefaultAuditor implements Auditor { @Override public void audit(AuditEntry logEntry) { if (shouldAudit(logEntry)) { AuditEntry obfuscatedEntry = obfuscator.obfuscate(logEntry); performAudit(obfuscatedEntry); } } DefaultAuditor(AuditLogger logger, AuditFilter filter, AuditObfuscator obfuscator, LogTimingStrategy logTimingStrategy);   DefaultAuditor(AuditLogger logger, AuditFilter filter, AuditObfuscator obfuscator, AuditMetrics auditMetrics, LogTimingStrategy logTimingStrategy); }
DefaultAuditor implements Auditor { @Override public void audit(AuditEntry logEntry) { if (shouldAudit(logEntry)) { AuditEntry obfuscatedEntry = obfuscator.obfuscate(logEntry); performAudit(obfuscatedEntry); } } DefaultAuditor(AuditLogger logger, AuditFilter filter, AuditObfuscator obfuscator, LogTimingStrategy logTimingStrategy);   DefaultAuditor(AuditLogger logger, AuditFilter filter, AuditObfuscator obfuscator, AuditMetrics auditMetrics, LogTimingStrategy logTimingStrategy); @Override void setup(); @Override void audit(AuditEntry logEntry); @Override boolean shouldLogForStatus(Status status); @Override boolean shouldLogFailedBatchSummary(); @Override void setLogTimingStrategy(LogTimingStrategy logTimingStrategy); @Override void addLogger(AuditLogger logger); @Override void removeLogger(AuditLogger logger); }
DefaultAuditor implements Auditor { @Override public void audit(AuditEntry logEntry) { if (shouldAudit(logEntry)) { AuditEntry obfuscatedEntry = obfuscator.obfuscate(logEntry); performAudit(obfuscatedEntry); } } DefaultAuditor(AuditLogger logger, AuditFilter filter, AuditObfuscator obfuscator, LogTimingStrategy logTimingStrategy);   DefaultAuditor(AuditLogger logger, AuditFilter filter, AuditObfuscator obfuscator, AuditMetrics auditMetrics, LogTimingStrategy logTimingStrategy); @Override void setup(); @Override void audit(AuditEntry logEntry); @Override boolean shouldLogForStatus(Status status); @Override boolean shouldLogFailedBatchSummary(); @Override void setLogTimingStrategy(LogTimingStrategy logTimingStrategy); @Override void addLogger(AuditLogger logger); @Override void removeLogger(AuditLogger logger);  }