[jboss-cvs] JBossAS SVN: r95465 - in projects/jboss-osgi/trunk: testsuite and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 23 01:59:57 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-23 01:59:57 -0400 (Fri, 23 Oct 2009)
New Revision: 95465

Added:
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java
Removed:
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java
Modified:
   projects/jboss-osgi/trunk/pom.xml
   projects/jboss-osgi/trunk/testsuite/example/pom.xml
   projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
   projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Update to pax-web-0.7.2-SNAPSHOT
Resurect WebApp support for Felix

Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml	2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/pom.xml	2009-10-23 05:59:57 UTC (rev 95465)
@@ -68,10 +68,10 @@
     <version.jboss.osgi.runtime.jbossas>1.0.2-SNAPSHOT</version.jboss.osgi.runtime.jbossas>
     <version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
     <version.jboss.osgi.testing>0.0.1-SNAPSHOT</version.jboss.osgi.testing>
-    <version.jboss.osgi.webapp>0.7.1-SNAPSHOT</version.jboss.osgi.webapp>
+    <version.jboss.osgi.webapp>0.7.2-SNAPSHOT</version.jboss.osgi.webapp>
     <version.jboss.osgi.webconsole>1.0.2</version.jboss.osgi.webconsole>
     <version.jboss.osgi.xml.binding>2.0.1.SP1</version.jboss.osgi.xml.binding>
-    <version.ops4j.pax.web>0.7.1</version.ops4j.pax.web>
+    <version.ops4j.pax.web>0.7.2-20091021.163357-3</version.ops4j.pax.web>
     <version.osgi>4.2.0</version.osgi>
     
     <surefire.memory.args>-Xmx512m</surefire.memory.args>
@@ -240,6 +240,11 @@
       <!-- OPS4J -->
       <dependency>
         <groupId>org.ops4j.pax.web</groupId>
+        <artifactId>pax-web-extender-war</artifactId>
+        <version>${version.ops4j.pax.web}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.ops4j.pax.web</groupId>
         <artifactId>pax-web-jetty-bundle</artifactId>
         <version>${version.ops4j.pax.web}</version>
       </dependency>

Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml	2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml	2009-10-23 05:59:57 UTC (rev 95465)
@@ -237,7 +237,7 @@
             <configuration>
               <excludes>
                 <exclude>${target.container.excludes}</exclude>
