Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 49998 invoked from network); 13 Dec 2010 15:56:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Dec 2010 15:56:26 -0000 Received: (qmail 32141 invoked by uid 500); 13 Dec 2010 15:56:26 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 32048 invoked by uid 500); 13 Dec 2010 15:56:23 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 32037 invoked by uid 99); 13 Dec 2010 15:56:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Dec 2010 15:56:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Dec 2010 15:56:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6541723888CF; Mon, 13 Dec 2010 15:55:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@felix.apache.org From: rickhall@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101213155558.6541723888CF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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) {