From 4dd6c14ba275384ce8561ec4a5f139a740a79f7f Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 20 Apr 2017 15:42:50 +0200 Subject: [PATCH] Only use test SslProviders that are supported in SslHandlerTest.testCompositeBufSizeEstimationGuaranteesSynchronousWrite(). Motivation: We need to ensure we only try to to test with the SslProviders that are supported when running the SslHandlerTest.testCompositeBufSizeEstimationGuaranteesSynchronousWrite test. Modifications: Skip SslProvider.OPENSSL* if not supported. Result: No more test-failures if openssl is not installed on the system. --- .../io/netty/handler/ssl/SslHandlerTest.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java b/handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java index d31443c497..b5875d0377 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SslHandlerTest.java @@ -571,13 +571,19 @@ public class SslHandlerTest { throws CertificateException, SSLException, ExecutionException, InterruptedException { SslProvider[] providers = SslProvider.values(); for (int i = 0; i < providers.length; ++i) { - for (int j = 0; j < providers.length; ++j) { - compositeBufSizeEstimationGuaranteesSynchronousWrite(providers[i], providers[j]); + SslProvider serverProvider = providers[i]; + if (isSupported(serverProvider)) { + for (int j = 0; j < providers.length; ++j) { + SslProvider clientProvider = providers[j]; + if (isSupported(clientProvider)) { + compositeBufSizeEstimationGuaranteesSynchronousWrite(serverProvider, clientProvider); + } + } } } } - private void compositeBufSizeEstimationGuaranteesSynchronousWrite( + private static void compositeBufSizeEstimationGuaranteesSynchronousWrite( SslProvider serverProvider, SslProvider clientProvider) throws CertificateException, SSLException, ExecutionException, InterruptedException { SelfSignedCertificate ssc = new SelfSignedCertificate(); @@ -690,4 +696,14 @@ public class SslHandlerTest { ssc.delete(); } } + + private static boolean isSupported(SslProvider provider) { + switch (provider) { + case OPENSSL: + case OPENSSL_REFCNT: + return OpenSsl.isAvailable(); + default: + return true; + } + } }