Issue #3162 - Introducing more convenience Options for PaxExam

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2018-12-03 17:35:08 -06:00 committed by Simone Bordet
parent 95bc15f521
commit e135197066
1 changed files with 24 additions and 7 deletions

View File

@ -18,6 +18,13 @@
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.IOException;
import java.util.ArrayList;
@ -36,6 +43,7 @@ import org.eclipse.jetty.http.HttpStatus;
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.log.StdErrLog;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.Option;
@ -44,13 +52,6 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
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
*/
@ -283,6 +284,22 @@ public class TestOSGiUtil
return sslContextFactory;
}
public static List<Option> jettyLogging()
{
List<Option> options = new ArrayList<>();
// SLF4J Specific (possible set of options)
/*
options.add(mavenBundle().groupId("org.slf4j").artifactId("slf4j-api").versionAsInProject().start());
options.add(mavenBundle().groupId("org.slf4j").artifactId("jul-to-slf4j").versionAsInProject().start());
options.add(mavenBundle().groupId("org.slf4j").artifactId("slf4j-log4j12").versionAsInProject().start());
options.add(mavenBundle().groupId("log4j").artifactId("log4j").versionAsInProject().start());
options.add(systemProperty("org.eclipse.jetty.util.log.class").value(Slf4jLog.class.getName()));
*/
options.add(systemProperty("org.eclipse.jetty.util.log.class").value(StdErrLog.class.getName()));
options.add(systemProperty("org.eclipse.jetty.LEVEL").value("INFO"));
return options;
}
protected static void testHttpServiceGreetings(BundleContext bundleContext, String protocol, int port) throws Exception
{
assertActiveBundle(bundleContext, "org.eclipse.jetty.osgi.boot");