From f60d08fd32b7287f65077f99a88bac645834098f Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Sat, 28 Jul 2018 02:53:43 +0800 Subject: [PATCH] Add test for shading netty-tcnative. (#8157) Motivation: d67d639f5f4de11f32dc15abcd0e18bad5a24a21 added a test for shading the native transport of netty. We should also test that shading netty-tcnative is possible. Modifications: Add test for shading netty-tcnative Result: More testing. --- testsuite-shading/pom.xml | 40 +++++++++++++++++-- .../io/netty/testsuite/shading/ShadingIT.java | 17 +++++--- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/testsuite-shading/pom.xml b/testsuite-shading/pom.xml index 9e859dc09b..5b42b7d662 100644 --- a/testsuite-shading/pom.xml +++ b/testsuite-shading/pom.xml @@ -71,7 +71,8 @@ - netty_transport_native_kqueue_${os.detected.arch}.jnilib + netty_transport_native_kqueue_${os.detected.arch}.jnilib + netty_tcnative.jnilib @@ -81,6 +82,20 @@ ${jni.classifier} compile + + + ${project.groupId} + netty-handler + ${project.version} + compile + + + ${project.groupId} + ${tcnative.artifactId} + ${tcnative.version} + ${tcnative.classifier} + compile + @@ -126,7 +141,8 @@ - + + @@ -162,7 +178,8 @@ - netty_transport_native_epoll_${os.detected.arch}.so + netty_transport_native_epoll_${os.detected.arch}.so + netty_tcnative.so @@ -172,6 +189,20 @@ ${jni.classifier} compile + + + ${project.groupId} + netty-handler + ${project.version} + compile + + + ${project.groupId} + ${tcnative.artifactId} + ${tcnative.version} + ${tcnative.classifier} + compile + @@ -217,7 +248,8 @@ - + + diff --git a/testsuite-shading/src/test/java/io/netty/testsuite/shading/ShadingIT.java b/testsuite-shading/src/test/java/io/netty/testsuite/shading/ShadingIT.java index 21d02c1ce8..5989581f16 100644 --- a/testsuite-shading/src/test/java/io/netty/testsuite/shading/ShadingIT.java +++ b/testsuite-shading/src/test/java/io/netty/testsuite/shading/ShadingIT.java @@ -23,14 +23,19 @@ import java.lang.reflect.Method; public class ShadingIT { @Test - public void testShadingNativeLibs() throws Exception { + public void testShadingNativeTransport() throws Exception { + testShading0(PlatformDependent.isOsx() ? "io.netty.channel.kqueue.KQueue" : "io.netty.channel.epoll.Epoll"); + } + + @Test + public void testShadingTcnative() throws Exception { + testShading0("io.netty.handler.ssl.OpenSsl"); + } + + private static void testShading0(String classname) throws Exception { String shadingPrefix = System.getProperty("shadingPrefix"); - final Class clazz = Class.forName(shadingPrefix + '.' + className()); + final Class clazz = Class.forName(shadingPrefix + '.' + classname); Method method = clazz.getMethod("ensureAvailability"); method.invoke(null); } - - private static String className() { - return PlatformDependent.isOsx() ? "io.netty.channel.kqueue.KQueue" : "io.netty.channel.epoll.Epoll"; - } }