Skip to content

Commit

Permalink
Merge pull request #428 from nosan/5.0
Browse files Browse the repository at this point in the history
5.0.0-SNAPSHOT
  • Loading branch information
nosan authored Sep 10, 2024
2 parents 2193b48 + 75545b0 commit 0c23062
Show file tree
Hide file tree
Showing 116 changed files with 629 additions and 3,367 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Also see [CONTRIBUTING.md](CONTRIBUTING.md) if you wish to submit pull requests.

## Build

`Embedded Cassandra` can be easily built with the [maven wrapper](https://github.com/takari/maven-wrapper). You also need `JDK 1.8`.
`Embedded Cassandra` can be easily built with the [maven wrapper](https://github.com/takari/maven-wrapper). You also need `JDK 11`.

## License

Expand Down
10 changes: 4 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.nosan</groupId>
<artifactId>embedded-cassandra</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<description>Embedded Cassandra</description>
Expand Down Expand Up @@ -41,7 +41,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<nexus.url>https://oss.sonatype.org</nexus.url>
<java.version>1.8</java.version>
<java.version>11</java.version>
<junit5.version>5.11.0</junit5.version>
<checkstyle.version>9.3</checkstyle.version>
<cassandra-java-driver-core.version>4.17.0</cassandra-java-driver-core.version>
Expand Down Expand Up @@ -131,9 +131,8 @@
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<optional>true</optional>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
Expand Down Expand Up @@ -239,7 +238,6 @@
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
<suppressionsLocation>src/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
<headerLocation>src/checkstyle/checkstyle-header.txt</headerLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
Expand Down
9 changes: 3 additions & 6 deletions src/docs/asciidoc/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ This section covers how to configure Embedded Cassandra.
include::{sources}/CassandraExamples.java[tag=version]
----

NOTE: Defaults to *4.1.3*.

CAUTION: Since *4.0-beta4*, Windows scripts were removed. https://issues.apache.org/jira/browse/CASSANDRA-16171[CASSANDRA-16171]
NOTE: Defaults to *5.0.0*.

== Config Properties

Expand All @@ -30,7 +28,6 @@ For example `cassandra.yaml`:
...
storage_port: 7199
native_transport_port: 9042
rpc_port: 9160
client_encryption_options:
enabled: false
...
Expand All @@ -51,7 +48,6 @@ The output `cassandra.yaml`:
...
storage_port: 7000
native_transport_port: 9000
rpc_port: 9160
client_encryption_options:
enabled: true
...
Expand Down Expand Up @@ -219,4 +215,5 @@ Configure a logger, that consumes Cassandra `STDOUT` and `STDERR` outputs.
include::{sources}/CassandraExamples.java[tag=logger]
----

NOTE: Defaults to `Logger.get(Cassandra.class)`.
NOTE: Defaults to `LoggerFactory.getLogger(Cassandra.class)`.

26 changes: 8 additions & 18 deletions src/docs/asciidoc/faq.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,11 @@

== What are OSs supported by Embedded Cassandra?

Embedded Cassandra is tested under the `ubuntu-latest`, `macos-latest` and `windows-latest` platforms.
Embedded Cassandra is tested under the `ubuntu-latest` and `macos-latest` platforms.

== What are versions supported by Embedded Cassandra?

Embedded Cassandra project is tested for `2.X.X` - `4.X.X` Cassandra versions.

|===
|OS |Version Range

|Windows
|2.X.X - 4.0-beta3

|OSX
|2.X.X - 4.X.X

|Linux
|2.X.X - 4.X.X
|===

CAUTION: Since *4.0-beta4*, Windows scripts were removed https://issues.apache.org/jira/browse/CASSANDRA-16171[CASSANDRA-16171]
Embedded Cassandra project is tested for `>= 4.x.x` Cassandra versions.

== What are compile dependencies used by Embedded Cassandra?

Expand All @@ -44,6 +29,11 @@ Embedded Cassandra has only two compile dependencies:
<artifactId>snakeyaml</artifactId>
<version>{snakeyaml-version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>{logback-classic-version}</version>
</dependency>
</dependecies>
----

Expand All @@ -58,4 +48,4 @@ https://downloads.apache.org/cassandra/. For older versions, https://archive.apa

== Where are the files downloaded?

By default, files are downloaded into *~/.embedded-cassandra/cassandra* directory
By default, files are downloaded into *~/.embedded-cassandra/* directory
2 changes: 1 addition & 1 deletion src/docs/asciidoc/getting-started.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Embedded Cassandra repository can be found {github-code}[here]
=== Build Source

Embedded Cassandra can be easily built with the https://github.com/takari/maven-wrapper[maven wrapper].
You also need `JDK 1.8`.
You also need `JDK 11`.

[source,bash]
----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

abstract class AbstractCassandraDatabase implements CassandraDatabase {

Expand All @@ -45,7 +44,7 @@ abstract class AbstractCassandraDatabase implements CassandraDatabase {

private final Set<String> jvmOptions;

private volatile Process process;
private volatile ProcessWrapper process;

AbstractCassandraDatabase(String name, Version version, Path configurationFile, Path workingDirectory,
Map<String, String> environmentVariables, Map<String, Object> configProperties,
Expand All @@ -67,7 +66,7 @@ public final synchronized void start() throws IOException {

@Override
public final synchronized void stop() throws IOException {
Process process = this.process;
ProcessWrapper process = this.process;
if (process != null && process.isAlive()) {
doStop(process);
if (!process.destroy().waitFor(5, TimeUnit.SECONDS)) {
Expand Down Expand Up @@ -105,13 +104,12 @@ public final Set<String> getJvmOptions() {

@Override
public final synchronized CompletableFuture<? extends CassandraDatabase> onExit() {
return this.process.onExit()
.thenApply((Function<Process, CassandraDatabase>) processHandler -> this);
return this.process.onExit().thenApply(p -> this);
}

@Override
public final synchronized boolean isAlive() {
Process process = this.process;
ProcessWrapper process = this.process;
return (process != null) && process.isAlive();
}

Expand All @@ -131,12 +129,12 @@ public final Path getConfigurationFile() {
}

@Override
public final synchronized Process.Output getStdOut() {
public final synchronized ProcessWrapper.Output getStdOut() {
return this.process.getStdOut();
}

@Override
public final synchronized Process.Output getStdErr() {
public final synchronized ProcessWrapper.Output getStdErr() {
return this.process.getStdErr();
}

Expand All @@ -145,8 +143,8 @@ public final String toString() {
return getClass().getSimpleName() + "{" + "process=" + this.process + '}';
}

protected abstract Process doStart() throws IOException;
protected abstract ProcessWrapper doStart() throws IOException;

protected abstract void doStop(Process process) throws IOException;
protected abstract void doStop(ProcessWrapper process) throws IOException;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,10 +34,12 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.nosan.embedded.cassandra.commons.Resource;
import com.github.nosan.embedded.cassandra.commons.StringUtils;
import com.github.nosan.embedded.cassandra.commons.function.IOSupplier;
import com.github.nosan.embedded.cassandra.commons.logging.Logger;
import com.github.nosan.embedded.cassandra.commons.web.JdkHttpClient;

/**
Expand All @@ -56,7 +58,7 @@ public class CassandraBuilder {
/**
* Default Cassandra version.
*/
public static final Version DEFAULT_VERSION = Version.parse("4.1.3");
public static final Version DEFAULT_VERSION = Version.parse("5.0.0");

private static final AtomicInteger CASSANDRA_ID = new AtomicInteger();

Expand Down Expand Up @@ -110,8 +112,8 @@ public Cassandra build() {
}
WorkingDirectoryInitializer workingDirectoryInitializer = this.workingDirectoryInitializer;
if (workingDirectoryInitializer == null) {
workingDirectoryInitializer = new DefaultWorkingDirectoryInitializer(new WebCassandraDirectoryProvider(
new JdkHttpClient(Duration.ofMinutes(1), Duration.ofMinutes(1))));
workingDirectoryInitializer = new DefaultWorkingDirectoryInitializer(
new WebCassandraDirectoryProvider(new JdkHttpClient(Duration.ofMinutes(1), Duration.ofMinutes(1))));
}
WorkingDirectoryDestroyer workingDirectoryDestroyer = this.workingDirectoryDestroyer;
if (workingDirectoryDestroyer == null) {
Expand All @@ -123,7 +125,7 @@ public Cassandra build() {
}
Logger logger = this.logger;
if (logger == null) {
logger = Logger.get(Cassandra.class);
logger = LoggerFactory.getLogger(Cassandra.class);
}
Map<String, Object> environmentVariables = new LinkedHashMap<>(this.environmentVariables);
environmentVariables.values().removeIf(Objects::isNull);
Expand Down Expand Up @@ -204,7 +206,7 @@ public Version getVersion() {

/**
* Sets the Cassandra logger. This logger will consume Cassandra stdout and stderr outputs.
* <p>Defaults to {@code Logger.get(Cassandra.class)}
* <p>Defaults to {@code LoggerFactory.getLogger(Cassandra.class)}
*
* @param logger the Cassandra logger
* @return this builder
Expand Down Expand Up @@ -659,7 +661,7 @@ public CassandraBuilder addConfigProperties(Map<String, ?> configProperties) {
* }
* </pre>
*
* @param path path (file only) within the working directory (e.g conf/cassandra.yaml)
* @param path path (file only) within the working directory (e.g. conf/cassandra.yaml)
* @param resource the resource
* @return this builder
* @see WorkingDirectoryCustomizer#addResource(Resource, String)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -48,8 +48,8 @@ interface CassandraDatabase {

Path getConfigurationFile();

Process.Output getStdOut();
ProcessWrapper.Output getStdOut();

Process.Output getStdErr();
ProcessWrapper.Output getStdErr();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 0c23062

Please sign in to comment.