Skip to content

Commit

Permalink
Merge branch 'release/c4.0' into merge_to_4_0
Browse files Browse the repository at this point in the history
  • Loading branch information
tommystendahl authored Nov 10, 2023
2 parents ad9e47c + 47955fe commit 67c5d4e
Show file tree
Hide file tree
Showing 66 changed files with 1,891 additions and 1,487 deletions.
69 changes: 63 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ permissions: read-all
jobs:
code-analysis:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11' ]
name: Java ${{ matrix.java }} code analysis
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK 8
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: 'adopt'
java-version: '8'
java-version: ${{ matrix.java }}
- name: Cache Maven packages
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
Expand All @@ -25,14 +29,18 @@ jobs:
run: mvn --batch-mode --activate-profiles github install pmd:check pmd:cpd-check license:check javadoc:jar -DskipTests=true
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11' ]
name: Java ${{ matrix.java }} unit test
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK 8
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: 'adopt'
java-version: '8'
java-version: ${{ matrix.java }}
- name: Cache Maven packages
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
Expand All @@ -48,16 +56,46 @@ jobs:
flags: unit-tests
fail_ci_if_error: true
verbose: true
unit-tests-java-target:
runs-on: ubuntu-latest
name: Java 11 target 11 unit test
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK 11
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: 'adopt'
java-version: '11'
- name: Cache Maven packages
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-ut-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-ut-
- name: Unit Tests
run: mvn --batch-mode --activate-profiles github test jacoco:report -Dmaven.compiler.target=11 -Dmaven.compiler.source=11
- name: Upload test coverage report
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: ./ecaudit/target/site/jacoco/jacoco.xml,./common/target/site/jacoco/jacoco.xml,./eclog/target/site/jacoco/jacoco.xml
flags: unit-tests
fail_ci_if_error: true
verbose: true
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11' ]
name: Java ${{ matrix.java }} integration tests
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK 8
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: 'adopt'
java-version: '8'
java-version: ${{ matrix.java }}
- name: Cache Maven packages
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
Expand All @@ -66,3 +104,22 @@ jobs:
restore-keys: ${{ runner.os }}-m2-it-
- name: Integration Tests
run: mvn --batch-mode --activate-profiles github test-compile failsafe:integration-test failsafe:verify
integration-tests-java-target:
runs-on: ubuntu-latest
name: Java 11 target 11 integration tests
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK 11
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: 'adopt'
java-version: '11'
- name: Cache Maven packages
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-it-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-it-
- name: Integration Tests
run: mvn --batch-mode --activate-profiles github test-compile failsafe:integration-test failsafe:verify -Dmaven.compiler.target=11 -Dmaven.compiler.source=11
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Version 3.1.0 (unreleased)

* Add Audit Prepare statements - #226
* Test with java11 (only flavor ecaudit_c4.0) - #214

## Version 3.0.0 (only flavor ecaudit_c4.1)

Expand All @@ -17,8 +18,11 @@
* Build with Cassandra 3.0.28 (only flavor ecaudit_c3.0)
* Bumps snakeyaml from 1.29 to 1.33
* Handle values that has not been assigned a value with prepared statements - #202
* Support server side DESCRIBE command (only flavor ecaudit_c4.0)
* Fix unrecognized CQLStatement for unprepared schema altering statements (only flavor ecaudit_c4.0)

## Version 2.9.0
* Use the correct id for system_auth.role_audit_whitelists_v2 with Cassandra 4.0.1 (only flavor ecaudit_c4.0)
* Build with Cassandra 4.0.3 (only flavor ecaudit_c4.0)
* Build with Cassandra 3.11.12 (only flavor ecaudit_c3.11)
* Build with Cassandra 3.0.26 (only flavor ecaudit_c3.0)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ecAudit

