Skip to content

Clean up deprecated methods #2835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 5, 2020
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
44 changes: 36 additions & 8 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,43 @@ task japicmp(type: me.champeau.gradle.japicmp.JapicmpTask) {
"org.testcontainers.shaded.*",
]

// TODO remove once 1.15.0 is released
classExcludes = [
"org.testcontainers.containers.AmbassadorContainer",
"org.testcontainers.containers.traits.VncService",
"org.testcontainers.containers.wait.HostPortWaitStrategy",
"org.testcontainers.containers.wait.HttpWaitStrategy",
"org.testcontainers.containers.wait.LogMessageWaitStrategy",
"org.testcontainers.containers.wait.Wait",
"org.testcontainers.containers.wait.WaitAllStrategy",
"org.testcontainers.containers.wait.WaitStrategy",
"org.testcontainers.dockerclient.AuditLoggingDockerClient",
"org.testcontainers.dockerclient.auth.AuthDelegatingDockerClientConfig",
"org.testcontainers.containers.GenericContainer\$AbstractWaitStrategy",
"org.testcontainers.dockerclient.transport.okhttp.NamedPipeSocketFactory",
"org.testcontainers.dockerclient.transport.okhttp.OkHttpDockerCmdExecFactory",
"org.testcontainers.dockerclient.transport.okhttp.UnixSocketFactory",
]

methodExcludes = [
// METHOD_NEW_DEFAULT
"org.testcontainers.containers.ContainerState#getHost()"
"org.testcontainers.dockerclient.DockerClientConfigUtils#getDetectedDockerHostIp()",
"org.testcontainers.dockerclient.DockerClientConfigUtils#getDockerHostIpAddress(com.github.dockerjava.core.DockerClientConfig)",

"org.testcontainers.utility.ResourceReaper#start(java.lang.String, com.github.dockerjava.api.DockerClient, boolean)",

"org.testcontainers.containers.Container#fetchDockerDaemonInfo()",
"org.testcontainers.containers.Container#getDockerDaemonInfo()",

"org.testcontainers.containers.GenericContainer#fetchDockerDaemonInfo()",
"org.testcontainers.containers.GenericContainer#getDockerDaemonInfo()",

"org.testcontainers.containers.Container\$ExecResult#Container\$ExecResult(java.lang.String, java.lang.String)",
]

fieldExcludes = [
"org.testcontainers.containers.GenericContainer#containerId",
"org.testcontainers.containers.GenericContainer#containerName",
"org.testcontainers.containers.GenericContainer#dockerDaemonInfo",
]

