[jboss-osgi-commits] JBoss-OSGI SVN: r94435 - in projects/jboss-osgi/trunk/testsuite/example: src/test/java/org/jboss/test/osgi/example/webapp and 5 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Oct 6 17:22:02 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-06 17:22:01 -0400 (Tue, 06 Oct 2009)
New Revision: 94435

Added:
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/bundle/
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/bundle/EndpointServlet.java
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/META-INF/
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/META-INF/MANIFEST.MF
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/WEB-INF/
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/WEB-INF/web.xml
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/message.txt
Modified:
   projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
Log:
More webapp example - wip

Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml	2009-10-06 20:22:37 UTC (rev 94434)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml	2009-10-06 21:22:01 UTC (rev 94435)
@@ -61,6 +61,18 @@
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-simple.jar" files="${tests.resources.dir}/simple/example-simple.bnd" />
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-simple-husky.jar" files="${tests.resources.dir}/simple/example-simple-husky.bnd" />
     
+    <!-- webapp -->
+    <war destfile="${tests.output.dir}/test-libs/example-webapp.war"
+      manifest="${tests.resources.dir}/webapp/META-INF/MANIFEST.MF"
+      webxml="${tests.resources.dir}/webapp/WEB-INF/web.xml">
+      <classes dir="${tests.classes.dir}">
+        <include name="**/example/webapp/bundle/*.class"/>
+      </classes>
+      <fileset dir="${tests.resources.dir}/webapp">
+        <include name="message.txt"/>
+      </fileset>
+    </war> 
+    
     <!-- xml/jaxb -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-xml-jaxb.jar" files="${tests.resources.dir}/xml/jaxb/example-xml-jaxb.bnd" />
     

Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/bundle/EndpointServlet.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/bundle/EndpointServlet.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/bundle/EndpointServlet.java	2009-10-06 21:22:01 UTC (rev 94435)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.webapp.bundle;
+
+//$Id: EndpointServlet.java 87329 2009-04-15 10:34:21Z thomas.diesler at jboss.com $
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+ at SuppressWarnings("serial")
+public class EndpointServlet extends HttpServlet
+{
+  @Override
+  protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+  {
+    PrintWriter out = res.getWriter();
+    
+    String testParam = req.getParameter("test");
+    if ("plain".equals(testParam))
+    {
+      out.println("Hello from Servlet");
+    }
+    else if ("initProp".equals(testParam))
+    {
+      String value = getInitParameter(testParam);
+      out.println(testParam + "=" + value);
+    }
+    else
+    {
+      throw new IllegalArgumentException("Invalid 'test' parameter: " + testParam);
+    }
+    
+    out.close();
+  }
+}

Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/META-INF/MANIFEST.MF	2009-10-06 21:22:01 UTC (rev 94435)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-Name: example-webapp
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: example-webapp
+Bundle-ClassPath: .,WEB-INF/classes
+Import-Package: javax.servlet,javax.servlet.http
+

Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/WEB-INF/web.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/WEB-INF/web.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/WEB-INF/web.xml	2009-10-06 21:22:01 UTC (rev 94435)
@@ -0,0 +1,21 @@
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
+         version="2.4">
+
+  <display-name>WebApp Sample</display-name>
+
+  <servlet>
+    <servlet-name>example.servlet</servlet-name>
+    <servlet-class>org.jboss.test.osgi.example.webapp.bundle.EndpointServlet</servlet-class>
+    <init-param>
+      <param-name>initProp</param-name>
+      <param-value>SomeValue</param-value>
+    </init-param>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>example.servlet</servlet-name>
+    <url-pattern>/*</url-pattern>
+  </servlet-mapping>
+
+</web-app>

Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/message.txt
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/message.txt	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/webapp/message.txt	2009-10-06 21:22:01 UTC (rev 94435)
@@ -0,0 +1 @@
+Hello from Resource
\ No newline at end of file



More information about the jboss-osgi-commits mailing list