[jboss-cvs] JBossAS SVN: r92978 - in projects/jboss-osgi/trunk/testsuite/functional: src/test/java/org/jboss/test/osgi and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 28 14:59:12 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-08-28 14:59:12 -0400 (Fri, 28 Aug 2009)
New Revision: 92978

Added:
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/
   projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleA.bnd
   projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleX.bnd
Removed:
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI142TestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleB/
   projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleA.bnd
   projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleB.bnd
   projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleX.bnd
Modified:
   projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleA/BeanA.java
   projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleX/BeanX.java
Log:
[JBOSGI-143] Add initial support for DynamicImport-Package

Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml	2009-08-28 18:55:05 UTC (rev 92977)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml	2009-08-28 18:59:12 UTC (rev 92978)
@@ -20,6 +20,7 @@
  [JBOSGI-108] Investigate statics on PackageAdmin.refresh
  [JBOSGI-112] Investigate Exception in SynchronousBundleListener
  [JBOSGI-142] Investigate classloading space
+ [JBOSGI-143] Investigate DynamicImport-Package
 
 -->
 
@@ -112,6 +113,10 @@
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi142-bundleB.jar" files="${tests.resources.dir}/jbosgi142/jbosgi142-bundleB.bnd" />
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi142-bundleX.jar" files="${tests.resources.dir}/jbosgi142/jbosgi142-bundleX.bnd" />
     
+    <!-- jbosgi143 -->
+    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi143-bundleA.jar" files="${tests.resources.dir}/jbosgi143/jbosgi143-bundleA.bnd" />
+    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi143-bundleX.jar" files="${tests.resources.dir}/jbosgi143/jbosgi143-bundleX.bnd" />
+    
     <!-- startlevel -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/service/startlevel.jar" files="${tests.resources.dir}/service/startlevel/startlevel.bnd" />
 

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java	2009-08-28 18:55:05 UTC (rev 92977)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java	2009-08-28 18:59:12 UTC (rev 92978)
@@ -28,7 +28,6 @@
 
 import org.jboss.osgi.spi.framework.OSGiBootstrap;
 import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.testing.OSGiTest;
 import org.jboss.osgi.spi.testing.OSGiTestHelper;
 import org.jboss.test.osgi.jbosgi142.bundleA.BeanA;
 import org.jboss.test.osgi.jbosgi142.bundleB.BeanB;
@@ -52,7 +51,7 @@
  * @author thomas.diesler at jboss.com
  * @since 28-Aug-2009
  */
-public class OSGI142TestCase extends OSGiTest
+public class OSGI142TestCase
 {
    @Test
    public void testLoadClass() throws Exception
@@ -103,8 +102,9 @@
             assertEquals(message, expClazz.getName(), wasClass.getName());
          }
          else
