[jboss-osgi-commits] JBoss-OSGI SVN: r94469 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk: src/main/java/org/jboss/osgi/framework/bundle and 7 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Wed Oct 7 12:38:30 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-10-07 12:38:30 -0400 (Wed, 07 Oct 2009)
New Revision: 94469

Added:
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/BundleClassPathTest.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/EndpointServlet.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/bundleclasspath/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTest.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTest.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/message.txt
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/web.xml
Removed:
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTestCase.java
Modified:
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/antrun-test-jars.xml
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
Log:
[JBOSGI-162] Cannot load classes from Bundle-ClassPath
Add a test

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/antrun-test-jars.xml	2009-10-07 16:18:59 UTC (rev 94468)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/scripts/antrun-test-jars.xml	2009-10-07 16:38:30 UTC (rev 94469)
@@ -42,6 +42,18 @@
 
     <!-- Please add alphabetically -->
 
+    <!-- bundle-classpath -->
+    <war destfile="${tests.output.dir}/test-libs/bundle-classpath.war"
+      manifest="${tests.resources.dir}/classloading/bundleclasspath/MANIFEST.MF"
+      webxml="${tests.resources.dir}/classloading/bundleclasspath/web.xml">
+      <classes dir="${tests.classes.dir}">
+        <include name="**/classloading/EndpointServlet.class"/>
+      </classes>
+      <fileset dir="${tests.resources.dir}/classloading/bundleclasspath">
+        <include name="message.txt"/>
+      </fileset>
+    </war> 
+    
     <!-- simple -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-bundle.jar" files="${tests.resources.dir}/integration/simple/simple.bnd" />
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-logservice-bundle.jar" files="${tests.resources.dir}/integration/simple/simple-logservice.bnd" />

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-10-07 16:18:59 UTC (rev 94468)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-10-07 16:38:30 UTC (rev 94469)
@@ -487,16 +487,16 @@
             throw e;
          }
       }
-      catch (Exception e)
+      catch (Exception ex)
       {
-         Throwable cause = e;
-         if (e instanceof DeploymentException)
+         Throwable cause = ex;
+         if (ex instanceof DeploymentException)
          {
-            cause = e.getCause();
+            cause = ex.getCause();
             if (cause instanceof BundleException)
                throw (BundleException)cause;
          }
-         throw new BundleException("Error installing bundle from location=" + root, cause);
+         throw new BundleException("Error installing bundle from location=" + root, (cause != null ? cause : ex));
       }
    }
 
@@ -834,13 +834,13 @@
          deployerClient.change(name, DeploymentStages.INSTALLED);
          deployerClient.checkComplete(name);
       }
-      catch (DeploymentException e)
+      catch (DeploymentException ex)
       {
-         Throwable cause = e.getCause();
+         Throwable cause = ex.getCause();
          if (cause instanceof BundleException)
             throw (BundleException)cause;
          
-         throw new BundleException("Error starting " + bundleState, cause);
+         throw new BundleException("Error starting " + bundleState, (cause != null ? cause : ex));
       }
    }
 

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/BundleClassPathTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/BundleClassPathTest.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/BundleClassPathTest.java	2009-10-07 16:38:30 UTC (rev 94469)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.classloading;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.util.ServiceLoader;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * BundleClassPathTest.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 07-Oct-2009
+ */
+public class BundleClassPathTest extends OSGiTest
+{
+   @Test
+   public void testBundleClassPath() throws Exception
+   {
+      // Uses the OSGi Framework launch API
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(null);
+      framework.start();
+
+      BundleContext sysContext = framework.getBundleContext();
+      Bundle bundle = sysContext.installBundle(getTestArchivePath("bundle-classpath.war"));
+
+      bundle.start();
+      assertEquals("Bundle state", Bundle.ACTIVE, bundle.getState());
+
+      Class<?> clazz = bundle.loadClass(EndpointServlet.class.getName());
+      assertNotNull("Loaded EndpointServlet", clazz);
+      
+      bundle.uninstall();
+      assertEquals("Bundle state", Bundle.UNINSTALLED, bundle.getState());
+
+      framework.stop();
+   }
+}

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/EndpointServlet.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/EndpointServlet.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloading/EndpointServlet.java	2009-10-07 16:38:30 UTC (rev 94469)
@@ -0,0 +1,27 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.classloading;
+
+
+public class EndpointServlet 
+{
+}

