mirror of https://github.com/grpc/grpc-java.git
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.
This commit is contained in:
parent
6c6538648b
commit
2bde25d2d9
|
|
@ -1,7 +1,6 @@
|
||||||
description = 'gRPC: Context'
|
description = 'gRPC: Context'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testCompile project(':grpc-testing')
|
testCompile libraries.jsr305
|
||||||
testCompile project(':grpc-core').sourceSets.test.output
|
|
||||||
signature "org.codehaus.mojo.signature:java16:1.1@signature"
|
signature "org.codehaus.mojo.signature:java16:1.1@signature"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
package io.grpc;
|
package io.grpc;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import io.grpc.internal.IoUtils;
|
import com.google.common.io.ByteStreams;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
@ -45,7 +45,7 @@ public final class StaticTestingClassLoader extends ClassLoader {
|
||||||
}
|
}
|
||||||
byte[] b;
|
byte[] b;
|
||||||
try {
|
try {
|
||||||
b = IoUtils.toByteArray(is);
|
b = ByteStreams.toByteArray(is);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new ClassNotFoundException(name, ex);
|
throw new ClassNotFoundException(name, ex);
|
||||||
}
|
}
|
||||||
|
|
@ -23,7 +23,6 @@ import com.google.common.truth.ComparableSubject;
|
||||||
import com.google.common.truth.FailureStrategy;
|
import com.google.common.truth.FailureStrategy;
|
||||||
import com.google.common.truth.SubjectFactory;
|
import com.google.common.truth.SubjectFactory;
|
||||||
import io.grpc.Deadline;
|
import io.grpc.Deadline;
|
||||||
import io.grpc.ExperimentalApi;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import javax.annotation.CheckReturnValue;
|
import javax.annotation.CheckReturnValue;
|
||||||
|
|
@ -32,7 +31,6 @@ import javax.annotation.Nullable;
|
||||||
/**
|
/**
|
||||||
* Propositions for {@link Deadline} subjects.
|
* Propositions for {@link Deadline} subjects.
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/3613")
|
|
||||||
public final class DeadlineSubject extends ComparableSubject<DeadlineSubject, Deadline> {
|
public final class DeadlineSubject extends ComparableSubject<DeadlineSubject, Deadline> {
|
||||||
private static final SubjectFactory<DeadlineSubject, Deadline> deadlineFactory =
|
private static final SubjectFactory<DeadlineSubject, Deadline> deadlineFactory =
|
||||||
new DeadlineSubjectFactory();
|
new DeadlineSubjectFactory();
|
||||||
|
|
@ -79,7 +77,6 @@ public final class DeadlineSubject extends ComparableSubject<DeadlineSubject, De
|
||||||
* A partially specified proposition about an approximate relationship to a {@code deadline}
|
* A partially specified proposition about an approximate relationship to a {@code deadline}
|
||||||
* subject using a tolerance.
|
* subject using a tolerance.
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/3613")
|
|
||||||
public abstract static class TolerantDeadlineComparison {
|
public abstract static class TolerantDeadlineComparison {
|
||||||
|
|
||||||
private TolerantDeadlineComparison() {}
|
private TolerantDeadlineComparison() {}
|
||||||
|
|
@ -26,7 +26,8 @@ dependencies {
|
||||||
exclude group: 'io.grpc', module: 'grpc-context'
|
exclude group: 'io.grpc', module: 'grpc-context'
|
||||||
}
|
}
|
||||||
|
|
||||||
testCompile project(':grpc-testing')
|
testCompile project(':grpc-context').sourceSets.test.output,
|
||||||
|
project(':grpc-testing')
|
||||||
|
|
||||||
signature "org.codehaus.mojo.signature:java16:1.1@signature"
|
signature "org.codehaus.mojo.signature:java16:1.1@signature"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ dependencies {
|
||||||
libraries.oauth_client,
|
libraries.oauth_client,
|
||||||
libraries.truth
|
libraries.truth
|
||||||
runtime libraries.opencensus_impl
|
runtime libraries.opencensus_impl
|
||||||
|
testCompile project(':grpc-context').sourceSets.test.output
|
||||||
}
|
}
|
||||||
|
|
||||||
configureProtoCompilation()
|
configureProtoCompilation()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue