You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2010/04/02 16:06:27 UTC

svn commit: r930273 - 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/b011/ src/org/apache/felix/framework/test/resolver/b012/ src/org/ap...

Author: rickhall
Date: Fri Apr  2 14:06:26 2010
New Revision: 930273

URL: http://svn.apache.org/viewvc?rev=930273&view=rev
Log:
Add test for duplicate exports.

Added:
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.mf
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b012.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b013.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b014.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b011/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b011/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b012/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b012/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b013/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b013/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b014/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b014/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=930273&r1=930272&r2=930273&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 Fri Apr  2 14:06:26 2010
@@ -7,7 +7,8 @@ Include-Resource: \
  concurrency.b1.jar, \
  resolver.b001.jar, resolver.b002.jar, resolver.b003.jar, resolver.b004.jar, \
  resolver.b005.jar, resolver.b006.jar, resolver.b007.jar, resolver.b008.jar, \
- resolver.b009.jar, resolver.b010.jar, \
+ resolver.b009.jar, resolver.b010.jar, resolver.b011.jar, resolver.b012.jar, \
+ resolver.b013.jar, resolver.b014.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.b011.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.bnd?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.bnd (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.bnd Fri Apr  2 14:06:26 2010
@@ -0,0 +1,3 @@
+-nomanifest=true
+Include-Resource: META-INF/MANIFEST.MF=recipes/resolver.b011.mf
+Private-Package: org.apache.felix.framework.test.resolver.b011

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.mf
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.mf?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.mf (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b011.mf Fri Apr  2 14:06:26 2010
@@ -0,0 +1,5 @@
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b011
+Export-Package: org.apache.felix.framework.test.resolver.b011;-noimport:=true;attr=first,
+ org.apache.felix.framework.test.resolver.b011;-noimport:=true;attr=second
+

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b012.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b012.bnd?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b012.bnd (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b012.bnd Fri Apr  2 14:06:26 2010
@@ -0,0 +1,5 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b012
+Private-Package: org.apache.felix.framework.test.resolver.b012
+Export-Package: org.apache.felix.framework.test.resolver.b012; \
+ -noimport:=true;uses:="org.apache.felix.framework.resolver.b011"
+Import-Package: org.apache.felix.framework.test.resolver.b011; attr=first

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b013.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b013.bnd?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b013.bnd (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b013.bnd Fri Apr  2 14:06:26 2010
@@ -0,0 +1,5 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b013
+Private-Package: org.apache.felix.framework.test.resolver.b013
+Export-Package: org.apache.felix.framework.test.resolver.b013; \
+ -noimport:=true;uses:="org.apache.felix.framework.resolver.b011"
+Import-Package: org.apache.felix.framework.test.resolver.b011; attr=second

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b014.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b014.bnd?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b014.bnd (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b014.bnd Fri Apr  2 14:06:26 2010
@@ -0,0 +1,4 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b014
+Private-Package: org.apache.felix.framework.test.resolver.b014
+Import-Package: org.apache.felix.framework.test.resolver.b012, \
+ org.apache.felix.framework.test.resolver.b013

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=930273&r1=930272&r2=930273&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 Fri Apr  2 14:06:26 2010
@@ -29,6 +29,7 @@ public class TestResolver extends FelixT
     private Bundle m_bundleA = null;
     private Bundle m_bundleB = null;
     private Bundle m_bundleC = null;
+    private Bundle m_bundleD = null;
 
     public void testResolverUses() throws Exception
     {
@@ -207,6 +208,45 @@ public class TestResolver extends FelixT
         }
     }
 
+    public void testDuplicateExports() throws Exception
+    {
+        InputStream is = null;
+
+        // Scenario
+        //
+        // Bundle 11 exports the same package more than once with different attributes.
+        // Bundle 12 exports a package that uses one of bundle 11's duplicate exports
+        // and bundle 13 exports a package that uses the other. Bundle 14 imports both
+        // packages from bundles 12 and 13, which even though they each use a different
+        // package it should not create a conflict since they are both from bundle 11.
+        try
+        {
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b011.jar");
+            m_bundleA = getBundleContext().installBundle("resolver.b011.jar", is);
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b012.jar");
+            m_bundleB = getBundleContext().installBundle("resolver.b012.jar", is);
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b013.jar");
+            m_bundleC = getBundleContext().installBundle("resolver.b013.jar", is);
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b014.jar");
+            m_bundleD = getBundleContext().installBundle("resolver.b014.jar", is);
+
+            try
+            {
+                m_bundleD.start();
+            }
+            catch (BundleException ex)
+            {
+                assertTrue("Bundle should resolve: " + ex, false);
+            }
+            // Verify the bundle's state is active.
+            assertEquals("Bundle state should be active.", Bundle.ACTIVE, m_bundleD.getState());
+        }
+        finally
+        {
+            cleanup();
+        }
+    }
+
     private void cleanup()
     {
         if (m_bundleA != null)
@@ -245,6 +285,18 @@ public class TestResolver extends FelixT
             }
             m_bundleC = null;
         }
+        if (m_bundleD != null)
+        {
+            try
+            {
+                m_bundleD.uninstall();
+            }
+            catch (Exception ex)
+            {
+                // Ummm?
+            }
+            m_bundleD = null;
+        }
         refreshAndWait();
     }
 }

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b011/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/b011/Placeholder.java?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b011/Placeholder.java (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b011/Placeholder.java Fri Apr  2 14:06:26 2010
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.framework.test.resolver.b011;
+
+/**
+ * Currently, there are no classes for this test case; this class just
+ * serves as a placeholder to make the package naming explicit for the
+ * example bundles that only contain metadata and to eliminate some
+ * warnings from BND.
+**/
+public class Placeholder
+{
+
+}
\ No newline at end of file

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b012/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/b012/Placeholder.java?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b012/Placeholder.java (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b012/Placeholder.java Fri Apr  2 14:06:26 2010
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.framework.test.resolver.b012;
+
+/**
+ * Currently, there are no classes for this test case; this class just
+ * serves as a placeholder to make the package naming explicit for the
+ * example bundles that only contain metadata and to eliminate some
+ * warnings from BND.
+**/
+public class Placeholder
+{
+
+}
\ No newline at end of file

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b013/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/b013/Placeholder.java?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b013/Placeholder.java (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b013/Placeholder.java Fri Apr  2 14:06:26 2010
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.framework.test.resolver.b013;
+
+/**
+ * Currently, there are no classes for this test case; this class just
+ * serves as a placeholder to make the package naming explicit for the
+ * example bundles that only contain metadata and to eliminate some
+ * warnings from BND.
+**/
+public class Placeholder
+{
+
+}
\ No newline at end of file

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b014/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/b014/Placeholder.java?rev=930273&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b014/Placeholder.java (added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b014/Placeholder.java Fri Apr  2 14:06:26 2010
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.framework.test.resolver.b014;
+
+/**
+ * Currently, there are no classes for this test case; this class just
+ * serves as a placeholder to make the package naming explicit for the
+ * example bundles that only contain metadata and to eliminate some
+ * warnings from BND.
+**/
+public class Placeholder
+{
+
+}
\ No newline at end of file