onlyBinaryIncompatibleModified = true
Expand Down Expand Up @@ -127,10 +161,6 @@ dependencies {

compile "net.java.dev.jna:jna-platform:5.5.0"

shaded ('org.scala-sbt.ipcsocket:ipcsocket:1.0.1') {
exclude(group: "net.java.dev.jna")
}

shaded ('com.github.docker-java:docker-java-transport-okhttp:3.2.1') {
exclude(group: 'net.java.dev.jna')
exclude(group: 'com.google.code.findbug')
Expand All @@ -140,8 +170,6 @@ dependencies {

shaded "org.yaml:snakeyaml:1.25"

shaded 'com.squareup.okhttp3:okhttp:3.14.8'

shaded 'org.glassfish.main.external:trilead-ssh2-repackaged:4.1.2'

shaded 'org.zeroturnaround:zt-exec:1.10', {
Expand Down

This file was deleted.

28 changes: 0 additions & 28 deletions core/src/main/java/org/testcontainers/containers/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.model.Bind;
import com.github.dockerjava.api.model.Info;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NonNull;
Expand All @@ -13,14 +12,9 @@
import org.testcontainers.containers.startupcheck.StartupCheckStrategy;
import org.testcontainers.containers.traits.LinkableContainer;
import org.testcontainers.containers.wait.strategy.WaitStrategy;
import org.testcontainers.images.builder.Transferable;
import org.testcontainers.utility.LogUtils;
import org.testcontainers.utility.MountableFile;
import org.testcontainers.utility.ThrowingFunction;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.time.Duration;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -48,14 +42,6 @@ class ExecResult {
int exitCode;
String stdout;
String stderr;

/**
* @deprecated should not be instantiated outside of the library, please migrate
*/
@Deprecated
public ExecResult(String stdout, String stderr) {
this(-1, stdout, stderr);
}
}

/**
Expand Down Expand Up @@ -413,13 +399,6 @@ default void followOutput(Consumer<OutputFrame> consumer, OutputFrame.OutputType
*/
SELF withLogConsumer(Consumer<OutputFrame> consumer);

/**
*
* @deprecated please use {@code org.testcontainers.DockerClientFactory.instance().client().infoCmd().exec()}
*/
@Deprecated
Info fetchDockerDaemonInfo() throws IOException;

List<String> getPortBindings();

List<String> getExtraHosts();
Expand Down Expand Up @@ -447,13 +426,6 @@ default void followOutput(Consumer<OutputFrame> consumer, OutputFrame.OutputType

DockerClient getDockerClient();

/**
*
* @deprecated please use {@code org.testcontainers.DockerClientFactory.instance().client().infoCmd().exec()}
*/
@Deprecated
Info getDockerDaemonInfo();

void setExposedPorts(List<Integer> exposedPorts);

void setPortBindings(List<String> portBindings);
Expand Down
110 changes: 7 additions & 103 deletions core/src/main/java/org/testcontainers/containers/GenericContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
import org.testcontainers.containers.startupcheck.MinimumDurationRunningStartupCheckStrategy;
import org.testcontainers.containers.startupcheck.StartupCheckStrategy;
import org.testcontainers.containers.traits.LinkableContainer;
import org.testcontainers.containers.wait.Wait;
import org.testcontainers.containers.wait.WaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitStrategy;
import org.testcontainers.containers.wait.strategy.WaitStrategyTarget;
import org.testcontainers.images.ImagePullPolicy;
import org.testcontainers.images.RemoteDockerImage;
Expand Down Expand Up @@ -190,30 +190,13 @@ public class GenericContainer<SELF extends GenericContainer<SELF>>
@Setter(AccessLevel.NONE)
protected DockerClient dockerClient = DockerClientFactory.lazyClient();

/*
* Info about the Docker server; lazily fetched.
*/
@Setter(AccessLevel.NONE)
protected Info dockerDaemonInfo = null;

/**
* Set during container startup
* // TODO make it private
*
* @deprecated use {@link ContainerState#getContainerId()}
*/
@Setter(AccessLevel.NONE)
@Deprecated
protected String containerId;

/**
* Set during container startup
*
* @deprecated use {@link GenericContainer#getContainerInfo()}
*/
@Setter(AccessLevel.NONE)
@Deprecated
protected String containerName;
@VisibleForTesting
String containerId;

@Setter(AccessLevel.NONE)
private InspectContainerResponse containerInfo;
Expand Down Expand Up @@ -426,7 +409,6 @@ private void tryStart(Instant startedAt) {

// Tell subclasses that we're starting
containerInfo = dockerClient.inspectContainerCmd(containerId).exec();
containerName = containerInfo.getName();
containerIsStarting(containerInfo, reused);

// Wait until the container has reached the desired running state
Expand Down Expand Up @@ -1322,18 +1304,6 @@ public SELF withLogConsumer(Consumer<OutputFrame> consumer) {
return self();
}

/**
* {@inheritDoc}
*/
@Override
public synchronized Info fetchDockerDaemonInfo() throws IOException {

if (this.dockerDaemonInfo == null) {
this.dockerDaemonInfo = this.dockerClient.infoCmd().exec();
}
return this.dockerDaemonInfo;
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -1403,74 +1373,8 @@ public int hashCode() {
return System.identityHashCode(this);
}

/**
* Convenience class with access to non-public members of GenericContainer.
*
* @deprecated use {@link org.testcontainers.containers.wait.strategy.AbstractWaitStrategy}
*/
@Deprecated
public static abstract class AbstractWaitStrategy extends org.testcontainers.containers.wait.strategy.AbstractWaitStrategy implements WaitStrategy {
protected GenericContainer container;

@NonNull
protected Duration startupTimeout = Duration.ofSeconds(60);

/**
* Wait until the container has started.
*
* @param container the container for which to wait
*/
@Override
public void waitUntilReady(GenericContainer container) {
this.container = container;
waitUntilReady();
}

/**
* Wait until {@link #container} has started.
*/
protected abstract void waitUntilReady();

/**
* Set the duration of waiting time until container treated as started.
*
* @param startupTimeout timeout
* @return this
* @see WaitStrategy#waitUntilReady(GenericContainer)
*/
public WaitStrategy withStartupTimeout(Duration startupTimeout) {
this.startupTimeout = startupTimeout;
return this;
}

/**
* @return the container's logger
*/
protected Logger logger() {
return container.logger();
}

/**
* @return the port on which to check if the container is ready
* @deprecated see {@link AbstractWaitStrategy#getLivenessCheckPorts()}
*/
@Deprecated
protected Integer getLivenessCheckPort() {
return container.getLivenessCheckPort();
}

/**
* @return the ports on which to check if the container is ready
*/
protected Set<Integer> getLivenessCheckPorts() {
return container.getLivenessCheckPorts();
}

/**
* @return the rate limiter to use
*/
protected RateLimiter getRateLimiter() {
return DOCKER_CLIENT_RATE_LIMITER;
}
@Override
public String getContainerName() {
return getContainerInfo().getName();
}
}

This file was deleted.

Loading