[![tests](https://github.com/Ericsson/ecaudit/actions/workflows/test.yml/badge.svg?branch=release/c3.11)](https://github.com/Ericsson/ecaudit/actions/workflows/test.yml?query=branch%3Arelease/c3.11)
[![coverage](https://codecov.io/gh/Ericsson/ecaudit/branch/release/c3.11/graph/badge.svg?token=f42z31Yqr3)](https://codecov.io/gh/Ericsson/ecaudit/branch/release%2Fc3.11)
[![tests](https://github.com/Ericsson/ecaudit/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/Ericsson/ecaudit/actions/workflows/test.yml?query=branch%3Amaster)
[![coverage](https://codecov.io/gh/ericsson/ecaudit/branch/master/graph/badge.svg?token=f42z31Yqr3)](https://codecov.io/gh/Ericsson/ecaudit/branch/master)

With ecAudit you get auditing and query logger functionality for Apache Cassandra 3.0 and 3.11.
With ecAudit you get auditing and query logger functionality for Apache Cassandra 3.0, 3.11 and 4.0.

Features include:
* Detailed audit records for CQL operations and login attempts
Expand Down
5 changes: 3 additions & 2 deletions bin/import_cassandra_yaml_to_it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ format_for_it () {
sed -i 's/key_cache_size_in_mb:.*/key_cache_size_in_mb: 0/' $2
sed -i 's/counter_cache_size_in_mb:.*/counter_cache_size_in_mb: 0/' $2
sed -i 's/^storage_port:.*/storage_port: ###storage_port###/' $2
sed -i 's/^ssl_storage_port:.*/ssl_storage_port: ###ssl_storage_port###/' $2
sed -i 's/^storage_port:.*/storage_port: ###storage_port###/' $2
sed -i 's/- seeds:.*/- seeds: \"127.0.0.1:###storage_port###\"/' $2
sed -i 's/^native_transport_port:.*/native_transport_port: ###native_transport_port###/' $2
sed -i 's/^rpc_port:.*/rpc_port: ###rpc_port###/' $2
sed -i 's/^num_tokens:.*/num_tokens: 1/' $2
sed -i 's/^enable_user_defined_functions:.*/enable_user_defined_functions: true/' $2
sed -i 's/^auto_snapshot:.*/auto_snapshot: false/' $2
sed -i 's/^enable_materialized_views:.*/enable_materialized_views: true/' $2
}

for IT_TARGET in ${SCRIPT_PATH}/../integration-test-*/src/test/resources/cassandra.yaml;
Expand Down
9 changes: 5 additions & 4 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ericsson.bss.cassandra.ecaudit</groupId>
<artifactId>parent_c3.11</artifactId>
<artifactId>parent_c4.0</artifactId>
<version>3.1.0-SNAPSHOT</version>
</parent>
<artifactId>common_c3.11</artifactId>
<artifactId>common_c4.0</artifactId>
<packaging>jar</packaging>

<name>Ericsson Cassandra Audit - Common</name>
Expand All @@ -33,9 +33,10 @@

<dependencies>
<dependency>
<groupId>net.openhft</groupId>
<artifactId>chronicle-queue</artifactId>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.assertj</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

import com.ericsson.bss.cassandra.ecaudit.common.record.Status;
import com.ericsson.bss.cassandra.ecaudit.common.record.StoredAuditRecord;

import net.openhft.chronicle.queue.ChronicleQueue;
import net.openhft.chronicle.queue.ChronicleQueueBuilder;
import net.openhft.chronicle.queue.ExcerptTailer;

import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder;
import static org.assertj.core.api.Assertions.assertThat;

public class TestReadVersion0
Expand All @@ -40,7 +40,7 @@ public class TestReadVersion0
public static void beforeClass()
{
File queueDirVersion0 = new File("src/test/resources/q0");
chronicleQueue = ChronicleQueueBuilder
chronicleQueue = SingleChronicleQueueBuilder
.single(queueDirVersion0)
.blockSize(1024)
.readOnly(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

import com.ericsson.bss.cassandra.ecaudit.common.record.Status;
import com.ericsson.bss.cassandra.ecaudit.common.record.StoredAuditRecord;

import net.openhft.chronicle.queue.ChronicleQueue;
import net.openhft.chronicle.queue.ChronicleQueueBuilder;
import net.openhft.chronicle.queue.ExcerptTailer;

import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder;
import static org.assertj.core.api.Assertions.assertThat;

/**
Expand Down Expand Up @@ -62,7 +62,7 @@ public class TestReadVersion1
public static void beforeClass()
{
File queueDirVersion1 = new File("src/test/resources/q1");
chronicleQueue = ChronicleQueueBuilder
chronicleQueue = SingleChronicleQueueBuilder
.single(queueDirVersion1)
.blockSize(1024)
.readOnly(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import com.ericsson.bss.cassandra.ecaudit.common.chronicle.WriteTestDataUtil;
import com.ericsson.bss.cassandra.ecaudit.common.record.Status;
import com.ericsson.bss.cassandra.ecaudit.common.record.StoredAuditRecord;

import net.openhft.chronicle.queue.ChronicleQueue;
import net.openhft.chronicle.queue.ChronicleQueueBuilder;
import net.openhft.chronicle.queue.ExcerptTailer;

import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder;
import static org.assertj.core.api.Assertions.assertThat;

/**
Expand Down Expand Up @@ -65,7 +65,7 @@ public class TestReadVersion2
public static void beforeClass()
{
File queueDirVersion1 = new File("src/test/resources/q2");
chronicleQueue = ChronicleQueueBuilder
chronicleQueue = SingleChronicleQueueBuilder
.single(queueDirVersion1)
.blockSize(1024)
.readOnly(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
import com.ericsson.bss.cassandra.ecaudit.common.record.SimpleAuditRecord;
import com.ericsson.bss.cassandra.ecaudit.common.record.Status;
import com.ericsson.bss.cassandra.ecaudit.common.record.StoredAuditRecord;

import net.openhft.chronicle.core.io.IORuntimeException;
import net.openhft.chronicle.queue.ChronicleQueue;
import net.openhft.chronicle.queue.ChronicleQueueBuilder;
import net.openhft.chronicle.queue.ExcerptAppender;
import net.openhft.chronicle.queue.ExcerptTailer;
import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder;
import net.openhft.chronicle.wire.WriteMarshallable;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

Expand All @@ -51,7 +51,7 @@ public class TestWriteReadVersionCurrent
@Before
public void before()
{
chronicleQueue = ChronicleQueueBuilder.single(temporaryFolder.getRoot()).blockSize(1024).build();
chronicleQueue = SingleChronicleQueueBuilder.single(temporaryFolder.getRoot()).blockSize(1024).build();
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import com.ericsson.bss.cassandra.ecaudit.common.record.AuditRecord;
import com.ericsson.bss.cassandra.ecaudit.common.record.SimpleAuditRecord;
import com.ericsson.bss.cassandra.ecaudit.common.record.Status;

import net.openhft.chronicle.queue.ChronicleQueue;
import net.openhft.chronicle.queue.ChronicleQueueBuilder;
import net.openhft.chronicle.queue.ExcerptAppender;

import net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder;
import static java.util.Arrays.asList;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -60,7 +60,7 @@ public static void main(String[] args) throws Exception
.build();

// Write Data to Queue
ChronicleQueue chronicleQueue = ChronicleQueueBuilder
ChronicleQueue chronicleQueue = SingleChronicleQueueBuilder
.single(new File("common/src/test/resources/q" + version))
.blockSize(1024)
.build();
Expand Down
2 changes: 1 addition & 1 deletion doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Visit the [sertup guide](setup.md) for a detailed list of options.
## Deploy Plug-In Jar File

Place the ecAudit jar file in your ```$CASSANDRA_HOME/lib/``` directory.
Get the official releases from [Maven Central](https://search.maven.org/search?q=g:%22com.ericsson.bss.cassandra.ecaudit%22%20AND%20a:%22ecaudit_c3.11%22).
Get the official releases from [Maven Central](https://search.maven.org/search?q=g:%22com.ericsson.bss.cassandra.ecaudit%22%20AND%20a:%22ecaudit_c4.0%22).


## Enable Plug-In
Expand Down
2 changes: 1 addition & 1 deletion doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ When upgrading ecAudit to a new version, always consider special [upgrade instru

## Prerequisites

ecAudit requires a Java 8 compatible JVM.
ecAudit requires a Java 8 or Java 11 compatible JVM.


## Installation
Expand Down
8 changes: 6 additions & 2 deletions ecaudit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ericsson.bss.cassandra.ecaudit</groupId>
<artifactId>parent_c3.11</artifactId>
<artifactId>parent_c4.0</artifactId>
<version>3.1.0-SNAPSHOT</version>
</parent>
<artifactId>ecaudit_c3.11</artifactId>
<artifactId>ecaudit_c4.0</artifactId>
<packaging>jar</packaging>

<name>Ericsson Cassandra Audit - Plug-in</name>
Expand All @@ -41,6 +41,10 @@
<artifactId>common_${artifact.flavor.version}</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.assertj</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void auditRegular(String operation, ClientState state, Status status, lon
{
AuditEntry logEntry = entryBuilderFactory.createEntryBuilder(operation, state)
.client(state.getRemoteAddress())
.coordinator(FBUtilities.getBroadcastAddress())
.coordinator(FBUtilities.getJustBroadcastAddress())
.user(state.getUser().getName())
.operation(new SimpleAuditOperation(operation))
.status(status)
Expand All @@ -123,7 +123,7 @@ public void auditPrepare(String operation, ClientState state, Status status, lon
{
AuditEntry logEntry = entryBuilderFactory.createEntryBuilder(operation, state)
.client(state.getRemoteAddress())
.coordinator(FBUtilities.getBroadcastAddress())
.coordinator(FBUtilities.getJustBroadcastAddress())
.user(state.getUser().getName())
.operation(new PrepareAuditOperation(operation))
.status(status)
Expand All @@ -150,7 +150,7 @@ public void auditPrepared(String rawStatement, CQLStatement statement, ClientSta
{
AuditEntry logEntry = entryBuilderFactory.createEntryBuilder(statement)
.client(state.getRemoteAddress())
.coordinator(FBUtilities.getBroadcastAddress())
.coordinator(FBUtilities.getJustBroadcastAddress())
.user(state.getUser().getName())
.operation(new PreparedAuditOperation(rawStatement, options, boundValueSuppressor))
.status(status)
Expand Down Expand Up @@ -178,7 +178,7 @@ public void auditBatch(BatchStatement statement, List<String> rawStatements, UUI
{
AuditEntry.Builder builder = entryBuilderFactory.createBatchEntryBuilder()
.client(state.getRemoteAddress())
.coordinator(FBUtilities.getBroadcastAddress())
.coordinator(FBUtilities.getJustBroadcastAddress())
.user(state.getUser().getName())
.batch(uuid)
.status(status)
Expand Down Expand Up @@ -229,7 +229,7 @@ public void auditAuth(String userName, InetAddress clientIp, String subject, Sta
{
AuditEntry logEntry = entryBuilderFactory.createAuthenticationEntryBuilder()
.client(new InetSocketAddress(clientIp, AuditEntry.UNKNOWN_PORT))
.coordinator(FBUtilities.getBroadcastAddress())
.coordinator(FBUtilities.getJustBroadcastAddress())
.user(userName)
.subject(subject)
.status(status)
Expand Down
Loading

0 comments on commit 67c5d4e

Please sign in to comment.