felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r799414 - 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/b008/ src/org/apache/felix/framework/test/resolver/b009/ src/org/ap...
Date Thu, 30 Jul 2009 19:20:21 GMT
Author: rickhall
Date: Thu Jul 30 19:20:20 2009
New Revision: 799414

URL: http://svn.apache.org/viewvc?rev=799414&view=rev
Log:
Add test case for detecting broken cycles. (FELIX-1422)

Added:
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b008.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b009.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b010.bnd
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b008/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b008/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/p1/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/p1/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/p2/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/p2/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b010/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b010/Placeholder.java
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b010/p1/
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b010/p1/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=799414&r1=799413&r2=799414&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 Thu Jul 30 19:20:20
2009
@@ -3,7 +3,8 @@
  classloading.b1.jar, classloading.b2.jar, classloading.b3.jar, \
  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.b005.jar, resolver.b006.jar, resolver.b007.jar, resolver.b008.jar, \
+ resolver.b009.jar, resolver.b010.jar, \
  fragment.b1.jar, fragment.b2.jar, fragment.b3.jar, \
  fragment.b4.jar, fragment.b5.jar, \
  fragment.b6.jar, fragment.b7.jar, fragment.b8.jar, \

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b008.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b008.bnd?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b008.bnd
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b008.bnd
Thu Jul 30 19:20:20 2009
@@ -0,0 +1,5 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b008
+Private-Package: org.apache.felix.framework.test.resolver.b008
+Import-Package: \
+ org.apache.felix.framework.test.resolver.b010.p1, \
+ org.apache.felix.framework.test.resolver.b009.p1;resolution:="optional"

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b009.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b009.bnd?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b009.bnd
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b009.bnd
Thu Jul 30 19:20:20 2009
@@ -0,0 +1,4 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b009
+Private-Package: org.apache.felix.framework.test.resolver.b009
+Export-Package: org.apache.felix.framework.test.resolver.b009.p1,org.apache.felix.framework.test.resolver.b009.p2
+Import-Package: org.apache.felix.framework.test.resolver.b010.p1,org.apache.felix.framework.test.resolver.b010.p2

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b010.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b010.bnd?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b010.bnd
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/recipes/resolver.b010.bnd
Thu Jul 30 19:20:20 2009
@@ -0,0 +1,4 @@
+Bundle-SymbolicName: org.apache.felix.framework.test.resolver.b010
+Private-Package: org.apache.felix.framework.test.resolver.b010
+Export-Package: org.apache.felix.framework.test.resolver.b010.p1
+Import-Package: org.apache.felix.framework.test.resolver.b009.p2

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=799414&r1=799413&r2=799414&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
Thu Jul 30 19:20:20 2009
@@ -44,11 +44,11 @@
         try
         {
             is = this.getClass().getClassLoader().getResourceAsStream("resolver.b001.jar");
-            m_bundleA = getBundleContext().installBundle("resolver.b1.jar", is);
+            m_bundleA = getBundleContext().installBundle("resolver.b001.jar", is);
             is = this.getClass().getClassLoader().getResourceAsStream("resolver.b002.jar");
-            m_bundleB = getBundleContext().installBundle("resolver.b2.jar", is);
+            m_bundleB = getBundleContext().installBundle("resolver.b002.jar", is);
             is = this.getClass().getClassLoader().getResourceAsStream("resolver.b003.jar");
-            m_bundleC = getBundleContext().installBundle("resolver.b3.jar", is);
+            m_bundleC = getBundleContext().installBundle("resolver.b003.jar", is);
 
             try
             {
@@ -80,9 +80,9 @@
         try
         {
             is = this.getClass().getClassLoader().getResourceAsStream("resolver.b006.jar");
-            m_bundleA = getBundleContext().installBundle("resolver.b6.jar", is);
+            m_bundleA = getBundleContext().installBundle("resolver.b006.jar", is);
             is = this.getClass().getClassLoader().getResourceAsStream("resolver.b007.jar");
-            m_bundleB = getBundleContext().installBundle("resolver.b7.jar", is);
+            m_bundleB = getBundleContext().installBundle("resolver.b007.jar", is);
 
             m_bundleA.start();
 
@@ -125,7 +125,7 @@
         try
         {
             is = this.getClass().getClassLoader().getResourceAsStream("resolver.b004.jar");
-            m_bundleA = getBundleContext().installBundle("resolver.b4.jar", is);
+            m_bundleA = getBundleContext().installBundle("resolver.b004.jar", is);
 
             m_bundleA.start();
 
@@ -150,7 +150,7 @@
             // Install a system bundle extension that exports Felix
             // framework package.
             is = this.getClass().getClassLoader().getResourceAsStream("resolver.b005.jar");
-            m_bundleB = getBundleContext().installBundle("resolver.b5.jar", is);
+            m_bundleB = getBundleContext().installBundle("resolver.b005.jar", is);
             // Now attempt to load the framework class, which should succeed.
             m_bundleA.loadClass("org.apache.felix.framework.Felix");
         }
@@ -160,6 +160,53 @@
         }
     }
 
+    public void testResolverBrokenCycles() throws Exception
+    {
+        InputStream is = null;
+
+        // Scenario
+        //
+        // Bundle 8 has an optional import on bundle 9 and a mandatory import
+        // on bundle 10. Bundle 9 has an import on bundle 10 and for a package
+        // that doesn't exist, while bundle 10 has a cyclical import on 9.
+        // During the resolving process, bundle 10 will assume bundle 9 can
+        // resolve to break the cycle, but since bundle 10 cannot resolve the
+        // resolver must clean up after the assumption, which means that bundle
+        // 10 can no longer resolver as well.
+
+        // NOTE: This test case is dependent upon the order in which the packages
+        // are resolved; the resolver must try to resolve bundle 8's import for
+        // bundle 9 before its import for bundle 10, otherwise it won't test the
+        // correct issue.
+
+        try
+        {
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b008.jar");
+            m_bundleA = getBundleContext().installBundle("resolver.b008.jar", is);
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b009.jar");
+            m_bundleB = getBundleContext().installBundle("resolver.b009.jar", is);
+            is = this.getClass().getClassLoader().getResourceAsStream("resolver.b010.jar");
+            m_bundleC = getBundleContext().installBundle("resolver.b010.jar", is);
+
+            try
+            {
+                m_bundleA.start();
+                assertTrue("Bundle should not resolve.", false);
+            }
+            catch (BundleException ex)
+            {
+                // We expect a bundle exception, since the bundle should not
+                // resolve.
+            }
+            // Verify the bundle's state is still resolved.
+            assertEquals("Bundle state should be installed.", Bundle.INSTALLED, m_bundleA.getState());
+        }
+        finally
+        {
+            cleanup();
+        }
+    }
+
     private void cleanup()
     {
         if (m_bundleA != null)

Added: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b008/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/b008/Placeholder.java?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b008/Placeholder.java
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b008/Placeholder.java
Thu Jul 30 19:20:20 2009
@@ -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.b008;
+
+/**
+ * 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/b009/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/b009/Placeholder.java?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/Placeholder.java
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/Placeholder.java
Thu Jul 30 19:20:20 2009
@@ -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.b009;
+
+/**
+ * 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/b009/p1/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/b009/p1/Placeholder.java?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/p1/Placeholder.java
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/p1/Placeholder.java
Thu Jul 30 19:20:20 2009
@@ -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.b009.p1;
+
+/**
+ * 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/b009/p2/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/b009/p2/Placeholder.java?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/p2/Placeholder.java
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b009/p2/Placeholder.java
Thu Jul 30 19:20:20 2009
@@ -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.b009.p2;
+
+/**
+ * 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/b010/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/b010/Placeholder.java?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b010/Placeholder.java
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b010/Placeholder.java
Thu Jul 30 19:20:20 2009
@@ -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.b010;
+
+/**
+ * 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/b010/p1/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/b010/p1/Placeholder.java?rev=799414&view=auto
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b010/p1/Placeholder.java
(added)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/resolver/b010/p1/Placeholder.java
Thu Jul 30 19:20:20 2009
@@ -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.b010.p1;
+
+/**
+ * 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



Mime
View raw message