-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Expand Container dependsOn
parameters to accept Iterable
#2259
Changes from 3 commits
de987ac
fc2e321
c50ee50
ce2cc98
822f106
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,9 +26,6 @@ | |
import lombok.NonNull; | ||
import lombok.Setter; | ||
import lombok.SneakyThrows; | ||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; | ||
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; | ||
import org.apache.commons.compress.utils.IOUtils; | ||
import org.apache.commons.io.FileUtils; | ||
import org.apache.commons.lang.StringUtils; | ||
import org.jetbrains.annotations.NotNull; | ||
|
@@ -42,7 +39,6 @@ | |
import org.slf4j.Logger; | ||
import org.testcontainers.DockerClientFactory; | ||
import org.testcontainers.UnstableAPI; | ||
import org.testcontainers.images.ImagePullPolicy; | ||
import org.testcontainers.containers.output.OutputFrame; | ||
import org.testcontainers.containers.startupcheck.IsRunningStartupCheckStrategy; | ||
import org.testcontainers.containers.startupcheck.MinimumDurationRunningStartupCheckStrategy; | ||
|
@@ -51,8 +47,8 @@ | |
import org.testcontainers.containers.wait.Wait; | ||
import org.testcontainers.containers.wait.WaitStrategy; | ||
import org.testcontainers.containers.wait.strategy.WaitStrategyTarget; | ||
import org.testcontainers.images.ImagePullPolicy; | ||
import org.testcontainers.images.RemoteDockerImage; | ||
import org.testcontainers.images.builder.Transferable; | ||
import org.testcontainers.lifecycle.Startable; | ||
import org.testcontainers.lifecycle.Startables; | ||
import org.testcontainers.lifecycle.TestDescription; | ||
|
@@ -64,14 +60,9 @@ | |
import org.testcontainers.utility.PathUtils; | ||
import org.testcontainers.utility.ResourceReaper; | ||
import org.testcontainers.utility.TestcontainersConfiguration; | ||
import org.testcontainers.utility.ThrowingFunction; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
import java.lang.reflect.UndeclaredThrowableException; | ||
|
@@ -82,7 +73,6 @@ | |
import java.time.Instant; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
|
@@ -266,22 +256,29 @@ public void setImage(Future<String> image) { | |
} | ||
|
||
/** | ||
* @see #dependsOn(List) | ||
* @see #dependsOn(Iterable) | ||
*/ | ||
public SELF dependsOn(Startable... startables) { | ||
Collections.addAll(dependencies, startables); | ||
return self(); | ||
} | ||
|
||
/** | ||
* @see #dependsOn(Iterable) | ||
*/ | ||
public SELF dependsOn(List<? extends Startable> startables) { | ||
return this.dependsOn((Iterable<? extends Startable>) startables); | ||
} | ||
|
||
/** | ||
* Delays this container's creation and start until provided {@link Startable}s start first. | ||
* Note that the circular dependencies are not supported. | ||
* | ||
* @param startables a list of {@link Startable} to depend on | ||
* @see Startables#deepStart(Collection) | ||
* @see Startables#deepStart(Iterable) | ||
*/ | ||
public SELF dependsOn(List<Startable> startables) { | ||
dependencies.addAll(startables); | ||
public SELF dependsOn(Iterable<? extends Startable> startables) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will break binary compatibility There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pushing a commit now to reinstate |
||
startables.forEach(dependencies::add); | ||
return self(); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,15 @@ | |
|
||
import lombok.experimental.UtilityClass; | ||
|
||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.concurrent.*; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ThreadFactory; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
import java.util.stream.Stream; | ||
import java.util.stream.StreamSupport; | ||
|
||
@UtilityClass | ||
public class Startables { | ||
|
@@ -27,8 +30,8 @@ public Thread newThread(Runnable r) { | |
/** | ||
* @see #deepStart(Stream) | ||
*/ | ||
public CompletableFuture<Void> deepStart(Collection<? extends Startable> startables) { | ||
return deepStart(startables.stream()); | ||
public CompletableFuture<Void> deepStart(Iterable<? extends Startable> startables) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops, japicmp has flagged this! Just as we did in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reinstated. |
||
return deepStart(StreamSupport.stream(startables.spliterator(), false)); | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that there seem to be a lot of import movements. I'm not sure why this is suddenly happening, but I'm confident that the
.editorconfig
rules we have set up are being respected:Maybe recent edits to these files have not been picking up the rules?