From eff752ceee7ce711a8fc6eb6daa049b7e2556a11 Mon Sep 17 00:00:00 2001 From: tommy stendahl Date: Mon, 25 Sep 2023 10:56:10 +0200 Subject: [PATCH] cassandra 5 support --- .github/workflows/test.yml | 6 +- common/pom.xml | 4 +- ecaudit/pom.xml | 4 +- .../entry/CqlLiteralFlavorAdapter.java | 3 +- .../ecaudit/auth/TestSchemaHelper.java | 2 +- .../auth/TestWhitelistOptionParser.java | 2 +- .../entry/TestCqlLiteralFlavorAdapter.java | 2 +- eclog/pom.xml | 4 +- integration-test-allow-all-authorizer/pom.xml | 72 +++++++++---------- integration-test-query-logger/pom.xml | 72 +++++++++---------- integration-test-standard/pom.xml | 72 +++++++++---------- .../integration/standard/ITVerifyAudit.java | 2 +- .../standard/ITVerifyWhitelistManagement.java | 18 ++--- pom.xml | 46 +++++++++--- test-utils/pom.xml | 4 +- .../ecaudit/test/mode/ClientInitializer.java | 3 + 16 files changed, 162 insertions(+), 154 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b566beb7..f06f1069 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ '8', '11' ] + java: [ '11', '17' ] name: Java ${{ matrix.java }} code analysis steps: - name: Checkout @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ '8', '11' ] + java: [ '11', '17' ] name: Java ${{ matrix.java }} unit test steps: - name: Checkout @@ -58,7 +58,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ '8', '11' ] + java: [ '11', '17' ] name: Java ${{ matrix.java }} integration tests steps: - name: Checkout diff --git a/common/pom.xml b/common/pom.xml index 1ddbd4a8..292fa7e7 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -19,10 +19,10 @@ 4.0.0 com.ericsson.bss.cassandra.ecaudit - parent_c4.1 + parent_c5.0 3.1.0-SNAPSHOT - common_c4.1 + common_c5.0 jar Ericsson Cassandra Audit - Common diff --git a/ecaudit/pom.xml b/ecaudit/pom.xml index e4392b61..500c7574 100644 --- a/ecaudit/pom.xml +++ b/ecaudit/pom.xml @@ -19,10 +19,10 @@ 4.0.0 com.ericsson.bss.cassandra.ecaudit - parent_c4.1 + parent_c5.0 3.1.0-SNAPSHOT - ecaudit_c4.1 + ecaudit_c5.0 jar Ericsson Cassandra Audit - Plug-in diff --git a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/entry/CqlLiteralFlavorAdapter.java b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/entry/CqlLiteralFlavorAdapter.java index c5297dde..0e9ca759 100644 --- a/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/entry/CqlLiteralFlavorAdapter.java +++ b/ecaudit/src/main/java/com/ericsson/bss/cassandra/ecaudit/entry/CqlLiteralFlavorAdapter.java @@ -18,7 +18,6 @@ import java.nio.ByteBuffer; import org.apache.cassandra.cql3.ColumnSpecification; -import org.apache.cassandra.transport.ProtocolVersion; /** * This logic is extracted to a flavor specific adapter. @@ -35,6 +34,6 @@ private CqlLiteralFlavorAdapter() static String toCQLLiteral(ByteBuffer serializedValue, ColumnSpecification column) { - return column.type.asCQL3Type().toCQLLiteral(serializedValue, ProtocolVersion.CURRENT); + return column.type.asCQL3Type().toCQLLiteral(serializedValue); } } diff --git a/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/auth/TestSchemaHelper.java b/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/auth/TestSchemaHelper.java index bbe74228..e4e46de3 100644 --- a/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/auth/TestSchemaHelper.java +++ b/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/auth/TestSchemaHelper.java @@ -115,7 +115,7 @@ public void testSyncTimeout() throws UnknownHostException assertWaitTimeInMillis(startTime, RETRY_INTERVAL_MILLIS); } - @Test(timeout = (2 * RETRY_INTERVAL_MILLIS) - 1) + @Test(timeout = (3 * RETRY_INTERVAL_MILLIS) - 1) public void testNoLocalSchemaInFirstTry() throws UnknownHostException { givenLocalStateOrder(null, currentEndpointState); diff --git a/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/auth/TestWhitelistOptionParser.java b/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/auth/TestWhitelistOptionParser.java index 0f5dfdba..e6c8e581 100644 --- a/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/auth/TestWhitelistOptionParser.java +++ b/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/auth/TestWhitelistOptionParser.java @@ -98,7 +98,7 @@ public void testParseGrantModifyUppercaseAndSpace() public void testParseGrantAll() { Set operations = parser.parseTargetOperation("grant_audit_whitelist_for_all", DataResource.fromName("data")); - assertThat(operations).containsExactlyInAnyOrder(Permission.CREATE, Permission.ALTER, Permission.DROP, Permission.SELECT, Permission.MODIFY, Permission.AUTHORIZE); + assertThat(operations).containsExactlyInAnyOrder(Permission.CREATE, Permission.ALTER, Permission.DROP, Permission.SELECT, Permission.MODIFY, Permission.AUTHORIZE, Permission.UNMASK, Permission.SELECT_MASKED); } @Test diff --git a/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/entry/TestCqlLiteralFlavorAdapter.java b/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/entry/TestCqlLiteralFlavorAdapter.java index 32080363..18c12db1 100644 --- a/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/entry/TestCqlLiteralFlavorAdapter.java +++ b/ecaudit/src/test/java/com/ericsson/bss/cassandra/ecaudit/entry/TestCqlLiteralFlavorAdapter.java @@ -59,7 +59,7 @@ public Object[][] testToCQLLiteral_parameters() { TimestampType.instance, EMPTY_BUFFER, "null" }, { UTF8Type.instance, UTF8Type.instance.fromString("Kalle"), "'Kalle'" }, { AsciiType.instance, AsciiType.instance.fromString("Anka"), "'Anka'" }, - { TimestampType.instance, TimestampType.instance.fromTimeInMillis(42), "1970-01-01T00:00:00.042Z" }, // 42 ms after EPOCH + { TimestampType.instance, TimestampType.instance.fromTimeInMillis(42), "'1970-01-01T00:00:00.042Z'" }, // 42 ms after EPOCH { BooleanType.instance, BooleanType.instance.fromString("True"), "true" }, { BytesType.instance, BytesType.instance.fromString("AABBCCDD"), "0xaabbccdd" }, }; diff --git a/eclog/pom.xml b/eclog/pom.xml index 692852b5..fe40fa8b 100644 --- a/eclog/pom.xml +++ b/eclog/pom.xml @@ -19,10 +19,10 @@ 4.0.0 com.ericsson.bss.cassandra.ecaudit - parent_c4.1 + parent_c5.0 3.1.0-SNAPSHOT - eclog_c4.1 + eclog_c5.0 jar Ericsson Cassandra Audit - Log Tool diff --git a/integration-test-allow-all-authorizer/pom.xml b/integration-test-allow-all-authorizer/pom.xml index 3eee2ea5..3d64d4c4 100644 --- a/integration-test-allow-all-authorizer/pom.xml +++ b/integration-test-allow-all-authorizer/pom.xml @@ -19,10 +19,10 @@ 4.0.0 com.ericsson.bss.cassandra.ecaudit - parent_c4.1 + parent_c5.0 3.1.0-SNAPSHOT - integration-test-allow-all-authorizer_c4.1 + integration-test-allow-all-authorizer_c5.0 Ericsson Cassandra Audit - Allow All Authorizer IT @@ -61,44 +61,6 @@ - - - jdk11 - - 11 - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - ${argLine} - -Djdk.attach.allowAttachSelf=true - --add-exports java.base/jdk.internal.misc=ALL-UNNAMED - --add-exports java.base/jdk.internal.ref=ALL-UNNAMED - --add-exports java.base/sun.nio.ch=ALL-UNNAMED - --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED - --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED - --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED - --add-exports java.sql/java.sql=ALL-UNNAMED - --add-opens java.base/java.lang.module=ALL-UNNAMED - --add-opens java.base/jdk.internal.loader=ALL-UNNAMED - --add-opens java.base/jdk.internal.ref=ALL-UNNAMED - --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED - --add-opens java.base/jdk.internal.math=ALL-UNNAMED - --add-opens java.base/jdk.internal.module=ALL-UNNAMED - --add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED - --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED - - - - - - - - @@ -108,6 +70,36 @@ 1 true + + ${argLine} + -Djdk.attach.allowAttachSelf=true + --add-exports java.base/java.lang.ref=ALL-UNNAMED + --add-exports java.base/jdk.internal.misc=ALL-UNNAMED + --add-exports java.base/jdk.internal.ref=ALL-UNNAMED + --add-exports java.base/sun.nio.ch=ALL-UNNAMED + --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED + --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED + --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED + --add-exports java.sql/java.sql=ALL-UNNAMED + --add-exports jdk.attach/sun.tools.attach=ALL-UNNAMED + --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED + --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + --add-opens java.base/java.lang=ALL-UNNAMED + --add-opens java.base/java.lang.module=ALL-UNNAMED + --add-opens java.base/java.lang.reflect=ALL-UNNAMED + --add-opens java.base/java.io=ALL-UNNAMED + --add-opens java.base/java.nio=ALL-UNNAMED + --add-opens java.base/java.util=ALL-UNNAMED + --add-opens java.base/jdk.internal.loader=ALL-UNNAMED + --add-opens java.base/jdk.internal.ref=ALL-UNNAMED + --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED + --add-opens java.base/jdk.internal.math=ALL-UNNAMED + --add-opens java.base/jdk.internal.module=ALL-UNNAMED + --add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED + --add-opens java.base/sun.nio.ch=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED + --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED + diff --git a/integration-test-query-logger/pom.xml b/integration-test-query-logger/pom.xml index e695ee8e..e0e4b0bf 100644 --- a/integration-test-query-logger/pom.xml +++ b/integration-test-query-logger/pom.xml @@ -19,10 +19,10 @@ 4.0.0 com.ericsson.bss.cassandra.ecaudit - parent_c4.1 + parent_c5.0 3.1.0-SNAPSHOT - integration-test-query-logger_c4.1 + integration-test-query-logger_c5.0 Ericsson Cassandra Audit - Query Logger IT @@ -61,44 +61,6 @@ - - - jdk11 - - 11 - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - ${argLine} - -Djdk.attach.allowAttachSelf=true - --add-exports java.base/jdk.internal.misc=ALL-UNNAMED - --add-exports java.base/jdk.internal.ref=ALL-UNNAMED - --add-exports java.base/sun.nio.ch=ALL-UNNAMED - --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED - --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED - --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED - --add-exports java.sql/java.sql=ALL-UNNAMED - --add-opens java.base/java.lang.module=ALL-UNNAMED - --add-opens java.base/jdk.internal.loader=ALL-UNNAMED - --add-opens java.base/jdk.internal.ref=ALL-UNNAMED - --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED - --add-opens java.base/jdk.internal.math=ALL-UNNAMED - --add-opens java.base/jdk.internal.module=ALL-UNNAMED - --add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED - --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED - - - - - - - - @@ -108,6 +70,36 @@ 1 true + + ${argLine} + -Djdk.attach.allowAttachSelf=true + --add-exports java.base/java.lang.ref=ALL-UNNAMED + --add-exports java.base/jdk.internal.misc=ALL-UNNAMED + --add-exports java.base/jdk.internal.ref=ALL-UNNAMED + --add-exports java.base/sun.nio.ch=ALL-UNNAMED + --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED + --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED + --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED + --add-exports java.sql/java.sql=ALL-UNNAMED + --add-exports jdk.attach/sun.tools.attach=ALL-UNNAMED + --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED + --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + --add-opens java.base/java.lang=ALL-UNNAMED + --add-opens java.base/java.lang.module=ALL-UNNAMED + --add-opens java.base/java.lang.reflect=ALL-UNNAMED + --add-opens java.base/java.io=ALL-UNNAMED + --add-opens java.base/java.nio=ALL-UNNAMED + --add-opens java.base/java.util=ALL-UNNAMED + --add-opens java.base/jdk.internal.loader=ALL-UNNAMED + --add-opens java.base/jdk.internal.ref=ALL-UNNAMED + --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED + --add-opens java.base/jdk.internal.math=ALL-UNNAMED + --add-opens java.base/jdk.internal.module=ALL-UNNAMED + --add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED + --add-opens java.base/sun.nio.ch=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED + --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED + diff --git a/integration-test-standard/pom.xml b/integration-test-standard/pom.xml index 3e9fd805..9ee745c3 100644 --- a/integration-test-standard/pom.xml +++ b/integration-test-standard/pom.xml @@ -19,10 +19,10 @@ 4.0.0 com.ericsson.bss.cassandra.ecaudit - parent_c4.1 + parent_c5.0 3.1.0-SNAPSHOT - integration-test-standard_c4.1 + integration-test-standard_c5.0 Ericsson Cassandra Audit - Standard IT @@ -71,44 +71,6 @@ - - - jdk11 - - 11 - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - ${argLine} - -Djdk.attach.allowAttachSelf=true - --add-exports java.base/jdk.internal.misc=ALL-UNNAMED - --add-exports java.base/jdk.internal.ref=ALL-UNNAMED - --add-exports java.base/sun.nio.ch=ALL-UNNAMED - --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED - --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED - --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED - --add-exports java.sql/java.sql=ALL-UNNAMED - --add-opens java.base/java.lang.module=ALL-UNNAMED - --add-opens java.base/jdk.internal.loader=ALL-UNNAMED - --add-opens java.base/jdk.internal.ref=ALL-UNNAMED - --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED - --add-opens java.base/jdk.internal.math=ALL-UNNAMED - --add-opens java.base/jdk.internal.module=ALL-UNNAMED - --add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED - --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED - - - - - - - - @@ -118,6 +80,36 @@ 2 true + + ${argLine} + -Djdk.attach.allowAttachSelf=true + --add-exports java.base/java.lang.ref=ALL-UNNAMED + --add-exports java.base/jdk.internal.misc=ALL-UNNAMED + --add-exports java.base/jdk.internal.ref=ALL-UNNAMED + --add-exports java.base/sun.nio.ch=ALL-UNNAMED + --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED + --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED + --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED + --add-exports java.sql/java.sql=ALL-UNNAMED + --add-exports jdk.attach/sun.tools.attach=ALL-UNNAMED + --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED + --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + --add-opens java.base/java.lang=ALL-UNNAMED + --add-opens java.base/java.lang.module=ALL-UNNAMED + --add-opens java.base/java.lang.reflect=ALL-UNNAMED + --add-opens java.base/java.io=ALL-UNNAMED + --add-opens java.base/java.nio=ALL-UNNAMED + --add-opens java.base/java.util=ALL-UNNAMED + --add-opens java.base/jdk.internal.loader=ALL-UNNAMED + --add-opens java.base/jdk.internal.ref=ALL-UNNAMED + --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED + --add-opens java.base/jdk.internal.math=ALL-UNNAMED + --add-opens java.base/jdk.internal.module=ALL-UNNAMED + --add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED + --add-opens java.base/sun.nio.ch=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED + --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED + diff --git a/integration-test-standard/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/standard/ITVerifyAudit.java b/integration-test-standard/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/standard/ITVerifyAudit.java index 1e36cd11..5f3d2079 100644 --- a/integration-test-standard/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/standard/ITVerifyAudit.java +++ b/integration-test-standard/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/standard/ITVerifyAudit.java @@ -410,7 +410,7 @@ public void testValidPreparedStatementTypesAreLogged() throws Exception String expectedStatement = "INSERT INTO ecks_itva.ectypetbl " + "(partk, v0, v1, v2, v4, v5, v9, v13, v15)" + " VALUES " - + "(?, ?, ?, ?, ?, ?, ?, ?, ?)[1, 'text', 'ascii', 123123123123123123, true, 1976-02-25, 8.8.8.8, 2004-05-29T14:29:00.000Z, 'varchar']"; + + "(?, ?, ?, ?, ?, ?, ?, ?, ?)[1, 'text', 'ascii', 123123123123123123, true, '1976-02-25', '8.8.8.8', '2004-05-29T14:29:00.000Z', 'varchar']"; // TODO: Are these bugs in Cassandra? // Was expecting "v5 date" to get quotes // Was expecting "v9 inet" to get quotes diff --git a/integration-test-standard/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/standard/ITVerifyWhitelistManagement.java b/integration-test-standard/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/standard/ITVerifyWhitelistManagement.java index 4c5ce4a6..6a6aaee5 100644 --- a/integration-test-standard/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/standard/ITVerifyWhitelistManagement.java +++ b/integration-test-standard/src/test/java/com/ericsson/bss/cassandra/ecaudit/integration/standard/ITVerifyWhitelistManagement.java @@ -188,7 +188,7 @@ public void testAuthorizedUserCanGrantWhitelistToHimself() { authorizedSession.execute("ALTER ROLE authorized_user WITH OPTIONS = { 'grant_audit_whitelist_for_all' : 'data' }"); - assertRoleOperations("authorized_user", "data", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE")); + assertRoleOperations("authorized_user", "data", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } @Test @@ -196,7 +196,7 @@ public void testAuthorizedUserCanGrantWhitelistToOther() { authorizedSession.execute("ALTER ROLE other_user WITH OPTIONS = { 'grant_audit_whitelist_for_all' : 'data' }"); - assertRoleOperations("other_user", "data", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE")); + assertRoleOperations("other_user", "data", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } @Test @@ -204,7 +204,7 @@ public void testAuthorizedUserCanGrantPermissionDerivedWhitelistToHimself() { authorizedSession.execute("ALTER ROLE authorized_user WITH OPTIONS = { 'grant_audit_whitelist_for_all' : 'grants/data' }"); - assertRoleOperations("authorized_user", "grants/data", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE")); + assertRoleOperations("authorized_user", "grants/data", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } @Test @@ -212,7 +212,7 @@ public void testAuthorizedUserCanGrantPermissionDerivedWhitelistToOthers() { authorizedSession.execute("ALTER ROLE other_user WITH OPTIONS = { 'grant_audit_whitelist_for_all' : 'grants/data' }"); - assertRoleOperations("other_user", "grants/data", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE")); + assertRoleOperations("other_user", "grants/data", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } @Test(expected = UnauthorizedException.class) @@ -246,7 +246,7 @@ public void testSuperUserCanWhitelistOnDataPartly() given_temporary_user(superSession); superSession.execute("ALTER ROLE temporary_user WITH OPTIONS = { 'grant_audit_whitelist_for_all' : 'data/ecks_itvwm/ectbl' }"); - assertRoleOperations("temporary_user", "data/ecks_itvwm/ectbl", asList("ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE")); + assertRoleOperations("temporary_user", "data/ecks_itvwm/ectbl", asList("ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } @Test @@ -255,7 +255,7 @@ public void testSuperUserCanWhitelistOnNonexistingKeyspace() given_temporary_user(superSession); superSession.execute("ALTER ROLE temporary_user WITH OPTIONS = { 'grant_audit_whitelist_for_all' : 'data/unknownks' }"); - assertRoleOperations("temporary_user", "data/unknownks", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE")); + assertRoleOperations("temporary_user", "data/unknownks", asList("CREATE", "ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } @Test (expected = InvalidQueryException.class) @@ -271,7 +271,7 @@ public void testSuperUserCanWhitelistOnNonexistingTable() given_temporary_user(superSession); superSession.execute("ALTER ROLE temporary_user WITH OPTIONS = { 'grant_audit_whitelist_for_all' : 'data/ecks_itvwm/unknowntbl' }"); - assertRoleOperations("temporary_user", "data/ecks_itvwm/unknowntbl", asList("ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE")); + assertRoleOperations("temporary_user", "data/ecks_itvwm/unknowntbl", asList("ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } @Test (expected = InvalidQueryException.class) @@ -319,7 +319,7 @@ public void testSuperUserCanWhitelistOnTableDataGrant() { given_temporary_user(superSession); superSession.execute("ALTER ROLE temporary_user WITH OPTIONS = { 'grant_audit_whitelist_for_all' : 'grants/data/ks/tb' }"); - assertRoleOperations("temporary_user", "grants/data/ks/tb", asList("ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE")); + assertRoleOperations("temporary_user", "grants/data/ks/tb", asList("ALTER", "DROP", "SELECT", "MODIFY", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } @Test (expected = InvalidQueryException.class) @@ -370,7 +370,7 @@ public void testRevokeOperations() superSession.execute("ALTER ROLE temporary_user WITH OPTIONS = { 'revoke_audit_whitelist_for_modify' : 'data' }"); superSession.execute("ALTER ROLE temporary_user WITH OPTIONS = { 'revoke_audit_whitelist_for_drop' : 'data' }"); - assertRoleOperations("temporary_user", "data", asList("CREATE", "ALTER", "SELECT", "AUTHORIZE")); + assertRoleOperations("temporary_user", "data", asList("CREATE", "ALTER", "SELECT", "AUTHORIZE", "UNMASK", "SELECT_MASKED")); } private void given_temporary_user(CqlSession privateSession) diff --git a/pom.xml b/pom.xml index 92e7de8c..d5bfd7dd 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.0.0 com.ericsson.bss.cassandra.ecaudit - parent_c4.1 + parent_c5.0 3.1.0-SNAPSHOT pom @@ -48,11 +48,11 @@ UTF-8 - 1.8 - 1.8 + 11 + 11 - 4.1.2 - c4.1 + 5.0-alpha1 + c5.0 pmd-rules.xml @@ -83,7 +83,7 @@ 3.2.1 3.2.0 1.6 - 0.8.6 + 0.8.10 1.6.2 3.15.0 @@ -185,8 +185,8 @@ maven-compiler-plugin ${org.apache.maven.plugins.maven-compiler-plugin.version} - 1.8 - 1.8 + 11 + 11 @@ -202,6 +202,36 @@ + + ${argLine} + -Djdk.attach.allowAttachSelf=true + --add-exports java.base/java.lang.ref=ALL-UNNAMED + --add-exports java.base/jdk.internal.misc=ALL-UNNAMED + --add-exports java.base/jdk.internal.ref=ALL-UNNAMED + --add-exports java.base/sun.nio.ch=ALL-UNNAMED + --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED + --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED + --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED + --add-exports java.sql/java.sql=ALL-UNNAMED + --add-exports jdk.attach/sun.tools.attach=ALL-UNNAMED + --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED + --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + --add-opens java.base/java.lang=ALL-UNNAMED + --add-opens java.base/java.lang.module=ALL-UNNAMED + --add-opens java.base/java.lang.reflect=ALL-UNNAMED + --add-opens java.base/java.io=ALL-UNNAMED + --add-opens java.base/java.nio=ALL-UNNAMED + --add-opens java.base/java.util=ALL-UNNAMED + --add-opens java.base/jdk.internal.loader=ALL-UNNAMED + --add-opens java.base/jdk.internal.ref=ALL-UNNAMED + --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED + --add-opens java.base/jdk.internal.math=ALL-UNNAMED + --add-opens java.base/jdk.internal.module=ALL-UNNAMED + --add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED + --add-opens java.base/sun.nio.ch=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED + --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED + com.ericsson.bss.cassandra.ecaudit.integration.* diff --git a/test-utils/pom.xml b/test-utils/pom.xml index 8f554edf..ae679635 100644 --- a/test-utils/pom.xml +++ b/test-utils/pom.xml @@ -19,10 +19,10 @@ 4.0.0 com.ericsson.bss.cassandra.ecaudit - parent_c4.1 + parent_c5.0 3.1.0-SNAPSHOT - test-utils_c4.1 + test-utils_c5.0 jar Ericsson Cassandra Audit - Test Utils 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 5f25be29..dbd5d1cb 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 @@ -21,6 +21,7 @@ import org.apache.cassandra.auth.IAuthorizer; import org.apache.cassandra.auth.INetworkAuthorizer; import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.dht.RandomPartitioner; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -42,10 +43,12 @@ public static void beforeClass() DatabaseDescriptor.setAuthorizer(authorizerMock); when(networkAuthorizerMock.bulkLoader()).thenReturn(Collections::emptyMap); DatabaseDescriptor.setNetworkAuthorizer(networkAuthorizerMock); + DatabaseDescriptor.setPartitionerUnsafe(RandomPartitioner.instance); } public static void afterClass() { + DatabaseDescriptor.setPartitionerUnsafe(null); DatabaseDescriptor.setNetworkAuthorizer(null); DatabaseDescriptor.setAuthorizer(null); DatabaseDescriptor.setAuthenticator(null);