felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r915380 - in /felix/trunk/bundlerepository/src/test: java/org/apache/felix/bundlerepository/ResolverImplTest.java resources/repo_for_optional_resources.xml
Date Tue, 23 Feb 2010 15:22:17 GMT
Author: gnodet
Date: Tue Feb 23 15:22:17 2010
New Revision: 915380

URL: http://svn.apache.org/viewvc?rev=915380&view=rev
Log:
FELIX-2126: add a test case

Added:
    felix/trunk/bundlerepository/src/test/resources/repo_for_optional_resources.xml
Modified:
    felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java

Modified: felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java?rev=915380&r1=915379&r2=915380&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java
(original)
+++ felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java
Tue Feb 23 15:22:17 2010
@@ -98,6 +98,19 @@
         }
     }
 
+    public void testOptionalResolution() throws Exception
+    {
+        RepositoryAdminImpl repoAdmin = createRepositoryAdmin();
+        repoAdmin.addRepository(getClass().getResource("/repo_for_optional_resources.xml"));
+
+        Resolver resolver = repoAdmin.resolver();
+        resolver.add(repoAdmin.requirement("bundle", "(symbolicname=res1)"));
+
+        assertTrue(resolver.resolve());
+        assertEquals(1, resolver.getRequiredResources().length);
+        assertEquals(2, resolver.getOptionalResources().length);
+    }
+
     public static void main(String[] args) throws Exception
     {
         new ResolverImplTest().testReferral1();

Added: felix/trunk/bundlerepository/src/test/resources/repo_for_optional_resources.xml
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/test/resources/repo_for_optional_resources.xml?rev=915380&view=auto
==============================================================================
--- felix/trunk/bundlerepository/src/test/resources/repo_for_optional_resources.xml (added)
+++ felix/trunk/bundlerepository/src/test/resources/repo_for_optional_resources.xml Tue Feb
23 15:22:17 2010
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<repository lastmodified="2010" name="repo_for_optional_resources">
+
+    <resource id="res1">
+        <capability name="bundle">
+            <p n="symbolicname" v="res1" />
+        </capability>
+        <require filter="(package=org.package.res2)" name="package" optional="true" />
+    </resource>
+
+    <resource id="res2">
+        <capability name="package">
+            <p n="package" v="org.package.res2" />
+        </capability>
+        <require filter="(package=org.package.res3)" name="package" optional="false" />
+    </resource>
+
+    <resource id="res3">
+        <capability name="package">
+            <p n="package" v="org.package.res3" />
+        </capability>
+    </resource>
+
+</repository>



Mime
View raw message