Make jsp 2.3.2 work for jetty-9.1, bring osgi tests back into the build.

This commit is contained in:
Jan Bartel 2013-09-02 17:13:20 +10:00
parent 2e444d2f17
commit a98bbc31e0
13 changed files with 93 additions and 75 deletions

View File

@ -88,31 +88,32 @@
<Bundle-Classpath />
<Fragment-Host>org.eclipse.jetty.osgi.boot</Fragment-Host>
<Export-Package>!org.eclipse.jetty.osgi.boot.*</Export-Package>
<Import-Package>com.sun.el;resolution:=optional,
<Import-Package>org.eclipse.jdt.*;resolution:=optional,
com.sun.el;resolution:=optional,
com.sun.el.lang;resolution:=optional,
com.sun.el.parser;resolution:=optional,
com.sun.el.util;resolution:=optional,
javax.el;version="[3.0,3.1)";resolution:=optional,
javax.servlet;version="[2.6.0,3.2)",
javax.servlet.jsp;version="2.3",
javax.servlet.jsp.el;version="2.3",
javax.el;version="[3.0,3.1)",
javax.servlet;version="[3.1,3.2)",
javax.servlet.resources;version="[3.1,3.2)",
javax.servlet.jsp.resources;version="[3.1,3.2)",
javax.servlet.jsp;version="[2.3,2.4)",
javax.servlet.jsp.el;version="[2.3,2.4)",
javax.servlet.jsp.tagext;version="[2.3,2.4)",
javax.servlet.jsp.jstl.core;version="1.2.0";resolution:=optional,
javax.servlet.jsp.jstl.fmt;version="1.2.0";resolution:=optional,
javax.servlet.jsp.jstl.sql;version="1.2.0";resolution:=optional,
javax.servlet.jsp.jstl.tlv;version="1.2.0";resolution:=optional,
javax.servlet.jsp.resources;version="2.3",
javax.servlet.jsp.tagext;version="2.3",
javax.servlet.resources;version="(2.6.0,3.2)",
org.apache.jasper;version="2.3.2";resolution:=optional,
org.apache.jasper.compiler;version="2.3.2";resolution:=optional,
org.apache.jasper.compiler.tagplugin;version="2.3.2";resolution:=optional,
org.apache.jasper.runtime;version="2.3.2";resolution:=optional,
org.apache.jasper.security;version="2.3.2";resolution:=optional,
org.apache.jasper.servlet;version="2.3.2";resolution:=optional,
org.apache.jasper.tagplugins.jstl;version="2.3.2";resolution:=optional,
org.apache.jasper.util;version="2.3.2";resolution:=optional,
org.apache.jasper.xmlparser;version="2.3.2";resolution:=optional,
org.glassfish.jsp.api;version="2.3.2";resolution:=optional,
org.apache.jasper;version="[2.3.2,2.4)";resolution:=optional,
org.apache.jasper.compiler;version="[2.3.2,2.4)";resolution:=optional,
org.apache.jasper.compiler.tagplugin;version="[2.3.2,2.4)";resolution:=optional,
org.apache.jasper.runtime;version="[2.3.2,2.4)";resolution:=optional,
org.apache.jasper.security;version="[2.3.2,2.4)";resolution:=optional,
org.apache.jasper.servlet;version="[2.3.2,2.4)";resolution:=optional,
org.apache.jasper.tagplugins.jstl;version="[2.3.2,2.4)";resolution:=optional,
org.apache.jasper.util;version="[2.3.2,2.4)";resolution:=optional,
org.apache.jasper.xmlparser;version="[2.3.2,2.4)";resolution:=optional,
org.glassfish.jsp.api;version="[2.3.2,2.4)";resolution:=optional,
org.apache.taglibs.standard;version="1.2.0";resolution:=optional,
org.apache.taglibs.standard.extra.spath;version="1.2.0";resolution:=optional,
org.apache.taglibs.standard.functions;version="1.2.0";resolution:=optional,

View File

