Skip to content

Commit

Permalink
Merge pull request #7 from GoodforGod/dev
Browse files Browse the repository at this point in the history
[0.5.0]
  • Loading branch information
GoodforGod committed Aug 22, 2023
2 parents 550e15f + af63bd3 commit ca967a8
Show file tree
Hide file tree
Showing 115 changed files with 1,939 additions and 2,508 deletions.
9 changes: 1 addition & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ subprojects {
}

test {
failFast(false)
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
Expand Down Expand Up @@ -133,14 +134,6 @@ subprojects {
apply plugin: "maven-publish"
apply plugin: "org.sonarqube"

sonarqube {
properties {
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "goodforgod"
property "sonar.projectKey", "GoodforGod_$artifactRootId"
}
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down
17 changes: 10 additions & 7 deletions cassandra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Features:

**Gradle**
```groovy
testImplementation "io.goodforgod:testcontainers-extensions-cassandra:0.4.2"
testImplementation "io.goodforgod:testcontainers-extensions-cassandra:0.5.0"
```

**Maven**
```xml
<dependency>
<groupId>io.goodforgod</groupId>
<artifactId>testcontainers-extensions-cassandra</artifactId>
<version>0.4.2</version>
<version>0.5.0</version>
<scope>test</scope>
</dependency>
```
Expand All @@ -52,22 +52,22 @@ testImplementation "com.datastax.oss:java-driver-core:4.17.0"

## Content
- [Container](#container)
- [Preconfigured container](#preconfigured-container)
- [Manual Container](#manual-container)
- [Container Old Driver](#container-old-driver)
- [Connection](#connection)
- [External Connection](#external-connection)
- [Migration](#migration)

## Container

`@TestcontainersCassandra` - provides container start in different modes per test class.
`@TestcontainersCassandra` - allow **automatically start container** with specified image in different modes without the need to configure it.

Available containers modes:
- `PER_RUN` - start container one time per *test execution*. (Containers should have same image to be reused between test classes)
- `PER_CLASS` - start new container each *test class*.
- `PER_METHOD` - start new container each *test method*.

Simple example on how to start container per class:
Simple example on how to start container per class, **no need to configure** container:
```java
@TestcontainersCassandra(mode = ContainerMode.PER_CLASS)
class ExampleTests {
Expand All @@ -79,11 +79,14 @@ class ExampleTests {
}
```

**That's all** you need.

It is possible to customize image with annotation `image` parameter.

### Preconfigured container
### Manual Container

Container instance can be used by extensions via `@ContainerCassandra` annotation.
When you need to **manually configure container** with specific options, you can provide such container as instance that will be used by `@TestcontainersCassandra`,
this can be done using `@ContainerCassandra` annotation for container.

Example:
```java
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.goodforgod.testcontainers.extensions.cassandra;

import io.goodforgod.testcontainers.extensions.AbstractContainerMetadata;
import io.goodforgod.testcontainers.extensions.ContainerMode;
import org.jetbrains.annotations.ApiStatus.Internal;

@Internal
final class CassandraMetadata extends AbstractContainerMetadata {

private final Migration migration;

CassandraMetadata(boolean network, String image, ContainerMode runMode, Migration migration) {
super(network, image, runMode);
this.migration = migration;
}

Migration migration() {
return migration;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface TestcontainersCassandra {

/**
* @return where nether to create default container with
* {@link org.testcontainers.containers.Network#SHARED} network
*/
boolean network() default false;

/**
* @return Cassandra image
*/
Expand Down
Loading

0 comments on commit ca967a8

Please sign in to comment.