-                <exclude>org/jboss/test/osgi/example/webapp/**</exclude>
+                <exclude>org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.class</exclude>
               </excludes>
             </configuration>
           </plugin>

Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml	2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml	2009-10-23 05:59:57 UTC (rev 95465)
@@ -29,6 +29,7 @@
         <include>*:org.apache.felix.configadmin:jar</include>
         <include>*:org.apache.felix.log:jar</include>
         <include>*:org.apache.felix.metatype:jar</include>
+        <include>*:pax-web-extender-war:jar</include>
         <include>*:pax-web-jetty-bundle:jar</include>
       </includes>
       <useStrictFiltering>true</useStrictFiltering>

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java	2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java	2009-10-23 05:59:57 UTC (rev 95465)
@@ -58,11 +58,8 @@
    @AfterClass
    public static void tearDownClass() throws Exception
    {
-      if (runtime != null)
-      {
-         runtime.shutdown();
-         runtime = null;
-      }
+      runtime.shutdown();
+      runtime = null;
    }
 
    @Test
@@ -70,7 +67,7 @@
    {
       OSGiBundle bundle = runtime.installBundle("example-jmx.jar");
       bundle.start();
-      
+
       FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, MBEAN_NAME, runtime.getMBeanServer());
       assertEquals("hello", foo.echo("hello"));
    }

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java	2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java	2009-10-23 05:59:57 UTC (rev 95465)
@@ -57,11 +57,8 @@
    @AfterClass
    public static void tearDownClass() throws Exception
    {
-      if (runtime != null)
-      {
-         runtime.shutdown();
-         runtime = null;
-      }
+      runtime.shutdown();
+      runtime = null;
    }
 
    @Test
@@ -69,7 +66,7 @@
    {
       OSGiBundle bundle = runtime.installBundle("example-jndi.jar");
       bundle.start();
-      
+
       InitialContext iniCtx = runtime.getInitialContext();
       String lookup = (String)iniCtx.lookup("test/Foo");
       assertEquals("JNDI bound String expected", "Bar", lookup);

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java	2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java	2009-10-23 05:59:57 UTC (rev 95465)
@@ -57,7 +57,7 @@
       runtime.addCapability(new JMXCapability());
       runtime.addCapability(new XMLBindingCapability());
       runtime.addCapability(new MicrocontainerCapability());
-      
+
       OSGiBundle bundleA = runtime.installBundle("example-mcservice-bundleA.jar");
       bundleA.start();
    }
@@ -65,11 +65,8 @@
    @AfterClass
    public static void tearDownClass() throws Exception
    {
-      if (runtime != null)
-      {
-         runtime.shutdown();
-         runtime = null;
-      }
+      runtime.shutdown();
+      runtime = null;
    }
 
    @Test

Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java (from rev 95426, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.java	2009-10-23 05:59:57 UTC (rev 95465)
@@ -0,0 +1,118 @@
+/*
+ * 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;
+
+//$Id:$
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.spi.capability.HttpServiceCapability;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * A test that deployes a WAR bundle 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 06-Oct-2009
+ */
+public class WebAppExtenderTestCase extends OSGiTest
+{
+   private static OSGiRuntime runtime;
+
+   @BeforeClass
+   public static void setUpClass() throws Exception
+   {
+      OSGiTestHelper osgiTestHelper = new OSGiTestHelper();
+
+      runtime = osgiTestHelper.getDefaultRuntime();
+      runtime.addCapability(new HttpServiceCapability());
+
+      runtime.installBundle("bundles/pax-web-extender-war.jar").start();
+
+      runtime.installBundle("example-webapp.war").start();
+   }
+
+   @AfterClass
+   public static void tearDownClass() throws Exception
+   {
+      runtime.shutdown();
+      runtime = null;
+   }
+
+   @Test
+   public void testResourceAccess() throws Exception
+   {
+      assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
+   }
+
+   @Test
+   public void testServletAccess() throws Exception
+   {
+      assertEquals("Hello from Servlet", getHttpResponse("/servlet?test=plain"));
+   }
+
+   @Test
+   public void testServletInitProps() throws Exception
+   {
+      assertEquals("initProp=SomeValue", getHttpResponse("/servlet?test=initProp"));
+   }
+
+   // Due to the nature of asynchronous event processing by the 
+   // extender pattern, we cannot assume that the endpoint is
+   // available immediately
+   private String getHttpResponse(String reqPath) throws Exception
+   {
+      String line = null;
+      IOException lastException = null;
+      URL url = new URL("http://" + runtime.getServerHost() + ":8090/example-webapp" + reqPath);
+
+      int timeout = 25;
+      while (line == null && 0 < timeout--)
+      {
+         Thread.sleep(200);
+         try
+         {
+            BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+            line = br.readLine();
+         }
+         catch (IOException ex)
+         {
+            lastException = ex;
+         }
+      }
+
+      if (line == null && lastException != null)
+         throw lastException;
+
+      return line;
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java (from rev 95426, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppInterceptorTestCase.java	2009-10-23 05:59:57 UTC (rev 95465)
@@ -0,0 +1,97 @@
+/*
+ * 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;
+
+// $Id: $
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.testing.OSGiBundle;
+import org.jboss.osgi.testing.OSGiRuntime;
+import org.jboss.osgi.testing.OSGiTest;
+import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.webapp.WebAppCapability;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * A test that deployes a WAR bundle 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 06-Oct-2009
+ */
+public class WebAppInterceptorTestCase extends OSGiTest
+{
+   private static OSGiRuntime runtime;
+
+   @BeforeClass
+   public static void setUpClass() throws Exception
+   {
+      OSGiTestHelper osgiTestHelper = new OSGiTestHelper();
+
+      runtime = osgiTestHelper.getDefaultRuntime();
+      runtime.addCapability(new WebAppCapability());
+
+      OSGiBundle bundle = runtime.installBundle("example-webapp.war");
+      bundle.start();
+   }
+
+   @AfterClass
+   public static void tearDownClass() throws Exception
+   {
+      runtime.shutdown();
+      runtime = null;
+   }
+
+   @Test
+   public void testResourceAccess() throws Exception
+   {
+      assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
+   }
+
+   @Test
+   public void testServletAccess() throws Exception
+   {
+      assertEquals("Hello from Servlet", getHttpResponse("/servlet?test=plain"));
+   }
+
+   @Test
+   public void testServletInitProps() throws Exception
+   {
+      assertEquals("initProp=SomeValue", getHttpResponse("/servlet?test=initProp"));
+   }
+
+   private String getHttpResponse(String reqPath) throws Exception
+   {
+      URL url = new URL("http://" + runtime.getServerHost() + ":8090/example-webapp" + reqPath);
+
+      BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+      String line = br.readLine();
+
+      return line;
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java	2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java	2009-10-23 05:59:57 UTC (rev 95465)
@@ -1,115 +0,0 @@
-/*
- * 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;
-
-//$Id:$
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import org.jboss.osgi.testing.OSGiBundle;
-import org.jboss.osgi.testing.OSGiRuntime;
-import org.jboss.osgi.testing.OSGiTest;
-import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.webapp.WebAppCapability;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * A test that deployes a WAR bundle 
- * 
- * @author thomas.diesler at jboss.com
- * @since 06-Oct-2009
- */
-public class WebAppTestCase extends OSGiTest
-{
-   private static OSGiRuntime runtime;
-
-   @BeforeClass
-   public static void setUpClass() throws Exception
-   {
-      OSGiTestHelper osgiTestHelper = new OSGiTestHelper();
-
-      runtime = osgiTestHelper.getDefaultRuntime();
-      runtime.addCapability(new WebAppCapability());
-
-      OSGiBundle bundle = runtime.installBundle("example-webapp.war");
-      bundle.start();
-   }
-
-   @AfterClass
-   public static void tearDownClass() throws Exception
-   {
-      runtime.shutdown();
-      runtime = null;
-   }
-
-   @Test
-   public void testResourceAccess() throws Exception
-   {
-      assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
-   }
-
-   @Test
-   public void testServletAccess() throws Exception
-   {
-      assertEquals("Hello from Servlet", getHttpResponse("/servlet?test=plain"));
-   }
-
-   @Test
-   public void testServletInitProps() throws Exception
-   {
-      assertEquals("initProp=SomeValue", getHttpResponse("/servlet?test=initProp"));
-   }
-
-   private String getHttpResponse(String reqPath) throws Exception
-   {
-      URL url = new URL("http://" + runtime.getServerHost() + ":8090/example-webapp" + reqPath);
-
-      int timeout = 40;
-      String line = null;
-      IOException lastException = null;
-      while (line == null && 0 < timeout--)
-      {
-         Thread.sleep(500);
-         try
-         {
-            BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
-            line = br.readLine();
-         }
-         catch (IOException ex)
-         {
-            lastException = ex;
-         }
-      }
-
-      if (line == null && lastException != null)
-         throw lastException;
-
-      return line;
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml	2009-10-23 05:56:57 UTC (rev 95464)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml	2009-10-23 05:59:57 UTC (rev 95465)
@@ -141,6 +141,11 @@
     <!-- OPS4J -->
     <dependency>
       <groupId>org.ops4j.pax.web</groupId>
+      <artifactId>pax-web-extender-war</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.web</groupId>
       <artifactId>pax-web-jetty-bundle</artifactId>
       <scope>provided</scope>
     </dependency>




More information about the jboss-cvs-commits mailing list