From 90a3e117a55b2d666c127042b5f6be64c3bed806 Mon Sep 17 00:00:00 2001 From: Quincy Bowers Date: Thu, 28 May 2020 09:03:07 -0600 Subject: [PATCH 1/2] Exclude id from NetworkImpl.NetworkImplBuilder (testcontainers#8125) --- .../java/org/testcontainers/containers/Network.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/testcontainers/containers/Network.java b/core/src/main/java/org/testcontainers/containers/Network.java index 1c00fa00fac..d406ac294c2 100644 --- a/core/src/main/java/org/testcontainers/containers/Network.java +++ b/core/src/main/java/org/testcontainers/containers/Network.java @@ -19,7 +19,7 @@ public interface Network extends AutoCloseable, TestRule { - Network SHARED = new NetworkImpl(false, null, Collections.emptySet(), null) { + Network SHARED = new NetworkImpl(false, null, Collections.emptySet()) { @Override public void close() { // Do not allow users to close SHARED network, only ResourceReaper is allowed to close (destroy) it @@ -39,10 +39,16 @@ static NetworkImpl.NetworkImplBuilder builder() { return NetworkImpl.builder(); } - @Builder @Getter class NetworkImpl extends ExternalResource implements Network { + @Builder + private NetworkImpl(Boolean enableIpv6, String driver, @Singular Set> createNetworkCmdModifiers) { + this.enableIpv6 = enableIpv6; + this.driver = driver; + this.createNetworkCmdModifiers = createNetworkCmdModifiers; + } + private final String name = UUID.randomUUID().toString(); private Boolean enableIpv6; From 0c4dcfb150c680d3cbb8a48002ccc529c764bff6 Mon Sep 17 00:00:00 2001 From: Quincy Bowers Date: Mon, 1 Jun 2020 06:51:43 -0600 Subject: [PATCH 2/2] Deprecate Network.id field The field is deprecated in order to mark the NetworkBuildImpl#id method deprecated so that the method can later be removed. We'll undeprecate the field at that time. --- .../java/org/testcontainers/containers/Network.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/testcontainers/containers/Network.java b/core/src/main/java/org/testcontainers/containers/Network.java index d406ac294c2..2fda5ad1a8d 100644 --- a/core/src/main/java/org/testcontainers/containers/Network.java +++ b/core/src/main/java/org/testcontainers/containers/Network.java @@ -19,7 +19,7 @@ public interface Network extends AutoCloseable, TestRule { - Network SHARED = new NetworkImpl(false, null, Collections.emptySet()) { + Network SHARED = new NetworkImpl(false, null, Collections.emptySet(), null) { @Override public void close() { // Do not allow users to close SHARED network, only ResourceReaper is allowed to close (destroy) it @@ -39,16 +39,10 @@ static NetworkImpl.NetworkImplBuilder builder() { return NetworkImpl.builder(); } + @Builder @Getter class NetworkImpl extends ExternalResource implements Network { - @Builder - private NetworkImpl(Boolean enableIpv6, String driver, @Singular Set> createNetworkCmdModifiers) { - this.enableIpv6 = enableIpv6; - this.driver = driver; - this.createNetworkCmdModifiers = createNetworkCmdModifiers; - } - private final String name = UUID.randomUUID().toString(); private Boolean enableIpv6; @@ -58,6 +52,7 @@ private NetworkImpl(Boolean enableIpv6, String driver, @Singular Set> createNetworkCmdModifiers; + @Deprecated private String id; private final AtomicBoolean initialized = new AtomicBoolean();