From 9f3f3b78aec8ea8f9b296d598e79a674e28a0f52 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 15 Jan 2019 14:38:16 +1100 Subject: [PATCH] Issue #3250 Ease osgi debugging (#3251) Signed-off-by: Jan Bartel --- .../test/TestJettyOSGiBootContextAsService.java | 12 +++--------- .../jetty/osgi/test/TestJettyOSGiBootHTTP2.java | 15 ++++++++++----- .../test/TestJettyOSGiBootHTTP2Conscrypt.java | 7 ++++--- .../osgi/test/TestJettyOSGiBootHTTP2JDK9.java | 5 +++-- .../test/TestJettyOSGiBootWebAppAsService.java | 9 ++++++--- .../test/TestJettyOSGiBootWithAnnotations.java | 8 +++++--- .../test/TestJettyOSGiBootWithJavaxWebSocket.java | 7 +++---- .../jetty/osgi/test/TestJettyOSGiBootWithJsp.java | 6 +++--- .../osgi/test/TestJettyOSGiBootWithWebSocket.java | 9 ++++----- .../org/eclipse/jetty/osgi/test/TestOSGiUtil.java | 5 +++-- 10 files changed, 44 insertions(+), 39 deletions(-) diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootContextAsService.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootContextAsService.java index 09a5ef097d7..79fcf2cf631 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootContextAsService.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootContextAsService.java @@ -32,7 +32,6 @@ import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.server.handler.ContextHandler; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; @@ -81,19 +80,14 @@ public class TestJettyOSGiBootContextAsService - - @Ignore - public void assertAllBundlesActiveOrResolved() - { - TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext); - } - - /** */ @Test public void testContextHandlerAsOSGiService() throws Exception { + if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG)) + TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext); + // now test the context HttpClient client = new HttpClient(); try diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2.java index 6a24a8aa9cc..1dc807119bf 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2.java @@ -41,7 +41,6 @@ import org.eclipse.jetty.http2.client.HTTP2Client; import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; @@ -117,8 +116,7 @@ public class TestJettyOSGiBootHTTP2 return res; } - @Ignore - @Test + public void checkALPNBootOnBootstrapClasspath() throws Exception { Class alpn = Thread.currentThread().getContextClassLoader().loadClass("org.eclipse.jetty.alpn.ALPN"); @@ -126,8 +124,7 @@ public class TestJettyOSGiBootHTTP2 assertNull(alpn.getClassLoader()); } - @Ignore - @Test + public void assertAllBundlesActiveOrResolved() throws Exception { TestOSGiUtil.debugBundles(bundleContext); @@ -145,6 +142,14 @@ public class TestJettyOSGiBootHTTP2 @Test public void testHTTP2() throws Exception { + + if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG)) + { + checkALPNBootOnBootstrapClasspath(); + assertAllBundlesActiveOrResolved(); + } + + HttpClient httpClient = null; HTTP2Client http2Client = null; try diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2Conscrypt.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2Conscrypt.java index 6a957b87d3e..02f31dfd7f8 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2Conscrypt.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2Conscrypt.java @@ -40,7 +40,6 @@ import org.eclipse.jetty.http2.client.HTTP2Client; import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; @@ -117,8 +116,7 @@ public class TestJettyOSGiBootHTTP2Conscrypt } - @Ignore - @Test + public void assertAllBundlesActiveOrResolved() throws Exception { TestOSGiUtil.debugBundles(bundleContext); @@ -134,6 +132,9 @@ public class TestJettyOSGiBootHTTP2Conscrypt @Test public void testHTTP2() throws Exception { + if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG)) + assertAllBundlesActiveOrResolved(); + HTTP2Client client = new HTTP2Client(); try { diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2JDK9.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2JDK9.java index f002b962f46..ade2e193404 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2JDK9.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2JDK9.java @@ -39,7 +39,6 @@ import org.eclipse.jetty.http2.client.HTTP2Client; import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; @@ -108,7 +107,6 @@ public class TestJettyOSGiBootHTTP2JDK9 } - @Ignore public void assertAllBundlesActiveOrResolved() throws Exception { TestOSGiUtil.debugBundles(bundleContext); @@ -126,6 +124,9 @@ public class TestJettyOSGiBootHTTP2JDK9 @Test public void testHTTP2() throws Exception { + if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG)) + assertAllBundlesActiveOrResolved(); + HttpClient httpClient = null; HTTP2Client http2Client = null; try diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWebAppAsService.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWebAppAsService.java index 64021341faf..2f965ed130a 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWebAppAsService.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWebAppAsService.java @@ -33,7 +33,6 @@ import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.webapp.WebAppContext; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; @@ -97,8 +96,7 @@ public class TestJettyOSGiBootWebAppAsService return res; } - @Ignore - @Test + public void assertAllBundlesActiveOrResolved() { TestOSGiUtil.debugBundles(bundleContext); @@ -110,6 +108,11 @@ public class TestJettyOSGiBootWebAppAsService @Test public void testBundle() throws Exception { + + if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG)) + assertAllBundlesActiveOrResolved(); + + // now test getting a static file HttpClient client = new HttpClient(); try diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java index c80370c4b73..498161830a0 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithAnnotations.java @@ -33,7 +33,6 @@ import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.http.HttpStatus; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; @@ -95,10 +94,9 @@ public class TestJettyOSGiBootWithAnnotations } - @Ignore - @Test public void assertAllBundlesActiveOrResolved() { + TestOSGiUtil.debugBundles(bundleContext); TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext); } @@ -107,6 +105,10 @@ public class TestJettyOSGiBootWithAnnotations @Test public void testIndex() throws Exception { + + if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG)) + assertAllBundlesActiveOrResolved(); + HttpClient client = new HttpClient(); try { diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithJavaxWebSocket.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithJavaxWebSocket.java index 601719c570b..a4fa70ef546 100644 --- a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithJavaxWebSocket.java +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootWithJavaxWebSocket.java @@ -35,7 +35,6 @@ import javax.websocket.RemoteEndpoint; import javax.websocket.Session; import javax.websocket.WebSocketContainer; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; @@ -89,8 +88,6 @@ public class TestJettyOSGiBootWithJavaxWebSocket public static List