Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,33 @@ tasks.japicmp {

classExcludes = [
"org.testcontainers.utility.RyukResourceReaper",
"org.testcontainers.containers.FailureDetectingExternalResource",
"org.testcontainers.containers.ComposeContainer",
"org.testcontainers.containers.DockerComposeContainer",
"org.testcontainers.containers.GenericContainer"
]

methodExcludes = [
"org.testcontainers.containers.Container#getDockerClient()",
"org.testcontainers.containers.ContainerState#getDockerClient()",
"org.testcontainers.containers.ContainerState#execInContainer(org.testcontainers.containers.ExecConfig)",
"org.testcontainers.containers.ContainerState#execInContainer(java.nio.charset.Charset,org.testcontainers.containers.ExecConfig)"
"org.testcontainers.containers.ContainerState#execInContainer(java.nio.charset.Charset,org.testcontainers.containers.ExecConfig)",
"org.testcontainers.containers.ComposeContainer#apply(org.junit.runners.model.Statement, org.junit.runner.Description)",
"org.testcontainers.containers.ComposeContainer#failed(java.lang.Throwable, org.junit.runner.Description)",
"org.testcontainers.containers.ComposeContainer#finished(org.junit.runner.Description)",
"org.testcontainers.containers.ComposeContainer#starting(org.junit.runner.Description)",
"org.testcontainers.containers.ComposeContainer#succeeded(org.junit.runner.Description)",
"org.testcontainers.containers.DockerComposeContainer#apply(org.junit.runners.model.Statement, org.junit.runner.Description)",
"org.testcontainers.containers.DockerComposeContainer#failed(java.lang.Throwable, org.junit.runner.Description)",
"org.testcontainers.containers.DockerComposeContainer#finished(org.junit.runner.Description)",
"org.testcontainers.containers.DockerComposeContainer#starting(org.junit.runner.Description)",
"org.testcontainers.containers.DockerComposeContainer#succeeded(org.junit.runner.Description)",
"org.testcontainers.containers.GenericContainer#apply(org.junit.runners.model.Statement, org.junit.runner.Description)",
"org.testcontainers.containers.GenericContainer#failed(java.lang.Throwable, org.junit.runner.Description)",
"org.testcontainers.containers.GenericContainer#finished(org.junit.runner.Description)",
"org.testcontainers.containers.GenericContainer#starting(org.junit.runner.Description)",
"org.testcontainers.containers.GenericContainer#succeeded(org.junit.runner.Description)",
'org.testcontainers.containers.Network$NetworkImpl#after()'
]

fieldExcludes = []
Expand All @@ -69,7 +89,6 @@ configurations.all {
}

dependencies {
api 'junit:junit:4.13.2'
api 'org.slf4j:slf4j-api:1.7.36'
compileOnly 'org.jetbrains:annotations:26.0.2-1'
testCompileOnly 'org.jetbrains:annotations:26.0.2-1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.SystemUtils;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.testcontainers.containers.output.OutputFrame;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitStrategy;
Expand All @@ -31,7 +29,7 @@
* It uses either Compose V2 contained within the Docker binary, or a containerised version of Compose V2.
*/
@Slf4j
public class ComposeContainer extends FailureDetectingExternalResource implements Startable {
public class ComposeContainer implements Startable {

private final Map<String, Integer> scalingPreferences = new HashMap<>();

Expand Down Expand Up @@ -93,32 +91,6 @@ public ComposeContainer(String identifier, List<File> composeFiles) {
this.project = this.composeDelegate.getProject();
}

@Override
@Deprecated
public Statement apply(Statement base, Description description) {
return super.apply(base, description);
}

@Override
@Deprecated
public void starting(Description description) {
start();
}

@Override
@Deprecated
protected void succeeded(Description description) {}

@Override
@Deprecated
protected void failed(Throwable e, Description description) {}

@Override
@Deprecated
public void finished(Description description) {
stop();
}

@Override
public void start() {
synchronized (MUTEX) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.SystemUtils;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.testcontainers.containers.output.OutputFrame;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitStrategy;
Expand All @@ -30,9 +28,7 @@
* Container which launches Docker Compose, for the purposes of launching a defined set of containers.
*/
@Slf4j
public class DockerComposeContainer<SELF extends DockerComposeContainer<SELF>>
extends FailureDetectingExternalResource
implements Startable {
public class DockerComposeContainer<SELF extends DockerComposeContainer<SELF>> implements Startable {

private final Map<String, Integer> scalingPreferences = new HashMap<>();

Expand Down Expand Up @@ -99,32 +95,6 @@ public DockerComposeContainer(String identifier, List<File> composeFiles) {
this.project = this.composeDelegate.getProject();
}

@Override
@Deprecated
public Statement apply(Statement base, Description description) {
return super.apply(base, description);
}

@Override
@Deprecated
public void starting(Description description) {
start();
}

@Override
@Deprecated
protected void succeeded(Description description) {}

@Override
@Deprecated
protected void failed(Throwable e, Description description) {}

@Override
@Deprecated
public void finished(Description description) {
stop();
}

@Override
public void start() {
synchronized (MUTEX) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import org.apache.commons.lang3.SystemUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.rnorth.ducttape.unreliables.Unreliables;
import org.slf4j.Logger;
import org.testcontainers.DockerClientFactory;
Expand All @@ -52,8 +50,6 @@
import org.testcontainers.images.builder.Transferable;
import org.testcontainers.lifecycle.Startable;
import org.testcontainers.lifecycle.Startables;
import org.testcontainers.lifecycle.TestDescription;
import org.testcontainers.lifecycle.TestLifecycleAware;
import org.testcontainers.utility.Base58;
import org.testcontainers.utility.CommandLine;
import org.testcontainers.utility.DockerImageName;
Expand Down Expand Up @@ -106,7 +102,6 @@
*/
@Data
public class GenericContainer<SELF extends GenericContainer<SELF>>
extends FailureDetectingExternalResource
implements Container<SELF>, AutoCloseable, WaitStrategyTarget, Startable {

public static final int CONTAINER_RUNNING_TIMEOUT_SEC = 30;
Expand Down Expand Up @@ -1053,57 +1048,6 @@ public void addExposedPorts(int... ports) {
this.containerDef.addExposedTcpPorts(ports);
}

private TestDescription toDescription(Description description) {
return new TestDescription() {
@Override
public String getTestId() {
return description.getDisplayName();
}

@Override
public String getFilesystemFriendlyName() {
return description.getClassName() + "-" + description.getMethodName();
}
};
}

@Override
@Deprecated
public Statement apply(Statement base, Description description) {
return super.apply(base, description);
}

@Override
@Deprecated
protected void starting(Description description) {
if (this instanceof TestLifecycleAware) {
((TestLifecycleAware) this).beforeTest(toDescription(description));
}
this.start();
}

@Override
@Deprecated
protected void succeeded(Description description) {
if (this instanceof TestLifecycleAware) {
((TestLifecycleAware) this).afterTest(toDescription(description), Optional.empty());
}
}

@Override
@Deprecated
protected void failed(Throwable e, Description description) {
if (this instanceof TestLifecycleAware) {
((TestLifecycleAware) this).afterTest(toDescription(description), Optional.of(e));
}
}

@Override
@Deprecated
protected void finished(Description description) {
this.stop();
}

/**
* {@inheritDoc}
*/
Expand Down
11 changes: 2 additions & 9 deletions core/src/main/java/org/testcontainers/containers/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import lombok.Builder;
import lombok.Getter;
import lombok.Singular;
import org.junit.rules.ExternalResource;
import org.junit.rules.TestRule;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.utility.ResourceReaper;

Expand All @@ -17,7 +15,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;

public interface Network extends AutoCloseable, TestRule {
public interface Network extends AutoCloseable {
Network SHARED = new NetworkImpl(false, null, Collections.emptySet(), null) {
@Override
public void close() {
Expand All @@ -40,7 +38,7 @@ static NetworkImpl.NetworkImplBuilder builder() {

@Builder
@Getter
class NetworkImpl extends ExternalResource implements Network {
class NetworkImpl implements Network {

private final String name = UUID.randomUUID().toString();

Expand Down Expand Up @@ -100,11 +98,6 @@ private String create() {
return createNetworkCmd.exec().getId();
}

@Override
protected void after() {
close();
}

@Override
public synchronized void close() {
if (initialized.getAndSet(false)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.TestImages;
import org.testcontainers.Testcontainers;
Expand Down Expand Up @@ -189,11 +187,6 @@ public String getId() {

@Override
public void close() {}

@Override
public Statement apply(Statement base, Description description) {
return null;
}
};

List<com.github.dockerjava.api.model.Network> networks = DockerClientFactory
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.testcontainers.junit;

import org.junit.jupiter.api.Test;
import org.junit.runner.Description;
import org.testcontainers.containers.DockerComposeContainer;
import org.testcontainers.containers.output.OutputFrame.OutputType;
import org.testcontainers.containers.output.WaitingConsumer;
Expand All @@ -22,7 +21,7 @@ void testLogConsumer() throws TimeoutException {
.withLogConsumer("redis_1", logConsumer);

try {
environment.starting(Description.EMPTY);
environment.start();
logConsumer.waitUntil(
frame -> {
return (
Expand All @@ -34,7 +33,7 @@ void testLogConsumer() throws TimeoutException {
TimeUnit.SECONDS
);
} finally {
environment.finished(Description.EMPTY);
environment.stop();
}
}
}
Loading
Loading