Skip to content

Commit

Permalink
DOCS: Update readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
brido4125 authored and jhpark816 committed Jun 12, 2024
1 parent 7cca750 commit 4a9c2b0
Showing 1 changed file with 133 additions and 1 deletion.
134 changes: 133 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,135 @@
# TestContainers Arcus
# Arcus TestContainer

![CI](https://github.com/jam2in/arcus-test-container/actions/workflows/ci.yml/badge.svg)
![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)

Testcontainers Arcus is an extension of Testcontainers that supports Arcus (Standalone and Cluster) containers.
___
## Getting Started
___
### Gradle
```groovy
dependencies {
testImplementation "org.jam2in:arcus-test-container:1.0.0-SNAPSHOT"
}
```

### Maven
```xml
<dependency>
<groupId>org.jam2in</groupId>
<artifactId>arcus-test-container</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
```

## Usage
### container that are restarted for every test method
1. single node
```java
@Testcontainers
public class ArcusContainerTest {

@Container
private final ArcusContainer arcusContainer = ArcusContainer.create();

@Test
void testcase() {
//given
ArcusClient arcusClient = new ArcusClient(
new DefaultConnectionFactory(),
new ArrayList<>(Arrays.asList(new InetSocketAddress("127.0.0.1", 11211))));

//when
Boolean b = arcusClient.set("test", 10, "singleTestValue").get();

//then
assertThat(b).isTrue();
}
}
```
2. cluster

```java
@Testcontainers
public class ArcusClusterContainerTest {

@Container
private final ArcusClusterContainer arcusCluster = ArcusClusterContainer.create();

@Test
void testcase() {
//given
ArcusClientPool arcusClient = ArcusClient.createArcusClientPool("test", new ConnectionFactoryBuilder(), 2);

//when
Boolean b = arcusClient.set("test", 10, "singleTestValue").get();

//then
assertThat(b).isTrue();
}
}
```
### container that are shared between all methods of a test class
1. single node

```java
public class ArcusContainerTestBase {

protected static final ArcusContainer ARCUS_CONTAINER;

static {
ARCUS_CONTAINER = ArcusContainer.create();
ARCUS_CONTAINER.start();
}
}
```
```java
public class ArcusContainerTest extends ArcusContainerTestBase {

@Test
void testcase() {
//given
ArcusClient arcusClient = new ArcusClient(
new DefaultConnectionFactory(),
new ArrayList<>(Arrays.asList(new InetSocketAddress("127.0.0.1", 11211))));

//when
Boolean b = arcusClient.set("test", 10, "singleTestValue").get();

//then
assertThat(b).isTrue();
}
}
```

2. cluster

```java
public class ArcusClusterTestBase {

protected static final ArcusClusterContainer ARCUS_CLUSTER_CONTAINER;

static {
ARCUS_CLUSTER_CONTAINER = ArcusClusterContainer.create();
ARCUS_CLUSTER_CONTAINER.start();
}
}
```
```java
public class ArcusClusterContainerTest extends ArcusClusterTestBase {

@Test
void createArcusContainerSingle() {
//given
ArcusClientPool arcusClient = ArcusClient.createArcusClientPool("test", new ConnectionFactoryBuilder(), 2);

//when
OperationFuture<Boolean> set = arcusClient.set("test", 10, "testValue");

//then
assertThat(set.get()).isTrue();
}
}
```

0 comments on commit 4a9c2b0

Please sign in to comment.