felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1195571 - in /felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test: ./ recipes/ src/org/apache/felix/framework/test/ src/org/apache/felix/framework/test/resolver/b019/ src/org/apache/felix/framework/test/resolver/b020/ src/org/a...
Date Mon, 31 Oct 2011 17:20:05 GMT
Author: rickhall
Date: Mon Oct 31 17:20:04 2011
New Revision: 1195571

URL: http://svn.apache.org/viewvc?rev=1195571&view=rev
Log:
Add test case to reproduce resolver NPE in FELIX-3178.

Added:
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b019.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b020.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b021.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b019/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b019/Placeholder.java
      - copied, changed from r1195466, felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b020/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b020/Placeholder.java
      - copied, changed from r1195466, felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b021/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b021/Placeholder.java
      - copied, changed from r1195466, felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java
Modified:
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/bnd.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/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/bnd.bnd?rev=1195571&r1=1195570&r2=1195571&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 Mon Oct 31 17:20:04
2011
@@ -10,7 +10,8 @@ Include-Resource: \
  resolver.b005.jar, resolver.b006.jar, resolver.b007.jar, resolver.b008.jar, \
  resolver.b009.jar, resolver.b010.jar, resolver.b011.jar, resolver.b012.jar, \
  resolver.b013.jar, resolver.b014.jar, resolver.b015.jar, resolver.b016a.jar, \
- resolver.b016b.jar, resolver.b017.jar, resolver.b018.jar, \
+ resolver.b016b.jar, resolver.b017.jar, resolver.b018.jar, resolver.b019.jar, \
+ resolver.b020.jar, resolver.b021.jar, \
  fragment.b001.jar, fragment.b002.jar, fragment.b003.jar, \
  fragment.b004.jar, fragment.b005.jar, \
  fragment.b006.jar, fragment.b007.jar, fragment.b008.jar, \

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b019.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b019.bnd?rev=1195571&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b019.bnd
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b019.bnd
Mon Oct 31 17:20:04 2011
@@ -0,0 +1,3 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b019
+Export-Package: org.apache.felix.framework.test.resolver.b019; -noimport:=true
+

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b020.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b020.bnd?rev=1195571&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b020.bnd
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b020.bnd
Mon Oct 31 17:20:04 2011
@@ -0,0 +1,4 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b020
+Fragment-Host: org.apache.felix.framework.test.resolver.b019
+Export-Package: org.apache.felix.framework.test.resolver.b020; -noimport:= true; uses:="bar",
bar; -noimport:=true
+Include-Resource: bar/resource.txt; literal="BAR"

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b021.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b021.bnd?rev=1195571&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b021.bnd
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b021.bnd
Mon Oct 31 17:20:04 2011
@@ -0,0 +1,2 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b021
+Import-Package: org.apache.felix.framework.test.resolver.b020

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=1195571&r1=1195570&r2=1195571&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 Oct 31 17:20:04 2011
@@ -392,4 +392,100 @@ public class TestResolver extends FelixT
             cleanupBundles();
         }
     }
-}
+
+    public void testFragmentExports() throws Exception
+    {
+        InputStream is = null;
+
+        // Scenario 1
+        //
+        // Bundle 19 is a host bundle, bundle 20 is a fragment bundle that exports
+        // a package that has a uses constraint on another package it exports,
+        // bundle 21 imports the first fragment package with the uses constraint.
+        // Attempt to resolve bundle 21 first.
+        try
+        {
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b019.jar");
+            addBundle("A", getBundleContext().installBundle("resolver.b019.jar", is));
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b020.jar");
+            addBundle("B", getBundleContext().installBundle("resolver.b020.jar", is));
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b021.jar");
+            addBundle("C", getBundleContext().installBundle("resolver.b021.jar", is));
+
+            assertTrue("Bundle should resolve",
+                getPackageAdmin().resolveBundles(new Bundle[] { getBundle("C") }));
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("C").getState());
+
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("A").getState());
+
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("B").getState());
+        }
+        finally
+        {
+            cleanupBundles();
+        }
+
+        // Scenario 2
+        //
+        // Same as above, but try to resolve the host bundle first, then bundle 21.
+        try
+        {
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b019.jar");
+            addBundle("A", getBundleContext().installBundle("resolver.b019.jar", is));
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b020.jar");
+            addBundle("B", getBundleContext().installBundle("resolver.b020.jar", is));
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b021.jar");
+            addBundle("C", getBundleContext().installBundle("resolver.b021.jar", is));
+
+            assertTrue("Bundle should resolve",
+                getPackageAdmin().resolveBundles(new Bundle[] { getBundle("A") }));
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("A").getState());
+
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("B").getState());
+
+            assertTrue("Bundle should resolve",
+                getPackageAdmin().resolveBundles(new Bundle[] { getBundle("C") }));
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("C").getState());
+        }
+        finally
+        {
+            cleanupBundles();
+        }
+
+        // Scenario 3
+        //
+        // Same as above, but try to resolve the fragment bundle first, then bundle 21.
+        try
+        {
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b019.jar");
+            addBundle("A", getBundleContext().installBundle("resolver.b019.jar", is));
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b020.jar");
+            addBundle("B", getBundleContext().installBundle("resolver.b020.jar", is));
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b021.jar");
+            addBundle("C", getBundleContext().installBundle("resolver.b021.jar", is));
+
+            assertTrue("Bundle should resolve",
+                getPackageAdmin().resolveBundles(new Bundle[] { getBundle("B") }));
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("B").getState());
+
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("B").getState());
+
+            assertTrue("Bundle should resolve",
+                getPackageAdmin().resolveBundles(new Bundle[] { getBundle("C") }));
+            assertEquals("Bundle state should be resolved.",
+                Bundle.RESOLVED, getBundle("C").getState());
+        }
+        finally
+        {
+            cleanupBundles();
+        }
+    }
+}
\ No newline at end of file

Copied: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b019/Placeholder.java
(from r1195466, felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b019/Placeholder.java?p2=felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b019/Placeholder.java&p1=felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java&r1=1195466&r2=1195571&rev=1195571&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b019/Placeholder.java
Mon Oct 31 17:20:04 2011
@@ -16,8 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.test.resolver.b018;
+package org.apache.felix.framework.test.resolver.b019;
 
+import org.apache.felix.framework.test.resolver.b018.*;
 import org.apache.felix.framework.test.resolver.b014.*;
 
 /**

Copied: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b020/Placeholder.java
(from r1195466, felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b020/Placeholder.java?p2=felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b020/Placeholder.java&p1=felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java&r1=1195466&r2=1195571&rev=1195571&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b020/Placeholder.java
Mon Oct 31 17:20:04 2011
@@ -16,8 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.test.resolver.b018;
+package org.apache.felix.framework.test.resolver.b020;
 
+import org.apache.felix.framework.test.resolver.b018.*;
 import org.apache.felix.framework.test.resolver.b014.*;
 
 /**

Copied: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b021/Placeholder.java
(from r1195466, felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b021/Placeholder.java?p2=felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b021/Placeholder.java&p1=felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java&r1=1195466&r2=1195571&rev=1195571&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b018/Placeholder.java
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b021/Placeholder.java
Mon Oct 31 17:20:04 2011
@@ -16,8 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.framework.test.resolver.b018;
+package org.apache.felix.framework.test.resolver.b021;
 
+import org.apache.felix.framework.test.resolver.b018.*;
 import org.apache.felix.framework.test.resolver.b014.*;
 
 /**



Mime
View raw message