diff --git a/.gitignore b/.gitignore index be816f6c..ed6bc8ac 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ target/ .idea *.iml dependency-reduced-pom.xml +.idea/ diff --git a/.idea/misc.xml b/.idea/misc.xml index 9896aeb3..86b97c7b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,4 +8,4 @@ - \ No newline at end of file + diff --git a/CHANGES.md b/CHANGES.md index c8341107..ba4f9215 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,15 +1,12 @@ # Changes -## Not released yet +## Version 3.1.0 (unreleased) +* Add Audit Prepare statements - #226 * Build with Cassandra 5.0-alpha1 (only flavor ecaudit_c5.0) ## Version 3.0.0 * Build with Cassandra 4.1.2 (only flavor ecaudit_c4.1) - -## Version 2.12.0 - * Test with java11 (only flavor ecaudit_c4.0) - #214 -* Audit Prepare statements ## Version 2.11.0 diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/filter/yamlandrole/YamlAndRoleAuditFilter.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/filter/yamlandrole/YamlAndRoleAuditFilter.java index 62a9d8ae..e2442cce 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/filter/yamlandrole/YamlAndRoleAuditFilter.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/filter/yamlandrole/YamlAndRoleAuditFilter.java @@ -57,6 +57,7 @@ public void setup() yamlFilter.setup(); roleFilter.setup(); } + @Override public boolean shouldLogPrepareStatements() { diff --git a/integration-test-query-logger/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/querylogger/PrepareAuditQueryLogger.java b/integration-test-query-logger/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/querylogger/PrepareAuditQueryLogger.java index 500222aa..7e4ed0ea 100644 --- a/integration-test-query-logger/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/querylogger/PrepareAuditQueryLogger.java +++ b/integration-test-query-logger/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/querylogger/PrepareAuditQueryLogger.java @@ -109,7 +109,7 @@ public void testFailedPrepareStatement() assertThat(getLogEntries()).containsOnly( "client:'127.0.0.1'|user:'anonymous'|status:'ATTEMPT'|operation:'Prepared: INSERT INTO school.invalidestudents (key, value) VALUES (?, ?)'", "client:'127.0.0.1'|user:'anonymous'|status:'FAILED'|operation:'Prepared: INSERT INTO school.invalidestudents (key, value) VALUES (?, ?)'"); } - + private void givenTable(String keyspace, String table) { session.execute("CREATE KEYSPACE IF NOT EXISTS " + keyspace + " WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1} AND DURABLE_WRITES = false"); diff --git a/test-utils/src/main/java/com/ericsson/bss/cassandra/ecaudit/test/mode/ClientInitializer.java b/test-utils/src/main/java/com/ericsson/bss/cassandra/ecaudit/test/mode/ClientInitializer.java index a2bfd0b8..360431d4 100644 --- a/test-utils/src/main/java/com/ericsson/bss/cassandra/ecaudit/test/mode/ClientInitializer.java +++ b/test-utils/src/main/java/com/ericsson/bss/cassandra/ecaudit/test/mode/ClientInitializer.java @@ -37,6 +37,7 @@ private ClientInitializer() public static void beforeClass() { + // This method is used by multiple tests, so lenient() is required for tests that don't require the when statements DatabaseDescriptor.clientInitialization(true); DatabaseDescriptor.setAuthenticator(mock(IAuthenticator.class)); lenient().when(authorizerMock.bulkLoader()).thenReturn(Collections::emptyMap);