Skip to content

Commit

Permalink
[0.6.2-SNAPSHOT]
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
GoodforGod committed Sep 1, 2023
1 parent b74de72 commit e7be9d6
Show file tree
Hide file tree
Showing 73 changed files with 285 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import java.util.List;
import java.util.Optional;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NotNull;
import org.testcontainers.containers.CassandraContainer;

import java.util.List;
import java.util.Optional;

/**
* Describes active Cassandra connection of currently running {@link CassandraContainer}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.internal.core.config.typesafe.DefaultProgrammaticDriverConfigLoaderBuilder;
import com.datastax.oss.driver.internal.core.type.codec.registry.DefaultCodecRegistry;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.*;
import java.util.stream.Collectors;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.ApiStatus.Internal;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Assertions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.*;
import java.util.stream.Collectors;

@Internal
final class CassandraConnectionImpl implements CassandraConnection {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package io.goodforgod.testcontainers.extensions.cassandra;

import java.lang.annotation.*;
import org.testcontainers.containers.CassandraContainer;

import java.lang.annotation.*;

/**
* Indicates that annotated field containers {@link CassandraContainer} instance
* that should be used by {@link TestcontainersCassandra} rather than creating default container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import io.goodforgod.testcontainers.extensions.ContainerMode;
import io.goodforgod.testcontainers.extensions.Network;
import java.lang.annotation.*;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testcontainers.containers.CassandraContainer;

import java.lang.annotation.*;

/**
* Extension that is running {@link CassandraContainer} for tests in different modes with database
* schema migration support between test executions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
package io.goodforgod.testcontainers.extensions.cassandra;

import io.goodforgod.testcontainers.extensions.AbstractTestcontainersExtension;
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.nio.file.Files;
import java.time.Duration;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.jetbrains.annotations.ApiStatus.Internal;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.extension.ExtensionContext;
Expand All @@ -20,6 +11,16 @@
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.nio.file.Files;
import java.time.Duration;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@Internal
class TestcontainersCassandraExtension extends
AbstractTestcontainersExtension<CassandraConnection, CassandraContainer<?>, CassandraMetadata> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.goodforgod.testcontainers.extensions.cassandra;

import static org.junit.jupiter.api.Assertions.*;

import io.goodforgod.testcontainers.extensions.ContainerMode;
import org.junit.jupiter.api.Test;
import org.opentest4j.AssertionFailedError;

import static org.junit.jupiter.api.Assertions.*;

@TestcontainersCassandra(mode = ContainerMode.PER_CLASS,
image = "cassandra:4.1",
migration = @Migration(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package io.goodforgod.testcontainers.extensions.cassandra;

import static org.junit.jupiter.api.Assertions.assertEquals;

import io.goodforgod.testcontainers.extensions.ContainerMode;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import static org.junit.jupiter.api.Assertions.assertEquals;

@TestcontainersCassandra(mode = ContainerMode.PER_CLASS,
image = "cassandra:4.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package io.goodforgod.testcontainers.extensions.cassandra;

import static org.junit.jupiter.api.Assertions.assertTrue;

import io.goodforgod.testcontainers.extensions.ContainerMode;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import static org.junit.jupiter.api.Assertions.assertTrue;

@TestcontainersCassandra(mode = ContainerMode.PER_CLASS,
image = "cassandra:4.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package io.goodforgod.testcontainers.extensions.jdbc;

import java.lang.annotation.*;
import org.testcontainers.containers.CockroachContainer;

import java.lang.annotation.*;

/**
* Indicates that annotated field containers {@link CockroachContainer} instance
* that should be used by {@link TestcontainersCockroachdb} rather than creating default container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import io.goodforgod.testcontainers.extensions.ContainerMode;
import io.goodforgod.testcontainers.extensions.Network;
import java.lang.annotation.*;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testcontainers.containers.CockroachContainer;

import java.lang.annotation.*;

/**
* Extension that is running {@link CockroachContainer} for tests in different modes with database
* schema migration support between test executions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package io.goodforgod.testcontainers.extensions.jdbc;

import java.lang.annotation.Annotation;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.slf4j.LoggerFactory;
Expand All @@ -13,6 +8,12 @@
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.utility.DockerImageName;

import java.lang.annotation.Annotation;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

final class TestcontainersCockroachdbExtension extends
AbstractTestcontainersJdbcExtension<CockroachContainer, CockroachMetadata> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package io.goodforgod.testcontainers.extensions.jdbc;

import static org.junit.jupiter.api.Assertions.assertTrue;

import io.goodforgod.testcontainers.extensions.ContainerMode;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import static org.junit.jupiter.api.Assertions.assertTrue;

@TestcontainersCockroachdb(mode = ContainerMode.PER_CLASS,
image = "cockroachdb/cockroach:latest-v23.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package io.goodforgod.testcontainers.extensions.jdbc;

import static org.junit.jupiter.api.Assertions.assertTrue;

import io.goodforgod.testcontainers.extensions.ContainerMode;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import static org.junit.jupiter.api.Assertions.assertTrue;

@TestcontainersCockroachdb(mode = ContainerMode.PER_CLASS,
image = "cockroachdb/cockroach:latest-v23.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package io.goodforgod.testcontainers.extensions;

import java.util.Optional;
import org.jetbrains.annotations.ApiStatus.Internal;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Optional;

@Internal
public abstract class AbstractContainerMetadata implements ContainerMetadata {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.assertTrue;

import io.goodforgod.testcontainers.extensions.example.*;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.output.Slf4jLogConsumer;

import static org.junit.jupiter.api.Assertions.assertTrue;

@TestcontainersRedis(mode = ContainerMode.PER_METHOD)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class ContainerFromAnnotationTests {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.*;

import io.goodforgod.testcontainers.extensions.example.ContainerRedisConnection;
import io.goodforgod.testcontainers.extensions.example.RedisConnection;
import io.goodforgod.testcontainers.extensions.example.TestcontainersRedis;
Expand All @@ -10,6 +8,8 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import static org.junit.jupiter.api.Assertions.*;

@TestcontainersRedis(mode = ContainerMode.PER_CLASS, image = "redis:7.2-alpine")
abstract class ContainerPerClassAbstractTests {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.*;

import io.goodforgod.testcontainers.extensions.example.ContainerRedisConnection;
import io.goodforgod.testcontainers.extensions.example.RedisConnection;
import io.goodforgod.testcontainers.extensions.example.TestcontainersRedis;
import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.*;

@TestcontainersRedis(mode = ContainerMode.PER_CLASS,
image = "redis:7.2-alpine",
network = @Network(shared = false, alias = "my_alias"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.*;

import io.goodforgod.testcontainers.extensions.example.ContainerRedisConnection;
import io.goodforgod.testcontainers.extensions.example.RedisConnection;
import io.goodforgod.testcontainers.extensions.example.TestcontainersRedis;
import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.*;

@TestcontainersRedis(mode = ContainerMode.PER_CLASS,
image = "${MY_IMAGE_ENV}",
network = @Network(shared = false, alias = "${MY_ALIAS_ENV}"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.*;

import io.goodforgod.testcontainers.extensions.example.ContainerRedisConnection;
import io.goodforgod.testcontainers.extensions.example.RedisConnection;
import io.goodforgod.testcontainers.extensions.example.TestcontainersRedis;
import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.*;

@TestcontainersRedis(mode = ContainerMode.PER_CLASS,
image = "${MY_IMAGE_ENV_EMPTY|redis:7.2-alpine}",
network = @Network(shared = false, alias = "${MY_ALIAS_ENV_EMPTY|my_default_alias}"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.*;

import io.goodforgod.testcontainers.extensions.example.ContainerRedisConnection;
import io.goodforgod.testcontainers.extensions.example.RedisConnection;
import io.goodforgod.testcontainers.extensions.example.TestcontainersRedis;
import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.*;

@TestcontainersRedis(mode = ContainerMode.PER_METHOD, image = "redis:7.2-alpine")
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.*;

import io.goodforgod.testcontainers.extensions.example.ContainerRedisConnection;
import io.goodforgod.testcontainers.extensions.example.RedisConnection;
import io.goodforgod.testcontainers.extensions.example.TestcontainersRedis;
import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.*;

@TestcontainersRedis(mode = ContainerMode.PER_METHOD, image = "redis:7.2-alpine")
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.*;

import io.goodforgod.testcontainers.extensions.example.ContainerRedisConnection;
import io.goodforgod.testcontainers.extensions.example.RedisConnection;
import io.goodforgod.testcontainers.extensions.example.TestcontainersRedis;
import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.*;

@TestcontainersRedis(mode = ContainerMode.PER_METHOD, image = "redis:7.2-alpine")
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.goodforgod.testcontainers.extensions;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import io.goodforgod.testcontainers.extensions.example.ContainerRedisConnection;
import io.goodforgod.testcontainers.extensions.example.RedisConnection;
import io.goodforgod.testcontainers.extensions.example.TestcontainersRedis;
Expand All @@ -11,6 +8,9 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@TestcontainersRedis(mode = ContainerMode.PER_RUN, image = "redis:7.2-alpine")
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class ContainerPerRunFirstTests {
Expand Down
Loading

0 comments on commit e7be9d6

Please sign in to comment.