Copied: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTest.java (from rev 94465, projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTest.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTest.java	2009-10-07 16:38:30 UTC (rev 94469)
@@ -0,0 +1,160 @@
+/*
+ * 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.integration.simple;
+
+//$Id$
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.util.ServiceLoader;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * A test that deployes a bundle and verifies its state
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class SimpleLogServiceTest extends OSGiTest
+{
+   @Before
+   public void setUp()
+   {
+      System.clearProperty("simple-logservice-bundle");
+   }
+
+   @Test
+   public void testNoLogService() throws Exception
+   {
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(null);
+      framework.start();
+
+      BundleContext sysContext = framework.getBundleContext();
+      Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
+
+      try
+      {
+         bundle.start();
+         fail("Unresolved package contstraint on [org.osgi.service.log] expected");
+      }
+      catch (BundleException ex)
+      {
+         // expected
+      }
+
+      framework.stop();
+   }
+
+   @Test
+   public void testLogServiceFromThirdParty() throws Exception
+   {
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(null);
+      framework.start();
+
+      BundleContext sysContext = framework.getBundleContext();
+      sysContext.installBundle(getTestArchivePath("bundles/org.apache.felix.log.jar")).start();
+      
+      Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
+      try
+      {
+         bundle.start();
+      }
+      catch (BundleException ex)
+      {
+         // Expected UNRESOLVED OSGiPackageRequirement{org.osgi.util.tracker [0.0.0,?)} with MC Framework
+      }
+
+      assumeTrue(bundle.getState() == Bundle.ACTIVE);
+      
+      // The bundle activator is expected to set this property
+      String result = System.getProperty(bundle.getSymbolicName());
+      assertNotNull("Result property not null", result);
+
+      assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
+      assertFalse("getService", result.indexOf("getService") > 0);
+      assertFalse("addingService", result.indexOf("addingService") > 0);
+      
+      framework.stop();
+   }
+
+   @Test
+   public void testLogServiceFromCompendium() throws Exception
+   {
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(null);
+      framework.start();
+
+      BundleContext sysContext = framework.getBundleContext();
+      sysContext.installBundle(getTestArchivePath("bundles/org.osgi.compendium.jar"));
+      
+      Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
+      bundle.start();
+
+      // The bundle activator is expected to set this property
+      String result = System.getProperty(bundle.getSymbolicName());
+      assertNotNull("Result property not null", result);
+
+      assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
+      assertFalse("getService", result.indexOf("getService") > 0);
+      assertFalse("addingService", result.indexOf("addingService") > 0);
+
+      framework.stop();
+   }
+
+   @Test
+   public void testLogServiceFromTwoExporters() throws Exception
+   {
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(null);
+      framework.start();
+
+      BundleContext sysContext = framework.getBundleContext();
+      sysContext.installBundle(getTestArchivePath("bundles/org.osgi.compendium.jar")).start();
+      sysContext.installBundle(getTestArchivePath("bundles/org.apache.felix.log.jar")).start();
+
+      Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
+      bundle.start();
+
+      // The bundle activator is expected to set this property
+      String result = System.getProperty(bundle.getSymbolicName());
+      assertNotNull("Result property not null", result);
+
+      assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
+      assertTrue("getService", result.indexOf("getService") > 0);
+      assertTrue("addingService", result.indexOf("addingService") > 0);
+
+      framework.stop();
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java	2009-10-07 16:18:59 UTC (rev 94468)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java	2009-10-07 16:38:30 UTC (rev 94469)
@@ -1,160 +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.integration.simple;
-
-//$Id$
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.util.ServiceLoader;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
-
-/**
- * A test that deployes a bundle and verifies its state
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class SimpleLogServiceTestCase extends OSGiTest
-{
-   @Before
-   public void setUp()
-   {
-      System.clearProperty("simple-logservice-bundle");
-   }
-
-   @Test
-   public void testNoLogService() throws Exception
-   {
-      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
-      Framework framework = factory.newFramework(null);
-      framework.start();
-
-      BundleContext sysContext = framework.getBundleContext();
-      Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
-
-      try
-      {
-         bundle.start();
-         fail("Unresolved package contstraint on [org.osgi.service.log] expected");
-      }
-      catch (BundleException ex)
-      {
-         // expected
-      }
-
-      framework.stop();
-   }
-
-   @Test
-   public void testLogServiceFromThirdParty() throws Exception
-   {
-      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
-      Framework framework = factory.newFramework(null);
-      framework.start();
-
-      BundleContext sysContext = framework.getBundleContext();
-      sysContext.installBundle(getTestArchivePath("bundles/org.apache.felix.log.jar")).start();
-      
-      Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
-      try
-      {
-         bundle.start();
-      }
-      catch (BundleException ex)
-      {
-         // Expected UNRESOLVED OSGiPackageRequirement{org.osgi.util.tracker [0.0.0,?)} with MC Framework
-      }
-
-      assumeTrue(bundle.getState() == Bundle.ACTIVE);
-      
-      // The bundle activator is expected to set this property
-      String result = System.getProperty(bundle.getSymbolicName());
-      assertNotNull("Result property not null", result);
-
-      assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
-      assertFalse("getService", result.indexOf("getService") > 0);
-      assertFalse("addingService", result.indexOf("addingService") > 0);
-      
-      framework.stop();
-   }
-
-   @Test
-   public void testLogServiceFromCompendium() throws Exception
-   {
-      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
-      Framework framework = factory.newFramework(null);
-      framework.start();
-
-      BundleContext sysContext = framework.getBundleContext();
-      sysContext.installBundle(getTestArchivePath("bundles/org.osgi.compendium.jar"));
-      
-      Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
-      bundle.start();
-
-      // The bundle activator is expected to set this property
-      String result = System.getProperty(bundle.getSymbolicName());
-      assertNotNull("Result property not null", result);
-
-      assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
-      assertFalse("getService", result.indexOf("getService") > 0);
-      assertFalse("addingService", result.indexOf("addingService") > 0);
-
-      framework.stop();
-   }
-
-   @Test
-   public void testLogServiceFromTwoExporters() throws Exception
-   {
-      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
-      Framework framework = factory.newFramework(null);
-      framework.start();
-
-      BundleContext sysContext = framework.getBundleContext();
-      sysContext.installBundle(getTestArchivePath("bundles/org.osgi.compendium.jar")).start();
-      sysContext.installBundle(getTestArchivePath("bundles/org.apache.felix.log.jar")).start();
-
-      Bundle bundle = sysContext.installBundle(getTestArchivePath("simple-logservice-bundle.jar"));
-      bundle.start();
-
-      // The bundle activator is expected to set this property
-      String result = System.getProperty(bundle.getSymbolicName());
-      assertNotNull("Result property not null", result);
-
-      assertTrue("BundleActivator start", result.indexOf("startBundleActivator") > 0);
-      assertTrue("getService", result.indexOf("getService") > 0);
-      assertTrue("addingService", result.indexOf("addingService") > 0);
-
-      framework.stop();
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTest.java (from rev 94465, projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTestCase.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTest.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTest.java	2009-10-07 16:38:30 UTC (rev 94469)
@@ -0,0 +1,89 @@
+/*
+ * 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.resolver;
+
+// $Id: FrameworkLaunchTestCase.java 92733 2009-08-24 09:40:32Z thomas.diesler at jboss.com $
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.resolver.BundleResolver;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.util.ServiceLoader;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * Test OSGi System bundle access
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 27-Jul-2009
+ */
+public class BundleResolverTest extends OSGiTest
+{
+   @Test
+   public void testBundleResolver() throws BundleException
+   {
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      Framework framework = factory.newFramework(null);
+      framework.start();
+
+      List<String> bundlePaths = new ArrayList<String>();
+      bundlePaths.add("bundles/jboss-osgi-apache-xerces.jar");
+      bundlePaths.add("bundles/jboss-osgi-common.jar");
+      bundlePaths.add("bundles/jboss-osgi-common-core.jar");
+      bundlePaths.add("bundles/jboss-osgi-husky.jar");
+      bundlePaths.add("bundles/jboss-osgi-jaxb.jar");
+      bundlePaths.add("bundles/jboss-osgi-jmx.jar");
+      bundlePaths.add("bundles/jboss-osgi-jndi.jar");
+      bundlePaths.add("bundles/jboss-osgi-xml-binding.jar");
+      bundlePaths.add("bundles/org.apache.felix.configadmin.jar");
+      bundlePaths.add("bundles/org.apache.felix.http.jetty.jar");
+      bundlePaths.add("bundles/org.apache.felix.log.jar");
+      bundlePaths.add("bundles/org.apache.felix.metatype.jar");
+      bundlePaths.add("bundles/org.osgi.compendium.jar");
+      
+      Collections.shuffle(bundlePaths);
+      
+      List<Bundle> unresolved = new ArrayList<Bundle>();
+      BundleContext sysContext = framework.getBundleContext();
+      for (String path : bundlePaths)
+      {
+         Bundle bundle = sysContext.installBundle(getTestArchivePath(path));
+         unresolved.add(bundle);
+      }
+      
+      BundleResolver bundleResolver = new BundleResolver(null);
+      List<OSGiBundleState> resolved = bundleResolver.resolveBundles(unresolved);
+      assertEquals("All bundles resolved", unresolved.size(), resolved.size());
+      
+      framework.stop();
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTestCase.java	2009-10-07 16:18:59 UTC (rev 94468)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/resolver/BundleResolverTestCase.java	2009-10-07 16:38:30 UTC (rev 94469)
@@ -1,90 +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.resolver;
-
-// $Id: FrameworkLaunchTestCase.java 92733 2009-08-24 09:40:32Z thomas.diesler at jboss.com $
-
-import static org.junit.Assert.*;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.osgi.framework.resolver.BundleResolver;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.util.ServiceLoader;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
-
-/**
- * Test OSGi System bundle access
- * 
- * @author thomas.diesler at jboss.com
- * @since 27-Jul-2009
- */
-public class BundleResolverTestCase extends OSGiTest
-{
-   @Test
-   public void testBundleResolver() throws BundleException
-   {
-      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
-      Framework framework = factory.newFramework(null);
-      framework.start();
-
-      List<String> bundlePaths = new ArrayList<String>();
-      bundlePaths.add("bundles/jboss-osgi-apache-xerces.jar");
-      bundlePaths.add("bundles/jboss-osgi-common.jar");
-      bundlePaths.add("bundles/jboss-osgi-common-core.jar");
-      bundlePaths.add("bundles/jboss-osgi-husky.jar");
-      bundlePaths.add("bundles/jboss-osgi-jaxb.jar");
-      bundlePaths.add("bundles/jboss-osgi-jmx.jar");
-      bundlePaths.add("bundles/jboss-osgi-jndi.jar");
-      bundlePaths.add("bundles/jboss-osgi-xml-binding.jar");
-      bundlePaths.add("bundles/org.apache.felix.configadmin.jar");
-      bundlePaths.add("bundles/org.apache.felix.http.jetty.jar");
-      bundlePaths.add("bundles/org.apache.felix.log.jar");
-      bundlePaths.add("bundles/org.apache.felix.metatype.jar");
-      bundlePaths.add("bundles/org.osgi.compendium.jar");
-      
-      Collections.shuffle(bundlePaths);
-      
-      List<Bundle> unresolved = new ArrayList<Bundle>();
-      BundleContext sysContext = framework.getBundleContext();
-      for (String path : bundlePaths)
-      {
-         Bundle bundle = sysContext.installBundle(getTestArchivePath(path));
-         unresolved.add(bundle);
-      }
-      
-      BundleResolver bundleResolver = new BundleResolver(null);
-      List<OSGiBundleState> resolved = bundleResolver.resolveBundles(unresolved);
-      assertEquals("All bundles resolved", unresolved.size(), resolved.size());
-      
-      framework.stop();
-   }
-}
\ No newline at end of file

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/MANIFEST.MF	2009-10-07 16:38:30 UTC (rev 94469)
@@ -0,0 +1,4 @@
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: bundle-classpath
+Bundle-ClassPath: .,WEB-INF/classes
+

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/message.txt
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/message.txt	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/message.txt	2009-10-07 16:38:30 UTC (rev 94469)
@@ -0,0 +1 @@
+Hello from Resource
\ No newline at end of file

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/web.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/web.xml	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/classloading/bundleclasspath/web.xml	2009-10-07 16:38:30 UTC (rev 94469)
@@ -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>servlet</servlet-name>
+    <servlet-class>org.jboss.test.osgi.classloading.EndpointServlet</servlet-class>
+    <init-param>
+      <param-name>initProp</param-name>
+      <param-value>SomeValue</param-value>
+    </init-param>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>servlet</servlet-name>
+    <url-pattern>/servlet</url-pattern>
+  </servlet-mapping>
+
+</web-app>



More information about the jboss-osgi-commits mailing list