+         {
             fail("ClassNotFoundException expected for: " + message);
-
+         }
       }
       catch (ClassNotFoundException ex)
       {

Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143 (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142)

Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI142TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java	2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI142TestCase.java	2009-08-28 18:59:12 UTC (rev 92978)
@@ -1,120 +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.jbosgi142;
-
-//$Id: OSGI142TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler at jboss.com $
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestHelper;
-import org.jboss.test.osgi.jbosgi142.bundleA.BeanA;
-import org.jboss.test.osgi.jbosgi142.bundleB.BeanB;
-import org.jboss.test.osgi.jbosgi142.bundleX.BeanX;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-
-/**
- * [JBOSGI-142] Investigate classloading space
- * 
- * https://jira.jboss.org/jira/browse/JBOSGI-142
- * 
- * A imports X
- * B imports X
- * 
- * Can X load a class from A or B?
- * Can A load a class from B and vice versa?
- * 
- * @author thomas.diesler at jboss.com
- * @since 28-Aug-2009
- */
-public class OSGI142TestCase extends OSGiTest
-{
-   @Test
-   public void testLoadClass() throws Exception
-   {
-      OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
-      Framework framework = bootProvider.getFramework();
-      framework.start();
-      
-      BundleContext sysContext = framework.getBundleContext();
-      Bundle bundleX = sysContext.installBundle(getBundleLocation("jbosgi142-bundleX.jar"));
-      bundleX.start();
-      
-      assertBundleLoadClass(bundleX, BeanX.class, true);
-      
-      Bundle bundleA = sysContext.installBundle(getBundleLocation("jbosgi142-bundleA.jar"));
-      bundleA.start();
-      
-      assertBundleLoadClass(bundleA, BeanA.class, true);
-      
-      Bundle bundleB = sysContext.installBundle(getBundleLocation("jbosgi142-bundleB.jar"));
-      bundleB.start();
-      
-      assertBundleLoadClass(bundleB, BeanB.class, true);
-      
-      assertBundleLoadClass(bundleA, BeanX.class, true);
-      assertBundleLoadClass(bundleB, BeanX.class, true);
- 
-      assertBundleLoadClass(bundleX, BeanA.class, false);
-      assertBundleLoadClass(bundleX, BeanB.class, false);
-      
-      assertBundleLoadClass(bundleA, BeanB.class, false);
-      assertBundleLoadClass(bundleB, BeanA.class, false);
-      
-      framework.stop();
-      framework.waitForStop(1000);
-   }
-
-   private void assertBundleLoadClass(Bundle bundle, Class<?> expClazz, boolean success) 
-   {
-      String message = bundle.getSymbolicName() + " loads " + expClazz.getName();
-      
-      Class<?> wasClass;
-      try
-      {
-         wasClass = bundle.loadClass(expClazz.getName());
-         if (success)
-         {
-            assertEquals(message, expClazz.getName(), wasClass.getName());
-         }
-         else
-            fail("ClassNotFoundException expected for: " + message);
-
-      }
-      catch (ClassNotFoundException ex)
-      {
-         if (success)
-            fail("Unexpected ClassNotFoundException for: " + message);
-      }
-   }
-
-   private String getBundleLocation(String jarname)
-   {
-      return new OSGiTestHelper().getTestArchiveURL(jarname).toExternalForm();
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java	2009-08-28 18:59:12 UTC (rev 92978)
@@ -0,0 +1,107 @@
+/*
+ * 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.jbosgi143;
+
+//$Id: OSGI143TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler at jboss.com $
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.test.osgi.jbosgi143.bundleA.BeanA;
+import org.jboss.test.osgi.jbosgi143.bundleX.BeanX;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * [JBOSGI-143] Add initial support for DynamicImport-Package
+ * 
+ * https://jira.jboss.org/jira/browse/JBOSGI-143
+ * 
+ * A imports X
+ * X has DynamicImport-Package: *
+ * 
+ * Can X load a class from A?
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 28-Aug-2009
+ */
+public class OSGI143TestCase
+{
+   @Test
+   public void testLoadClass() throws Exception
+   {
+      OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
+      Framework framework = bootProvider.getFramework();
+      framework.start();
+      
+      BundleContext sysContext = framework.getBundleContext();
+      Bundle bundleX = sysContext.installBundle(getBundleLocation("jbosgi143-bundleX.jar"));
+      bundleX.start();
+      
+      assertBundleLoadClass(bundleX, BeanX.class, true);
+      
+      Bundle bundleA = sysContext.installBundle(getBundleLocation("jbosgi143-bundleA.jar"));
+      bundleA.start();
+      
+      assertBundleLoadClass(bundleA, BeanA.class, true);
+      
+      assertBundleLoadClass(bundleA, BeanX.class, true);
+      assertBundleLoadClass(bundleX, BeanA.class, true);
+      
+      framework.stop();
+      framework.waitForStop(1000);
+   }
+
+   private void assertBundleLoadClass(Bundle bundle, Class<?> expClazz, boolean success) 
+   {
+      String message = bundle.getSymbolicName() + " loads " + expClazz.getName();
+      
+      Class<?> wasClass;
+      try
+      {
+         wasClass = bundle.loadClass(expClazz.getName());
+         if (success)
+         {
+            assertEquals(message, expClazz.getName(), wasClass.getName());
+         }
+         else
+         {
+            fail("ClassNotFoundException expected for: " + message);
+         }
+      }
+      catch (ClassNotFoundException ex)
+      {
+         if (success)
+            fail("Unexpected ClassNotFoundException for: " + message);
+      }
+   }
+
+   private String getBundleLocation(String jarname)
+   {
+      return new OSGiTestHelper().getTestArchiveURL(jarname).toExternalForm();
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleA/BeanA.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/bundleA/BeanA.java	2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleA/BeanA.java	2009-08-28 18:59:12 UTC (rev 92978)
@@ -19,11 +19,11 @@
  * 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.jbosgi142.bundleA;
+package org.jboss.test.osgi.jbosgi143.bundleA;
 
 //$Id: SomePojo.java 85016 2009-03-02 12:12:31Z thomas.diesler at jboss.com $
 
-import org.jboss.test.osgi.jbosgi142.bundleX.BeanX;
+import org.jboss.test.osgi.jbosgi143.bundleX.BeanX;
 
 public class BeanA
 {

Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleX/BeanX.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/bundleX/BeanX.java	2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleX/BeanX.java	2009-08-28 18:59:12 UTC (rev 92978)
@@ -19,7 +19,7 @@
  * 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.jbosgi142.bundleX;
+package org.jboss.test.osgi.jbosgi143.bundleX;
 
 //$Id: SomePojo.java 85016 2009-03-02 12:12:31Z thomas.diesler at jboss.com $
 

Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143 (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142)

Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleA.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleA.bnd	2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleA.bnd	2009-08-28 18:59:12 UTC (rev 92978)
@@ -1,5 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jbosgi142-bundleA.jar src/test/resources/jbosgi142/bundleA.bnd
-
-Bundle-SymbolicName: jbosgi142-bundleA
-Export-Package: org.jboss.test.osgi.jbosgi142.bundleA
-

Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleB.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleB.bnd	2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleB.bnd	2009-08-28 18:59:12 UTC (rev 92978)
@@ -1,5 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jbosgi142-bundleB.jar src/test/resources/jbosgi142/bundleB.bnd
-
-Bundle-SymbolicName: jbosgi142-bundleB
-Export-Package: org.jboss.test.osgi.jbosgi142.bundleB
-

Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleX.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleX.bnd	2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleX.bnd	2009-08-28 18:59:12 UTC (rev 92978)
@@ -1,5 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jbosgi142-bundleX.jar src/test/resources/jbosgi142/bundleX.bnd
-
-Bundle-SymbolicName: jbosgi142-bundleX
-Export-Package: org.jboss.test.osgi.jbosgi142.bundleX
-

Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleA.bnd (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleA.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleA.bnd	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleA.bnd	2009-08-28 18:59:12 UTC (rev 92978)
@@ -0,0 +1,5 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jbosgi143-bundleA.jar src/test/resources/jbosgi143/bundleA.bnd
+
+Bundle-SymbolicName: jbosgi143-bundleA
+Export-Package: org.jboss.test.osgi.jbosgi143.bundleA
+Import-Package: org.jboss.test.osgi.jbosgi143.bundleX

Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleX.bnd (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleX.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleX.bnd	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleX.bnd	2009-08-28 18:59:12 UTC (rev 92978)
@@ -0,0 +1,5 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jbosgi143-bundleX.jar src/test/resources/jbosgi143/bundleX.bnd
+
+Bundle-SymbolicName: jbosgi143-bundleX
+Export-Package: org.jboss.test.osgi.jbosgi143.bundleX
+DynamicImport-Package: *




More information about the jboss-cvs-commits mailing list