felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r800969 - in /felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test: bnd.bnd recipes/fragment.b006.bnd src/org/apache/felix/framework/test/TestFragment.java
Date Tue, 04 Aug 2009 20:56:15 GMT
Author: rickhall
Date: Tue Aug  4 20:56:15 2009
New Revision: 800969

URL: http://svn.apache.org/viewvc?rev=800969&view=rev
Log:
Add test case for a dynamic import on a package exported by a fragment
to verify that unresolved fragments can satisfy dynamic import requests.

Modified:
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/bnd.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/fragment.b006.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestFragment.java

Modified: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/bnd.bnd?rev=800969&r1=800968&r2=800969&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/bnd.bnd (original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/bnd.bnd Tue Aug  4 20:56:15
2009
@@ -17,6 +17,6 @@
 	org.osgi.foundation; version=1.2.0, \
 	junit.junit
 
--runproperties = report=true, felix.fragment.validation=warning
+-runproperties = report=true, felix.log.level=4
 
 Test-Cases = ${classes;extending;*FelixTestCase}

Modified: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/fragment.b006.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/fragment.b006.bnd?rev=800969&r1=800968&r2=800969&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/fragment.b006.bnd
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/fragment.b006.bnd
Tue Aug  4 20:56:15 2009
@@ -3,3 +3,4 @@
 Bundle-Activator: org.apache.felix.framework.test.fragment.b008.Activator
 Export-Package: org.apache.felix.framework.test.fragment.b006
 Import-Package: org.osgi.framework
+DynamicImport-Package: org.apache.felix.framework.test.fragment.b002

Modified: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestFragment.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestFragment.java?rev=800969&r1=800968&r2=800969&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestFragment.java
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestFragment.java
Tue Aug  4 20:56:15 2009
@@ -262,6 +262,35 @@
         {
             cleanup();
         }
+
+        // Scenario #3
+        //
+        // Install and resolve bundle 6, which dynamically imports a package
+        // exported by a fragment. Install the host and fragment bundles, then
+        // try to load a class from bundle 6's dynamically imported package
+        // to see if the fragment is correctly attached to the host.
+        try
+        {
+            is = this.getClass().getClassLoader().getResourceAsStream("fragment.b006.jar");
+            m_bundleA = getBundleContext().installBundle("fragment.b006.jar", is);
+            getPackageAdmin().resolveBundles(new Bundle[] { m_bundleA });
+            is = this.getClass().getClassLoader().getResourceAsStream("fragment.b001.jar");
+            m_bundleB = getBundleContext().installBundle("fragment.b001.jar", is);
+            is = this.getClass().getClassLoader().getResourceAsStream("fragment.b002.jar");
+            m_bundleC = getBundleContext().installBundle("fragment.b002.jar", is);
+            try
+            {
+                Class clazz = m_bundleA.loadClass("org.apache.felix.framework.test.fragment.b002.FragmentClass");
+            }
+            catch (ClassNotFoundException ex)
+            {
+                assertTrue("Fragment class should be visible.", false);
+            }
+        }
+        finally
+        {
+            cleanup();
+        }
     }
 
     public void testFragmentImports() throws Exception



Mime
View raw message