FELIX-2126: add a test case

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@915380 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java b/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java
index dd3a706..2f0aafe 100644
--- a/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java
+++ b/bundlerepository/src/test/java/org/apache/felix/bundlerepository/ResolverImplTest.java
@@ -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();
diff --git a/bundlerepository/src/test/resources/repo_for_optional_resources.xml b/bundlerepository/src/test/resources/repo_for_optional_resources.xml
new file mode 100644
index 0000000..b747a3e
--- /dev/null
+++ b/bundlerepository/src/test/resources/repo_for_optional_resources.xml
@@ -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>