@ -102,14 +102,14 @@
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.osgi.boot;singleton:=true</Bundle-SymbolicName>
<Bundle-Activator>org.eclipse.jetty.osgi.boot.JettyBootstrapActivator</Bundle-Activator>
<DynamicImport-Package>org.eclipse.jetty.*;version="[9.0,10.0)"</DynamicImport-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[9.1,10.0)"</DynamicImport-Package>
<Import-Package>javax.mail;version="1.4.0";resolution:=optional,
javax.mail.event;version="1.4.0";resolution:=optional,
javax.mail.internet;version="1.4.0";resolution:=optional,
javax.mail.search;version="1.4.0";resolution:=optional,
javax.mail.util;version="1.4.0";resolution:=optional,
javax.servlet;version="[2.6,3.2)",
javax.servlet.http;version="[2.6,3.2)",
javax.servlet;version="[3.1,3.2)",
javax.servlet.http;version="[3.1,3.2)",
javax.transaction;version="1.1.0";resolution:=optional,
javax.transaction.xa;version="1.1.0";resolution:=optional,
org.eclipse.jetty.annotations;version="9.0.0";resolution:=optional,

View File

@ -96,10 +96,10 @@
<Bundle-SymbolicName>org.eclipse.jetty.osgi.httpservice</Bundle-SymbolicName>
<Bundle-Name>OSGi HttpService</Bundle-Name>
<Jetty-ContextFilePath>contexts/httpservice.xml</Jetty-ContextFilePath>
<Import-Package>org.eclipse.jetty.server.handler;version="[9.0,10.0)",
org.eclipse.jetty.util.component;version="[9.0,10.0)",
org.eclipse.jetty.server.session;version="[9.0,10.0)",
org.eclipse.jetty.servlet;version="[9.0,10.0)",
<Import-Package>org.eclipse.jetty.server.handler;version="[9.1,10.0)",
org.eclipse.jetty.util.component;version="[9.1,10.0)",
org.eclipse.jetty.server.session;version="[9.1,10.0)",
org.eclipse.jetty.servlet;version="[9.1,10.0)",
org.eclipse.equinox.http.servlet,
*
</Import-Package>

View File

@ -26,9 +26,7 @@
<module>jetty-osgi-httpservice</module>
<module>test-jetty-osgi-webapp</module>
<module>test-jetty-osgi-context</module>
<!--
<module>test-jetty-osgi</module>
-->
</modules>
<build>
<resources>

View File

@ -26,6 +26,10 @@
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-schemas</artifactId>
</dependency>
</dependencies>
<build>
@ -94,8 +98,8 @@
compilation time. -->
<_nouses>true</_nouses>
<Import-Package>
javax.servlet;version="[2.6.0,3.2)",
javax.servlet.resources;version="[2.6.0,3.2)",
javax.servlet;version="[3.1,3.2)",
javax.servlet.resources;version="[3.1,3.2)",
org.osgi.framework,
org.osgi.service.cm;version="1.2.0",
org.osgi.service.packageadmin,
@ -109,7 +113,7 @@
org.xml.sax.helpers,
*
</Import-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[9.0,10.0)"</DynamicImport-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[9.1,10.0)"</DynamicImport-Package>
</instructions>
</configuration>
</plugin>

View File

@ -104,7 +104,7 @@
org.xml.sax.helpers,
*
</Import-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[9.0,10.0)"</DynamicImport-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[9.1,10.0)"</DynamicImport-Package>
</instructions>
</configuration>
</plugin>

View File

@ -170,6 +170,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-jsp-fragment</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-httpservice</artifactId>
@ -261,6 +267,12 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.spdy</groupId>
@ -298,6 +310,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-schemas</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>

View File

