From 2bde25d2d9de8922d3f2e05fb7bd1d9f693f5881 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Tue, 21 Nov 2017 13:20:54 -0800 Subject: [PATCH] testing: Remove DeadlineSubject The class is still used internally, so we move it to context's tests for it to be reused. To avoid a circular dependency with context's tests depending on core's tests, StaticTestingClassLoader was also moved to context's tests. This is driven by a need to modernize DeadlineSubject for newer versions of Truth, but the newer versions of Truth update Guava. To avoid leaking the Guava update to all users of grpc-testing, we're removing the Subject. In our internal tests we can update the Truth dependency with less issue. --- context/build.gradle | 3 +-- .../src/test/java/io/grpc/StaticTestingClassLoader.java | 4 ++-- .../src/test}/java/io/grpc/testing/DeadlineSubject.java | 3 --- core/build.gradle | 3 ++- interop-testing/build.gradle | 1 + 5 files changed, 6 insertions(+), 8 deletions(-) rename {core => context}/src/test/java/io/grpc/StaticTestingClassLoader.java (96%) rename {testing/src/main => context/src/test}/java/io/grpc/testing/DeadlineSubject.java (96%) diff --git a/context/build.gradle b/context/build.gradle index 67c5e1d327..e13dfe46bb 100644 --- a/context/build.gradle +++ b/context/build.gradle @@ -1,7 +1,6 @@ description = 'gRPC: Context' dependencies { - testCompile project(':grpc-testing') - testCompile project(':grpc-core').sourceSets.test.output + testCompile libraries.jsr305 signature "org.codehaus.mojo.signature:java16:1.1@signature" } diff --git a/core/src/test/java/io/grpc/StaticTestingClassLoader.java b/context/src/test/java/io/grpc/StaticTestingClassLoader.java similarity index 96% rename from core/src/test/java/io/grpc/StaticTestingClassLoader.java rename to context/src/test/java/io/grpc/StaticTestingClassLoader.java index b0695900c8..590a7c0da8 100644 --- a/core/src/test/java/io/grpc/StaticTestingClassLoader.java +++ b/context/src/test/java/io/grpc/StaticTestingClassLoader.java @@ -17,7 +17,7 @@ package io.grpc; import com.google.common.base.Preconditions; -import io.grpc.internal.IoUtils; +import com.google.common.io.ByteStreams; import java.io.IOException; import java.io.InputStream; import java.util.regex.Pattern; @@ -45,7 +45,7 @@ public final class StaticTestingClassLoader extends ClassLoader { } byte[] b; try { - b = IoUtils.toByteArray(is); + b = ByteStreams.toByteArray(is); } catch (IOException ex) { throw new ClassNotFoundException(name, ex); } diff --git a/testing/src/main/java/io/grpc/testing/DeadlineSubject.java b/context/src/test/java/io/grpc/testing/DeadlineSubject.java similarity index 96% rename from testing/src/main/java/io/grpc/testing/DeadlineSubject.java rename to context/src/test/java/io/grpc/testing/DeadlineSubject.java index 7ae84852ea..3d425a9dc2 100644 --- a/testing/src/main/java/io/grpc/testing/DeadlineSubject.java +++ b/context/src/test/java/io/grpc/testing/DeadlineSubject.java @@ -23,7 +23,6 @@ import com.google.common.truth.ComparableSubject; import com.google.common.truth.FailureStrategy; import com.google.common.truth.SubjectFactory; import io.grpc.Deadline; -import io.grpc.ExperimentalApi; import java.math.BigInteger; import java.util.concurrent.TimeUnit; import javax.annotation.CheckReturnValue; @@ -32,7 +31,6 @@ import javax.annotation.Nullable; /** * Propositions for {@link Deadline} subjects. */ -@ExperimentalApi("https://github.com/grpc/grpc-java/issues/3613") public final class DeadlineSubject extends ComparableSubject { private static final SubjectFactory deadlineFactory = new DeadlineSubjectFactory(); @@ -79,7 +77,6 @@ public final class DeadlineSubject extends ComparableSubject