@Test public void uncheckedExceptionIsUnwrapped() { when(getRolesFunctionMock.apply(any(RoleResource.class))) .thenThrow(new UncheckedExecutionException(new RuntimeException(new ReadTimeoutException(ConsistencyLevel.QUORUM, 1, 1, false)))); AuditEntry auditEntry = givenAuditEntry(Collections.singleton(Permission.SELECT), DataResource.fromName("data/ks/tbl")); assertThatExceptionOfType(CassandraException.class) .isThrownBy(() -> filter.isWhitelisted(auditEntry)); }
@Override public boolean isWhitelisted(AuditEntry logEntry) { RoleAuditFilterCacheKey cacheKey = new RoleAuditFilterCacheKey(logEntry.getUser(), logEntry.getResource(), logEntry.getPermissions()); try { return filterCache.isWhitelisted(cacheKey); } catch (UncheckedExecutionException e) { throw Exceptions.tryGetCassandraExceptionCause(e); } }
RoleAuditFilter implements AuditFilter { @Override public boolean isWhitelisted(AuditEntry logEntry) { RoleAuditFilterCacheKey cacheKey = new RoleAuditFilterCacheKey(logEntry.getUser(), logEntry.getResource(), logEntry.getPermissions()); try { return filterCache.isWhitelisted(cacheKey); } catch (UncheckedExecutionException e) { throw Exceptions.tryGetCassandraExceptionCause(e); } } }
RoleAuditFilter implements AuditFilter { @Override public boolean isWhitelisted(AuditEntry logEntry) { RoleAuditFilterCacheKey cacheKey = new RoleAuditFilterCacheKey(logEntry.getUser(), logEntry.getResource(), logEntry.getPermissions()); try { return filterCache.isWhitelisted(cacheKey); } catch (UncheckedExecutionException e) { throw Exceptions.tryGetCassandraExceptionCause(e); } } RoleAuditFilter(); @VisibleForTesting  RoleAuditFilter(Function<RoleResource, Set<RoleResource>> getRolesFunction, WhitelistDataAccess whitelistDataAccess, AuditFilterAuthorizer auditFilterAuthorizer); }
RoleAuditFilter implements AuditFilter { @Override public boolean isWhitelisted(AuditEntry logEntry) { RoleAuditFilterCacheKey cacheKey = new RoleAuditFilterCacheKey(logEntry.getUser(), logEntry.getResource(), logEntry.getPermissions()); try { return filterCache.isWhitelisted(cacheKey); } catch (UncheckedExecutionException e) { throw Exceptions.tryGetCassandraExceptionCause(e); } } RoleAuditFilter(); @VisibleForTesting  RoleAuditFilter(Function<RoleResource, Set<RoleResource>> getRolesFunction, WhitelistDataAccess whitelistDataAccess, AuditFilterAuthorizer auditFilterAuthorizer); @Override void setup(); @Override boolean isWhitelisted(AuditEntry logEntry); }
RoleAuditFilter implements AuditFilter { @Override public boolean isWhitelisted(AuditEntry logEntry) { RoleAuditFilterCacheKey cacheKey = new RoleAuditFilterCacheKey(logEntry.getUser(), logEntry.getResource(), logEntry.getPermissions()); try { return filterCache.isWhitelisted(cacheKey); } catch (UncheckedExecutionException e) { throw Exceptions.tryGetCassandraExceptionCause(e); } } RoleAuditFilter(); @VisibleForTesting  RoleAuditFilter(Function<RoleResource, Set<RoleResource>> getRolesFunction, WhitelistDataAccess whitelistDataAccess, AuditFilterAuthorizer auditFilterAuthorizer); @Override void setup(); @Override boolean isWhitelisted(AuditEntry logEntry);  }