Skip to content

Commit 7564bf9

Browse files
authored
Merge pull request #25 from GoodforGod/dev
[0.12.1]
2 parents 235e2df + 83a03ef commit 7564bf9

File tree

18 files changed

+49
-36
lines changed

18 files changed

+49
-36
lines changed

.github/workflows/publish-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI Master
1+
name: Release
22

33
on:
44
release:

.github/workflows/publish-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI Dev
1+
name: Snapshot
22

33
on:
44
push:

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Makes testing & asserts with Testcontainers even easier.
3030
Here is an example of [Kafka Extension](kafka) where KafkaContainer is started in `PER_RUN` mode with topic reset per method:
3131

3232
```java
33-
3433
@TestcontainersKafka(mode = ContainerMode.PER_RUN,
3534
topics = @Topics(value = "my-topic-name", reset = Topics.Mode.PER_METHOD))
3635
class ExampleTests {
@@ -50,7 +49,6 @@ class ExampleTests {
5049
Here is an example of [Postgres Extension](postgres) where PostgresContainer is started `PER_RUN` mode and migrations are applied per method:
5150

5251
```java
53-
5452
@TestcontainersPostgreSQL(mode = ContainerMode.PER_RUN,
5553
migration = @Migration(
5654
engine = Migration.Engines.FLYWAY,

cassandra/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ Features:
1818

1919
**Gradle**
2020
```groovy
21-
testImplementation "io.goodforgod:testcontainers-extensions-cassandra:0.12.0"
21+
testImplementation "io.goodforgod:testcontainers-extensions-cassandra:0.12.1"
2222
```
2323

2424
**Maven**
2525
```xml
2626
<dependency>
2727
<groupId>io.goodforgod</groupId>
2828
<artifactId>testcontainers-extensions-cassandra</artifactId>
29-
<version>0.12.0</version>
29+
<version>0.12.1</version>
3030
<scope>test</scope>
3131
</dependency>
3232
```

cassandra/src/main/java/io/goodforgod/testcontainers/extensions/cassandra/CassandraConnectionImpl.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.goodforgod.testcontainers.extensions.cassandra;
22

3-
import com.datastax.oss.driver.api.core.CqlIdentifier;
43
import com.datastax.oss.driver.api.core.CqlSession;
54
import com.datastax.oss.driver.api.core.CqlSessionBuilder;
65
import com.datastax.oss.driver.api.core.config.DriverConfigLoader;
@@ -176,15 +175,13 @@ private CqlSession openConnection() {
176175
.withCodecRegistry(new DefaultCodecRegistry("testing-codec-registry"))
177176
.withConfigLoader(configLoader)
178177
.withLocalDatacenter(params().datacenter())
179-
.addContactPoint(new InetSocketAddress(params().host(), params().port()));
178+
.addContactPoint(InetSocketAddress.createUnresolved(params().host(), params().port()));
180179

181180
if (params().username() != null && params().password() != null) {
182181
sessionBuilder.withAuthCredentials(params().username(), params().password());
183182
}
184183

185-
CqlSession session = sessionBuilder.build();
186-
createKeyspace(params().keyspace(), session);
187-
return session;
184+
return sessionWithKeyspace(params().keyspace(), sessionBuilder);
188185
}
189186

190187
@Override
@@ -208,13 +205,24 @@ public void createKeyspace(@NotNull String keyspaceName) {
208205
createKeyspace(keyspaceName, getConnection());
209206
}
210207

208+
private CqlSession sessionWithKeyspace(@NotNull String keyspaceName, CqlSessionBuilder sessionBuilder) {
209+
try (var session = sessionBuilder.build()) {
210+
String cql = "CREATE KEYSPACE IF NOT EXISTS " + keyspaceName
211+
+ " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};";
212+
var boundStatement = session.prepare(cql).bind().setTimeout(TIMEOUT);
213+
session.execute(boundStatement).wasApplied();
214+
return sessionBuilder.withKeyspace(keyspaceName).build();
215+
} catch (Exception e) {
216+
throw new CassandraConnectionException(e);
217+
}
218+
}
219+
211220
private void createKeyspace(@NotNull String keyspaceName, CqlSession session) {
212221
try {
213222
String cql = "CREATE KEYSPACE IF NOT EXISTS " + keyspaceName
214223
+ " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};";
215224
var boundStatement = session.prepare(cql).bind().setTimeout(TIMEOUT);
216225
session.execute(boundStatement).wasApplied();
217-
session.execute("USE " + CqlIdentifier.fromCql(keyspaceName));
218226
} catch (Exception e) {
219227
throw new CassandraConnectionException(e);
220228
}

clickhouse/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ Features:
1818

1919
**Gradle**
2020
```groovy
21-
testImplementation "io.goodforgod:testcontainers-extensions-clickhouse:0.12.0"
21+
testImplementation "io.goodforgod:testcontainers-extensions-clickhouse:0.12.1"
2222
```
2323

2424
**Maven**
2525
```xml
2626
<dependency>
2727
<groupId>io.goodforgod</groupId>
2828
<artifactId>testcontainers-extensions-clickhouse</artifactId>
29-
<version>0.12.0</version>
29+
<version>0.12.1</version>
3030
<scope>test</scope>
3131
</dependency>
3232
```
@@ -39,6 +39,7 @@ don't forget to add:
3939
**Gradle**
4040
```groovy
4141
testRuntimeOnly "com.clickhouse:clickhouse-jdbc:0.7.0"
42+
testRuntimeOnly "com.clickhouse:clickhouse-http-client:0.7.0"
4243
```
4344

4445
**Maven**
@@ -49,6 +50,12 @@ testRuntimeOnly "com.clickhouse:clickhouse-jdbc:0.7.0"
4950
<version>0.7.0</version>
5051
<scope>test</scope>
5152
</dependency>
53+
<dependency>
54+
<groupId>com.clickhouse</groupId>
55+
<artifactId>:clickhouse-http-client</artifactId>
56+
<version>0.7.0</version>
57+
<scope>test</scope>
58+
</dependency>
5259
```
5360

5461
## Content
@@ -277,7 +284,7 @@ or use combination of `EXTERNAL_TEST_CLICKHOUSE_HOST` & `EXTERNAL_TEST_CLICKHOUS
277284
Annotation parameters:
278285
- `engine` - to use for migration.
279286
- `apply` - parameter configures migration mode.
280-
- `drop` - configures when to reset/drop/clear database.
287+
- `drop` - configures when to reset/drop/clear database. (Liquibase doesn't support `dropAll` command, so database is cleaned with `TRUNCATE DATABASE`)
281288
- `locations` - configures locations where migrations are placed.
282289

283290
Available migration engines:

clickhouse/src/main/java/io/goodforgod/testcontainers/extensions/jdbc/TestcontainersClickhouse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@Documented
1818
@Target({ ElementType.TYPE })
1919
@Retention(RetentionPolicy.RUNTIME)
20-
@interface TestcontainersClickhouse {
20+
public @interface TestcontainersClickhouse {
2121

2222
/**
2323
* @return Clickhouse image

cockroachdb/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ Features:
1818

1919
**Gradle**
2020
```groovy
21-
testImplementation "io.goodforgod:testcontainers-extensions-cockroachdb:0.12.0"
21+
testImplementation "io.goodforgod:testcontainers-extensions-cockroachdb:0.12.1"
2222
```
2323

2424
**Maven**
2525
```xml
2626
<dependency>
2727
<groupId>io.goodforgod</groupId>
2828
<artifactId>testcontainers-extensions-cockroachdb</artifactId>
29-
<version>0.12.0</version>
29+
<version>0.12.1</version>
3030
<scope>test</scope>
3131
</dependency>
3232
```

cockroachdb/src/main/java/io/goodforgod/testcontainers/extensions/jdbc/TestcontainersCockroach.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@Documented
1818
@Target({ ElementType.TYPE })
1919
@Retention(RetentionPolicy.RUNTIME)
20-
@interface TestcontainersCockroach {
20+
public @interface TestcontainersCockroach {
2121

2222
/**
2323
* @return Cockroachdb image

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
groupId=io.goodforgod
22
artifactRootId=testcontainers-extensions
3-
artifactVersion=0.12.0-SNAPSHOT
3+
artifactVersion=0.12.1-SNAPSHOT
44

55

66
##### GRADLE #####

0 commit comments

Comments
 (0)