Adding optionalRemoteDebug feature to test-jetty-osgi

This commit is contained in:
Joakim Erdfelt 2019-02-28 16:10:46 -05:00
parent 5b959f17af
commit f5b3ddc1a5
2 changed files with 21 additions and 17 deletions

View File

@ -18,15 +18,8 @@
package org.eclipse.jetty.osgi.test; package org.eclipse.jetty.osgi.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpClient;
@ -41,6 +34,12 @@ import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.junit.PaxExam;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
/** /**
* Pax-Exam to make sure the jetty-osgi-boot can be started along with the * Pax-Exam to make sure the jetty-osgi-boot can be started along with the
* httpservice web-bundle. Then make sure we can deploy an OSGi service on the * httpservice web-bundle. Then make sure we can deploy an OSGi service on the
@ -59,6 +58,7 @@ public class TestJettyOSGiBootWithAnnotations
public static Option[] configure() public static Option[] configure()
{ {
ArrayList<Option> options = new ArrayList<>(); ArrayList<Option> options = new ArrayList<>();
options.add(TestOSGiUtil.optionalRemoteDebug());
options.add(CoreOptions.junitBundles()); options.add(CoreOptions.junitBundles());
options.addAll(TestOSGiUtil.configureJettyHomeAndPort(false, "jetty-http-boot-with-annotations.xml")); options.addAll(TestOSGiUtil.configureJettyHomeAndPort(false, "jetty-http-boot-with-annotations.xml"));
options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.sql.*","javax.xml.*", "javax.activation.*")); options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.sql.*","javax.xml.*", "javax.activation.*"));

View File

@ -18,20 +18,12 @@
package org.eclipse.jetty.osgi.test; package org.eclipse.jetty.osgi.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -51,6 +43,13 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpService; import org.osgi.service.http.HttpService;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
/** /**
* Helper methods for pax-exam tests * Helper methods for pax-exam tests
*/ */
@ -100,6 +99,11 @@ public class TestOSGiUtil
return res; return res;
} }
public static Option optionalRemoteDebug()
{
return CoreOptions.when(Boolean.getBoolean("pax.exam.debug.remote"))
.useOptions(CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"));
}
public static List<Option> coreJettyDependencies() public static List<Option> coreJettyDependencies()
{ {