@ -18,6 +18,9 @@
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.options;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
@ -29,8 +32,6 @@ import java.util.List;
import javax.inject.Inject;
import junit.framework.Assert;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
@ -122,6 +123,7 @@ public class TestJettyOSGiBootContextAsService
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
}
/**
*/
@Test
@ -133,10 +135,10 @@ public class TestJettyOSGiBootContextAsService
{
client.start();
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT + "/acme/index.html");
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
assertEquals(HttpStatus.OK_200, response.getStatus());
String content = new String(response.getContent());
Assert.assertTrue(content.indexOf("<h1>Test OSGi Context</h1>") != -1);
assertTrue(content.indexOf("<h1>Test OSGi Context</h1>") != -1);
}
finally
{
@ -144,8 +146,8 @@ public class TestJettyOSGiBootContextAsService
}
ServiceReference[] refs = bundleContext.getServiceReferences(ContextHandler.class.getName(), null);
Assert.assertNotNull(refs);
Assert.assertEquals(1, refs.length);
assertNotNull(refs);
assertEquals(1, refs.length);
//uncomment for debugging
/*
String[] keys = refs[0].getPropertyKeys();
@ -155,15 +157,15 @@ public class TestJettyOSGiBootContextAsService
System.err.println("service property: " + k + ", " + refs[0].getProperty(k));
}*/
ContextHandler ch = (ContextHandler) bundleContext.getService(refs[0]);
Assert.assertEquals("/acme", ch.getContextPath());
assertEquals("/acme", ch.getContextPath());
// Stop the bundle with the ContextHandler in it and check the jetty
// Context is destroyed for it.
// TODO: think of a better way to communicate this to the test, other
// than checking stderr output
Bundle testWebBundle = TestOSGiUtil.getBundle(bundleContext, "org.eclipse.jetty.osgi.testcontext");
Assert.assertNotNull("Could not find the org.eclipse.jetty.test-jetty-osgi-context.jar bundle", testWebBundle);
Assert.assertTrue("The bundle org.eclipse.jetty.testcontext is not correctly resolved", testWebBundle.getState() == Bundle.ACTIVE);
assertNotNull("Could not find the org.eclipse.jetty.test-jetty-osgi-context.jar bundle", testWebBundle);
assertTrue("The bundle org.eclipse.jetty.testcontext is not correctly resolved", testWebBundle.getState() == Bundle.ACTIVE);
testWebBundle.stop();
}
}

View File

@ -78,8 +78,8 @@ public class TestJettyOSGiBootCore
res.add(mavenBundle().groupId( "org.eclipse.jetty.osgi" ).artifactId( "jetty-osgi-boot" ).versionAsInProject().start());
//res.add(mavenBundle().groupId( "org.eclipse.jetty.orbit" ).artifactId( "javax.servlet" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "javax.servlet" ).artifactId( "javax.servlet-api" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty.toolchain" ).artifactId( "jetty-schemas" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-deploy" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-server" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty" ).artifactId( "jetty-servlet" ).versionAsInProject().noStart());
@ -96,6 +96,7 @@ public class TestJettyOSGiBootCore
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-common" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-servlet" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "org.eclipse.jetty.websocket" ).artifactId( "websocket-server" ).versionAsInProject().noStart());
res.add(mavenBundle().groupId( "javax.websocket" ).artifactId( "javax.websocket-api" ).versionAsInProject().noStart());
return res;
}
@ -127,6 +128,4 @@ public class TestJettyOSGiBootCore
{
TestOSGiUtil.testHttpServiceGreetings(bundleContext, "http", DEFAULT_JETTY_HTTP_PORT);
}
}

View File

@ -104,6 +104,7 @@ public class TestJettyOSGiBootSpdy
res.add(mavenBundle().groupId("org.eclipse.jetty.osgi").artifactId("jetty-osgi-npn").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.spdy").artifactId("spdy-core").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.spdy").artifactId("spdy-server").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.spdy").artifactId("spdy-http-common").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.spdy").artifactId("spdy-http-server").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.spdy").artifactId("spdy-client").versionAsInProject().noStart());
return res;

View File

