Issue #3250 Ease osgi debugging (#3251)

Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2019-01-15 14:38:16 +11:00 committed by GitHub
parent aa7f3bd071
commit 9f3f3b78ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 39 deletions

View File

@ -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

View File

@ -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

View File

@ -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
{

View File

@ -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

View File

@ -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

View File

@ -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
{

View File

@ -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<Option> annotationDependencies()
{
List<Option> res = new ArrayList<>();
res.add(mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "javax.mail.glassfish" ).version( "1.4.1.v201005082020" ).noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.tests").artifactId("test-mock-resources").versionAsInProject());
//test webapp bundle
res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("test-jetty-webapp").classifier("webbundle").versionAsInProject());
return res;
@ -104,7 +101,6 @@ public class TestJettyOSGiBootWithJavaxWebSocket
}
@Ignore
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
@ -116,6 +112,9 @@ public class TestJettyOSGiBootWithJavaxWebSocket
@Test
public void testWebsocket() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
//this is necessary because the javax.websocket-api jar does not have manifest headers
//that allow it to use ServiceLoader in osgi, this corrects that defect
TinyBundle bundle = TinyBundles.bundle();

View File

@ -32,7 +32,6 @@ import javax.inject.Inject;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
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;
@ -86,8 +85,6 @@ public class TestJettyOSGiBootWithJsp
}
@Ignore
@Test
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.debugBundles(bundleContext);
@ -98,6 +95,9 @@ public class TestJettyOSGiBootWithJsp
@Test
public void testJspDump() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
HttpClient client = new HttpClient();
try
{

View File

@ -32,7 +32,6 @@ import javax.inject.Inject;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@ -79,15 +78,12 @@ public class TestJettyOSGiBootWithWebSocket
public static List<Option> annotationDependencies()
{
List<Option> res = new ArrayList<>();
res.add(mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "javax.mail.glassfish" ).version( "1.4.1.v201005082020" ).noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.tests").artifactId("test-mock-resources").versionAsInProject());
//test webapp bundle
res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("test-jetty-webapp").classifier("webbundle").versionAsInProject());
return res;
}
@Ignore
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
@ -98,7 +94,10 @@ public class TestJettyOSGiBootWithWebSocket
@Test
public void testWebsocket() throws Exception
{
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
String port = System.getProperty("boot.websocket.port");
assertNotNull(port);

View File

@ -44,7 +44,6 @@ import org.eclipse.jetty.osgi.boot.OSGiServerConstants;
import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.Option;
import org.osgi.framework.Bundle;
@ -57,6 +56,8 @@ import org.osgi.service.http.HttpService;
*/
public class TestOSGiUtil
{
public static final String BUNDLE_DEBUG = "bundle.debug";
public static List<Option> configureJettyHomeAndPort(boolean ssl,String jettySelectorFileName)
{
@ -103,7 +104,7 @@ public class TestOSGiUtil
public static List<Option> coreJettyDependencies()
{
List<Option> res = new ArrayList<>();
res.add(systemProperty("bundle.debug").value(Boolean.toString(Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))));
String mavenRepoPath = System.getProperty( "mavenRepoPath" );
if (!StringUtil.isBlank(mavenRepoPath))
res.add( systemProperty( "org.ops4j.pax.url.mvn.localRepository" ).value( mavenRepoPath ) );