felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1685100 - in /felix/trunk/resolver/src: main/java/org/apache/felix/resolver/ResolverImpl.java main/java/org/apache/felix/resolver/WrappedResource.java test/java/org/apache/felix/resolver/test/FELIX_4914_Test.java
Date Fri, 12 Jun 2015 15:10:01 GMT
Author: gnodet
Date: Fri Jun 12 15:10:01 2015
New Revision: 1685100

URL: http://svn.apache.org/r1685100
Log:
[FELIX-4914] Resolution problem with fragments and identity requirements

Modified:
    felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
    felix/trunk/resolver/src/main/java/org/apache/felix/resolver/WrappedResource.java
    felix/trunk/resolver/src/test/java/org/apache/felix/resolver/test/FELIX_4914_Test.java

Modified: felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java?rev=1685100&r1=1685099&r2=1685100&view=diff
==============================================================================
--- felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java (original)
+++ felix/trunk/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java Fri Jun
12 15:10:01 2015
@@ -1798,32 +1798,20 @@ public class ResolverImpl implements Res
                         if (!cand.getNamespace().startsWith("osgi.wiring.")
                             || !resource.equals(cand.getResource()))
                         {
-                            // If we don't already have wires for the candidate,
-                            // then recursively populate them.
-                            if (!rc.getWirings().containsKey(cand.getResource()))
-                            {
-                                // Need to special case the candidate for identity
-                                // capabilities since it may be from a fragment and
-                                // we don't want to populate wires for the fragment,
-                                // but rather the host to which it is attached.
-                                Resource targetCand = cand.getResource();
-                                if (IdentityNamespace.IDENTITY_NAMESPACE.equals(cand.getNamespace())
-                                    && Util.isFragment(targetCand))
-                                {
-                                    targetCand = allCandidates.getFirstCandidate(
-                                            targetCand.getRequirements(HostNamespace.HOST_NAMESPACE).get(0))
-                                            .getResource();
-                                    targetCand = allCandidates.getWrappedHost(targetCand);
-                                }
-
-                                populateWireMap(rc, targetCand,
+                            // Populate wires for the candidate
+                            populateWireMap(rc, cand.getResource(),
                                     resourcePkgMap, wireMap, allCandidates);
-                            }
 
+                            Resource provider;
+                            if (req.getNamespace().equals(IdentityNamespace.IDENTITY_NAMESPACE))
{
+                                provider = getDeclaredCapability(cand).getResource();
+                            } else {
+                                provider = getDeclaredResource(cand.getResource());
+                            }
                             Wire wire = new WireImpl(
                                 unwrappedResource,
                                 getDeclaredRequirement(req),
-                                getDeclaredResource(cand.getResource()),
+                                provider,
                                 getDeclaredCapability(cand));
                             if (req.getNamespace().equals(PackageNamespace.PACKAGE_NAMESPACE))
                             {

Modified: felix/trunk/resolver/src/main/java/org/apache/felix/resolver/WrappedResource.java
URL: http://svn.apache.org/viewvc/felix/trunk/resolver/src/main/java/org/apache/felix/resolver/WrappedResource.java?rev=1685100&r1=1685099&r2=1685100&view=diff
==============================================================================
--- felix/trunk/resolver/src/main/java/org/apache/felix/resolver/WrappedResource.java (original)
+++ felix/trunk/resolver/src/main/java/org/apache/felix/resolver/WrappedResource.java Fri
Jun 12 15:10:01 2015
@@ -70,13 +70,7 @@ class WrappedResource implements Resourc
                 {
                     for (Capability cap : fragment.getCapabilities(namespace))
                     {
-                        // Filter out identity capabilities, since they
-                        // are not part of the fragment payload.
-                        if (!cap.getNamespace()
-                            .equals(IdentityNamespace.IDENTITY_NAMESPACE))
-                        {
-                            caps.add(new WrappedCapability(this,  cap));
-                        }
+                        caps.add(new WrappedCapability(this,  cap));
                     }
                 }
             }

Modified: felix/trunk/resolver/src/test/java/org/apache/felix/resolver/test/FELIX_4914_Test.java
URL: http://svn.apache.org/viewvc/felix/trunk/resolver/src/test/java/org/apache/felix/resolver/test/FELIX_4914_Test.java?rev=1685100&r1=1685099&r2=1685100&view=diff
==============================================================================
--- felix/trunk/resolver/src/test/java/org/apache/felix/resolver/test/FELIX_4914_Test.java
(original)
+++ felix/trunk/resolver/src/test/java/org/apache/felix/resolver/test/FELIX_4914_Test.java
Fri Jun 12 15:10:01 2015
@@ -33,7 +33,6 @@ import org.apache.felix.resolver.test.ut
 import org.apache.felix.resolver.test.util.JsonReader;
 import org.apache.felix.resolver.test.util.ResolveContextImpl;
 import org.apache.felix.resolver.test.util.SimpleFilter;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
@@ -47,7 +46,6 @@ import org.osgi.service.resolver.Resolve
 public class FELIX_4914_Test extends TestCase {
 
     @Test
-    @Ignore
     public void testResolution() throws Exception {
         BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/felix-4914.json")));
         Map<String, Object> resolution = (Map<String, Object>) JsonReader.read(reader);



Mime
View raw message