@ -18,6 +18,9 @@
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.options;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
@ -29,8 +32,6 @@ import java.util.List;
import javax.inject.Inject;
import junit.framework.Assert;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
@ -82,7 +83,6 @@ public class TestJettyOSGiBootWebAppAsService
if (LOGGING_ENABLED)
logLevel = "INFO";
options.addAll(Arrays.asList(options(
// install log service using pax runners profile abstraction (there
// are more profiles, like DS)
@ -94,8 +94,8 @@ public class TestJettyOSGiBootWebAppAsService
options.addAll(jspDependencies());
return options.toArray(new Option[options.size()]);
}
public static List<Option> configureJettyHomeAndPort(String jettySelectorFileName)
{
@ -119,16 +119,14 @@ public class TestJettyOSGiBootWebAppAsService
public static List<Option> jspDependencies()
{
List<Option> res = new ArrayList<Option>();
/* orbit deps */
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("javax.servlet.jsp").versionAsInProject());
//jsp bundles
res.add(mavenBundle().groupId("javax.servlet.jsp").artifactId("javax.servlet.jsp-api").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("javax.servlet.jsp.jstl").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("javax.el").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("com.sun.el").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("org.apache.jasper.glassfish").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("org.apache.taglibs.standard.glassfish").versionAsInProject());
res.add(mavenBundle().groupId("org.glassfish").artifactId("javax.el").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("org.eclipse.jdt.core").versionAsInProject());
/* jetty-osgi deps */
res.add(mavenBundle().groupId("org.eclipse.jetty.toolchain").artifactId("jetty-jsp-fragment").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.osgi").artifactId("jetty-osgi-boot-jsp").versionAsInProject().noStart());
// a bundle that registers a webapp as a service for the jetty osgi core
@ -148,17 +146,17 @@ public class TestJettyOSGiBootWebAppAsService
@Test
public void testBundle() throws Exception
{
// now test the jsp/dump.jsp
// now test getting a static file
HttpClient client = new HttpClient();
try
{
client.start();
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT + "/acme/index.html");
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
assertEquals(HttpStatus.OK_200, response.getStatus());
String content = new String(response.getContent());
Assert.assertTrue(content.indexOf("<h1>Test OSGi WebApp</h1>") != -1);
assertTrue(content.indexOf("<h1>Test OSGi WebApp</h1>") != -1);
}
finally
{
@ -166,10 +164,10 @@ public class TestJettyOSGiBootWebAppAsService
}
ServiceReference[] refs = bundleContext.getServiceReferences(ContextHandler.class.getName(), null);
Assert.assertNotNull(refs);
Assert.assertEquals(1, refs.length);
assertNotNull(refs);
assertEquals(1, refs.length);
WebAppContext wac = (WebAppContext) bundleContext.getService(refs[0]);
Assert.assertEquals("/acme", wac.getContextPath());
assertEquals("/acme", wac.getContextPath());
}
}

View File

@ -18,6 +18,8 @@
package org.eclipse.jetty.osgi.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
@ -29,8 +31,6 @@ import java.util.List;
import javax.inject.Inject;
import junit.framework.Assert;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
@ -135,23 +135,23 @@ public class TestJettyOSGiBootWithJsp
public static List<Option> jspDependencies()
{
List<Option> res = new ArrayList<Option>();
/* orbit deps */
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("javax.servlet.jsp").versionAsInProject());
//jetty jsp bundles
res.add(mavenBundle().groupId("javax.servlet.jsp").artifactId("javax.servlet.jsp-api").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("javax.servlet.jsp.jstl").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("javax.el").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("com.sun.el").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("org.apache.jasper.glassfish").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("org.apache.taglibs.standard.glassfish").versionAsInProject());
res.add(mavenBundle().groupId("org.glassfish").artifactId("javax.el").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.orbit").artifactId("org.eclipse.jdt.core").versionAsInProject());
/* jetty-osgi deps */
res.add(mavenBundle().groupId("org.eclipse.jetty.toolchain").artifactId("jetty-jsp-fragment").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.osgi").artifactId("jetty-osgi-boot-jsp").versionAsInProject().noStart());
//test webapp bundle
res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("test-jetty-webapp").classifier("webbundle").versionAsInProject());
return res;
}
@Test
public void assertAllBundlesActiveOrResolved()
{
@ -175,16 +175,14 @@ public class TestJettyOSGiBootWithJsp
{
client.start();
ContentResponse response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_JETTY_HTTP_PORT + "/jsp/dump.jsp");
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
assertEquals(HttpStatus.OK_200, response.getStatus());
String content = new String(response.getContent());
Assert.assertTrue(content.contains("<tr><th>ServletPath:</th><td>/jsp/dump.jsp</td></tr>"));
assertTrue(content.contains("<tr><th>ServletPath:</th><td>/jsp/dump.jsp</td></tr>"));
}
finally
{
client.stop();
}
}
}

View File

@ -480,7 +480,7 @@
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-schemas</artifactId>
<version>3.1.RC0</version>
<version>3.1-SNAPSHOT</version>
</dependency>
<dependency>