[jboss-cvs] JBossAS SVN: r94645 - in projects/jboss-osgi/trunk/testsuite/example: src/test/java/org/jboss/test/osgi/example/webapp and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Oct 10 18:21:56 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-10 18:21:56 -0400 (Sat, 10 Oct 2009)
New Revision: 94645

Modified:
   projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
   projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java
Log:
OSGi *.war deployments not supported on jbossas less than jboss520

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-10 21:45:59 UTC (rev 94644)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml	2009-10-10 22:21:56 UTC (rev 94645)
@@ -72,6 +72,17 @@
         <include name="message.txt"/>
       </fileset>
     </war> 
+    <!-- OSGi *.war deployments not supported jbossas less than jboss520 -->
+    <war destfile="${tests.output.dir}/test-libs/example-webapp.jar"
+      manifest="${tests.resources.dir}/webapp/MANIFEST.MF"
+      webxml="${tests.resources.dir}/webapp/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" />

Modified: 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-10 21:45:59 UTC (rev 94644)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/webapp/WebAppTestCase.java	2009-10-10 22:21:56 UTC (rev 94645)
@@ -33,6 +33,7 @@
 import org.jboss.osgi.spi.capability.WebAppCapability;
 import org.jboss.osgi.spi.testing.OSGiBundle;
 import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
 import org.jboss.osgi.spi.testing.OSGiTestHelper;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -44,17 +45,27 @@
  * @author thomas.diesler at jboss.com
  * @since 06-Oct-2009
  */
-public class WebAppTestCase
+public class WebAppTestCase extends OSGiTest
 {
    private static OSGiRuntime runtime;
 
    @BeforeClass
    public static void setUpClass() throws Exception
    {
-      runtime = new OSGiTestHelper().getDefaultRuntime();
+      OSGiTestHelper osgiTestHelper = new OSGiTestHelper();
+
+      runtime = osgiTestHelper.getDefaultRuntime();
       runtime.addCapability(new WebAppCapability());
 
-      OSGiBundle bundle = runtime.installBundle("example-webapp.war");
+      OSGiBundle bundle;
+      
+      // OSGi *.war deployments not supported jbossas less than jboss520
+      String targetContainer = osgiTestHelper.getTargetContainer();
+      if ("jboss501".equals(targetContainer) || "jboss510".equals(targetContainer))
+         bundle = runtime.installBundle("example-webapp.jar");
+      else
+         bundle = runtime.installBundle("example-webapp.war");
+      
       bundle.start();
    }
 
@@ -69,7 +80,7 @@
    {
       assertEquals("Hello from Resource", getHttpResponse("/message.txt"));
    }
-   
+
    @Test
    public void testServletAccess() throws Exception
    {
@@ -85,7 +96,7 @@
    private String getHttpResponse(String reqPath) throws Exception
    {
       URL url = new URL("http://" + runtime.getServerHost() + ":8090/example-webapp" + reqPath);
-      
+
       int timeout = 50;
       String line = null;
       IOException lastException = null;
@@ -102,10 +113,10 @@
             Thread.sleep(200);
          }
       }
-      
+
       if (line == null && lastException != null)
          throw lastException;
-      
+
       return line;
    }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list