You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2018/07/09 15:25:13 UTC

[sling-whiteboard] branch master updated: Update API whitelister to the current Features service API

This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 21e5736  Update API whitelister to the current Features service API
21e5736 is described below

commit 21e57367c0279be8e0df7f54c38b5ad8141b9063
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Mon Jul 9 16:24:40 2018 +0100

    Update API whitelister to the current Features service API
---
 featuremodel/feature-whitelist/pom.xml                           | 6 ------
 .../apache/sling/feature/whitelist/impl/ResolverHookImpl.java    | 7 +++----
 .../sling/feature/whitelist/impl/ResolverHookImplTest.java       | 9 ++-------
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/featuremodel/feature-whitelist/pom.xml b/featuremodel/feature-whitelist/pom.xml
index 05648d9..ef59d00 100644
--- a/featuremodel/feature-whitelist/pom.xml
+++ b/featuremodel/feature-whitelist/pom.xml
@@ -59,12 +59,6 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.feature</artifactId>
-            <version>0.1.3-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature.service</artifactId>
             <version>0.0.1-SNAPSHOT</version>
             <scope>provided</scope>
diff --git a/featuremodel/feature-whitelist/src/main/java/org/apache/sling/feature/whitelist/impl/ResolverHookImpl.java b/featuremodel/feature-whitelist/src/main/java/org/apache/sling/feature/whitelist/impl/ResolverHookImpl.java
index 97da602..21a737a 100644
--- a/featuremodel/feature-whitelist/src/main/java/org/apache/sling/feature/whitelist/impl/ResolverHookImpl.java
+++ b/featuremodel/feature-whitelist/src/main/java/org/apache/sling/feature/whitelist/impl/ResolverHookImpl.java
@@ -18,7 +18,6 @@
  */
 package org.apache.sling.feature.whitelist.impl;
 
-import org.apache.sling.feature.Feature;
 import org.apache.sling.feature.service.Features;
 import org.apache.sling.feature.whitelist.WhitelistService;
 import org.osgi.framework.hooks.resolver.ResolverHook;
@@ -71,8 +70,8 @@ class ResolverHookImpl implements ResolverHook {
                 return;
             }
 
-            Feature reqFeat = fs.getFeatureForBundle(reqBundleID);
-            Set<String> regions = whitelistService.listRegions(reqFeat.getId().toMvnId());
+            String reqFeat = fs.getFeatureForBundle(reqBundleID);
+            Set<String> regions = whitelistService.listRegions(reqFeat);
 
             nextCapability:
             for (Iterator<BundleCapability> it = candidates.iterator(); it.hasNext(); ) {
@@ -85,7 +84,7 @@ class ResolverHookImpl implements ResolverHook {
                 if (capBundleID == reqBundleID)
                     continue nextCapability;
 
-                Feature capFeat = fs.getFeatureForBundle(capBundleID);
+                String capFeat = fs.getFeatureForBundle(capBundleID);
 
                 // Within a single feature everything can wire to everything else
                 if (reqFeat.equals(capFeat))
diff --git a/featuremodel/feature-whitelist/src/test/java/org/apache/sling/feature/whitelist/impl/ResolverHookImplTest.java b/featuremodel/feature-whitelist/src/test/java/org/apache/sling/feature/whitelist/impl/ResolverHookImplTest.java
index 7ef0489..eb36749 100644
--- a/featuremodel/feature-whitelist/src/test/java/org/apache/sling/feature/whitelist/impl/ResolverHookImplTest.java
+++ b/featuremodel/feature-whitelist/src/test/java/org/apache/sling/feature/whitelist/impl/ResolverHookImplTest.java
@@ -18,8 +18,6 @@
  */
 package org.apache.sling.feature.whitelist.impl;
 
-import org.apache.sling.feature.ArtifactId;
-import org.apache.sling.feature.Feature;
 import org.apache.sling.feature.service.Features;
 import org.apache.sling.feature.whitelist.WhitelistService;
 import org.junit.Test;
@@ -48,11 +46,8 @@ public class ResolverHookImplTest {
     @SuppressWarnings({ "rawtypes", "unchecked" })
     @Test
     public void testFilterMatches() throws Exception {
-        ArtifactId fid = new ArtifactId("gid", "aid", "0.0.9", null, null);
-        Feature f = new Feature(fid);
-
-        ArtifactId fid2 = new ArtifactId("gid2", "aid2", "1.0.0-SNAPSHOT", null, null);
-        Feature f2 = new Feature(fid2);
+        String f = "gid:aid:0.0.9";
+        String f2 = "gid2:aid2:1.0.0-SNAPSHOT";
 
         Features fs = Mockito.mock(Features.class);
         Mockito.when(fs.getFeatureForBundle(7)).thenReturn(f);