diff options
author | dapengzhang0 <zdapeng@google.com> | 2017-11-22 14:36:44 -0800 |
---|---|---|
committer | ZHANG Dapeng <zdapeng@google.com> | 2017-11-22 16:09:59 -0800 |
commit | 3275dcbc0f448baaf623f8d86c2702836d2d8640 (patch) | |
tree | 0bade9e4d301579923998b7ef01a8b0823fd15b5 /testing | |
parent | dc71083ce913152763e86ffbc79a78e88b6f04a3 (diff) | |
download | grpc-grpc-java-3275dcbc0f448baaf623f8d86c2702836d2d8640.tar.gz |
testing: delete some deprecated APIs in TestUtils
Diffstat (limited to 'testing')
-rw-r--r-- | testing/src/main/java/io/grpc/testing/TestUtils.java | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/testing/src/main/java/io/grpc/testing/TestUtils.java b/testing/src/main/java/io/grpc/testing/TestUtils.java index a307073b8..ded738672 100644 --- a/testing/src/main/java/io/grpc/testing/TestUtils.java +++ b/testing/src/main/java/io/grpc/testing/TestUtils.java @@ -22,16 +22,10 @@ import io.grpc.ServerCall; import io.grpc.ServerCallHandler; import io.grpc.ServerInterceptor; import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; import java.security.KeyStore; import java.security.NoSuchAlgorithmException; import java.security.Provider; @@ -41,7 +35,6 @@ import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; @@ -53,9 +46,6 @@ import javax.security.auth.x500.X500Principal; */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1791") public class TestUtils { - @Deprecated - public static final String TEST_SERVER_HOST = "foo.test.google.fr"; - /** * Capture the request headers from a client. Useful for testing metadata propagation. */ @@ -74,60 +64,6 @@ public class TestUtils { } /** - * Capture the request attributes. Useful for testing ServerCalls. - * {@link ServerCall#getAttributes()} - * - * @deprecated Not for public use - */ - @Deprecated - public static ServerInterceptor recordServerCallInterceptor( - final AtomicReference<ServerCall<?, ?>> serverCallCapture) { - return new ServerInterceptor() { - @Override - public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall( - ServerCall<ReqT, RespT> call, - Metadata requestHeaders, - ServerCallHandler<ReqT, RespT> next) { - serverCallCapture.set(call); - return next.startCall(call, requestHeaders); - } - }; - } - - /** - * Creates a new {@link InetSocketAddress} that overrides the host with {@link #TEST_SERVER_HOST}. - * - * @deprecated Not for public use - */ - @Deprecated - public static InetSocketAddress testServerAddress(String host, int port) { - try { - InetAddress inetAddress = InetAddress.getByName(host); - inetAddress = InetAddress.getByAddress(TEST_SERVER_HOST, inetAddress.getAddress()); - return new InetSocketAddress(inetAddress, port); - } catch (UnknownHostException e) { - throw new RuntimeException(e); - } - } - - /** - * Creates a new {@link InetSocketAddress} on localhost that overrides the host with - * {@link #TEST_SERVER_HOST}. - * - * @deprecated Not for public use - */ - @Deprecated - public static InetSocketAddress testServerAddress(int port) { - try { - InetAddress inetAddress = InetAddress.getByName("::1"); - inetAddress = InetAddress.getByAddress(TEST_SERVER_HOST, inetAddress.getAddress()); - return new InetSocketAddress(inetAddress, port); - } catch (UnknownHostException e) { - throw new RuntimeException(e); - } - } - - /** * Returns the ciphers preferred to use during tests. They may be chosen because they are widely * available or because they are fast. There is no requirement that they provide confidentiality * or integrity. @@ -154,35 +90,6 @@ public class TestUtils { } /** - * Saves a file from the classpath resources in src/main/resources/certs as a file on the - * filesystem. - * - * @param name name of a file in src/main/resources/certs. - * - * @deprecated Not for public use. Use {@link TlsTesting#loadCert} instead. - */ - @Deprecated - public static File loadCert(String name) throws IOException { - InputStream in = new BufferedInputStream(TestUtils.class.getResourceAsStream("/certs/" + name)); - File tmpFile = File.createTempFile(name, ""); - tmpFile.deleteOnExit(); - - OutputStream os = new BufferedOutputStream(new FileOutputStream(tmpFile)); - try { - int b; - while ((b = in.read()) != -1) { - os.write(b); - } - os.flush(); - } finally { - in.close(); - os.close(); - } - - return tmpFile; - } - - /** * Loads an X.509 certificate from the classpath resources in src/main/resources/certs. * * @param fileName name of a file in src/main/resources/certs. @@ -227,21 +134,5 @@ public class TestUtils { return context.getSocketFactory(); } - /** - * Sleeps for at least the specified time. When in need of a guaranteed sleep time, use this in - * preference to {@code Thread.sleep} which might not sleep for the required time. - * - * @deprecated Not for public use - */ - @Deprecated - public static void sleepAtLeast(long millis) throws InterruptedException { - long delay = TimeUnit.MILLISECONDS.toNanos(millis); - long end = System.nanoTime() + delay; - while (delay > 0) { - TimeUnit.NANOSECONDS.sleep(delay); - delay = end - System.nanoTime(); - } - } - private TestUtils() {} } |