felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1045200 - in /felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test: recipes/resolver.b001.bnd recipes/resolver.b002.bnd recipes/resolver.b003.bnd src/org/apache/felix/framework/test/TestResolver.java
Date Mon, 13 Dec 2010 15:55:58 GMT
Author: rickhall
Date: Mon Dec 13 15:55:57 2010
New Revision: 1045200

URL: http://svn.apache.org/viewvc?rev=1045200&view=rev
Log:
Modify resolver tests to verify that substitutable exported packages for already
resolved bundles are properly calculated during uses constraint verification.

Modified:
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b001.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b002.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b003.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestResolver.java

Modified: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b001.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b001.bnd?rev=1045200&r1=1045199&r2=1045200&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b001.bnd
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b001.bnd
Mon Dec 13 15:55:57 2010
@@ -1,3 +1,4 @@
 Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b001
 Private-Package: org.apache.felix.framework.test.resolver.b001
-Import-Package: foo,bar,baz
+Export-Package: bar; uses:="foo", foo
+Include-Resource: bar/resource.txt; literal="BAR", foo/resource.txt; literal="FOO"

Modified: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b002.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b002.bnd?rev=1045200&r1=1045199&r2=1045200&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b002.bnd
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b002.bnd
Mon Dec 13 15:55:57 2010
@@ -1,5 +1,5 @@
 Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b002
 Private-Package: org.apache.felix.framework.test.resolver.b002
 -removeheaders : Import-Package
-Export-Package: bar; uses:="foo", foo
-Include-Resource: bar/resource.txt; literal="BAR", foo/resource.txt; literal="FOO"
+Export-Package: baz; uses:="foo", foo
+Include-Resource: baz/resource.txt; literal="BAZ", foo/resource.txt; literal="FOO"

Modified: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b003.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b003.bnd?rev=1045200&r1=1045199&r2=1045200&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b003.bnd
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b003.bnd
Mon Dec 13 15:55:57 2010
@@ -1,5 +1,3 @@
 Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b003
 Private-Package: org.apache.felix.framework.test.resolver.b003
--removeheaders : Import-Package
-Export-Package: baz; uses:="foo", foo
-Include-Resource: baz/resource.txt; literal="BAZ", foo/resource.txt; literal="FOO"
+Import-Package: foo,bar,baz

Modified: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestResolver.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestResolver.java?rev=1045200&r1=1045199&r2=1045200&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestResolver.java
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestResolver.java
Mon Dec 13 15:55:57 2010
@@ -35,12 +35,13 @@ public class TestResolver extends FelixT
     {
         InputStream is = null;
 
-        // Scenario
+        // Scenario #1
         //
-        // Install b1, b2, and b3. Bundle b1 imports foo, bar, and baz.
-        // Bundle b2 exports bar and foo, where bar uses foo. Bundle b3
-        // exports baz and foo, where baz uses foo. This means it should
-        // be impossible to resolve b1.
+        // Install b1, b2, and b3. Bundle b1 substitutably exports bar and foo
+        // where bar uses foo. Bundle b2 exports baz and foo, where baz uses foo.
+        // Bundle b3 imports foo, bar, and baz. With all bundles in INSTALLED
+        // state, try to start b3, which should succeed since b1 will wire to b2
+        // for foo.
 
         try
         {
@@ -53,8 +54,48 @@ public class TestResolver extends FelixT
 
             try
             {
+                m_bundleC.start();
+            }
+            catch (BundleException ex)
+            {
+                fail("Bundle should resolve and start.");
+            }
+        }
+        finally
+        {
+            cleanup();
+        }
+
+        // Scenario #2
+        //
+        // Install b1, b2, and b3. Bundle b1 substitutably exports bar and foo
+        // where bar uses foo. Bundle b2 exports baz and foo, where baz uses foo.
+        // Bundle b3 imports foo, bar, and baz. First try to resolve b1, which
+        // should succeed by exporting its two packages. Then trying to start
+        // b3, which should fail because of a uses conflict with foo between
+        // bundles b1 and b2.
+
+        try
+        {
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b001.jar");
+            m_bundleA = getBundleContext().installBundle("resolver.b001.jar", is);
+            try
+            {
                 m_bundleA.start();
-                throw new Exception("Bundle should not resolve!");
+            }
+            catch (BundleException ex)
+            {
+                fail("Bundle should resolve and start.");
+            }
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b002.jar");
+            m_bundleB = getBundleContext().installBundle("resolver.b002.jar", is);
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b003.jar");
+            m_bundleC = getBundleContext().installBundle("resolver.b003.jar", is);
+
+            try
+            {
+                m_bundleC.start();
+                fail("Bundle should not resolve!");
             }
             catch (BundleException ex)
             {



Mime
View raw message