felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1731668 - in /felix/trunk/bundlerepository/src: main/java/org/apache/felix/bundlerepository/impl/SpecXMLPullParser.java test/java/org/apache/felix/bundlerepository/impl/ResolverImplTest.java test/resources/spec_repository.xml
Date Mon, 22 Feb 2016 16:04:10 GMT
Author: rickhall
Date: Mon Feb 22 16:04:10 2016
New Revision: 1731668

URL: http://svn.apache.org/viewvc?rev=1731668&view=rev
Log:
Applied patches (FELIX-5189) to fix improper parsing of capabilities.

Modified:
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/SpecXMLPullParser.java
    felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/ResolverImplTest.java
    felix/trunk/bundlerepository/src/test/resources/spec_repository.xml

Modified: felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/SpecXMLPullParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/SpecXMLPullParser.java?rev=1731668&r1=1731667&r2=1731668&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/SpecXMLPullParser.java
(original)
+++ felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/SpecXMLPullParser.java
Mon Feb 22 16:04:10 2016
@@ -150,7 +150,7 @@ public class SpecXMLPullParser
 
         for (Map.Entry<String, Object> entry : attributes.entrySet())
         {
-            capability.addProperty(new FelixPropertyAdapter(entry.getKey(), entry.getValue()));
+            capability.addProperty(new FelixPropertyAdapter(NamespaceTranslator.getFelixNamespace(entry.getKey()),
entry.getValue()));
         }
         for (Map.Entry<String, String> entry : directives.entrySet())
         {

Modified: felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/ResolverImplTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/ResolverImplTest.java?rev=1731668&r1=1731667&r2=1731668&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/ResolverImplTest.java
(original)
+++ felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/ResolverImplTest.java
Mon Feb 22 16:04:10 2016
@@ -56,6 +56,29 @@ public class ResolverImplTest extends Te
         assertTrue(resolver.resolve());
     }
 
+    public void testSpec() throws Exception
+    {
+        URL url = getClass().getResource("/spec_repository.xml");
+        RepositoryAdminImpl repoAdmin = createRepositoryAdmin();
+        RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url);
+
+        System.out.println(repo.getResources().length + " Resources in Repo");
+
+        Resolver resolver = repoAdmin.resolver();
+
+        RequirementImpl requirement = new RequirementImpl("foo");
+        requirement.setFilter("(bar=toast)");
+
+        Requirement[] requirements = { requirement };
+
+        Resource[] discoverResources = repoAdmin.discoverResources(requirements);
+        assertNotNull(discoverResources);
+        assertEquals(1, discoverResources.length);
+
+        resolver.add(discoverResources[0]);
+        assertTrue("Resolver could not resolve", resolver.resolve());
+    }
+
     public void testMatchingReq() throws Exception
     {
         RepositoryAdminImpl repoAdmin = createRepositoryAdmin();

Modified: felix/trunk/bundlerepository/src/test/resources/spec_repository.xml
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/test/resources/spec_repository.xml?rev=1731668&r1=1731667&r2=1731668&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/test/resources/spec_repository.xml (original)
+++ felix/trunk/bundlerepository/src/test/resources/spec_repository.xml Mon Feb 22 16:04:10
2016
@@ -34,6 +34,15 @@
     <capability namespace='foo'>
       <attribute name='bar' value='toast'/>
     </capability>
+    <capability namespace='osgi.wiring.package'>
+      <attribute name='osgi.wiring.package' value='com.foo'/>
+      <attribute name='version' type='Version' value='1.0.0'/>
+      <attribute name='bundle-symbolic-name' value='org.apache.felix.bundlerepository.test_file_3'/>
+      <attribute name='bundle-version' type='Version' value='1.2.3.something'/>
+    </capability>
+    <requirement namespace='osgi.wiring.package'>
+      <directive name='filter' value='(osgi.wiring.package=com.foo)'/>
+    </requirement>
   </resource>
   <resource>
     <capability namespace='osgi.identity'>



Mime
View raw message