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 2020/10/29 11:16:57 UTC

[sling-org-apache-sling-feature] branch master updated: SLING-9860 When merging artifacts with the ALL strategy, incorrect feature-origin metadata is recorded

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-org-apache-sling-feature.git


The following commit(s) were added to refs/heads/master by this push:
     new 244c1cf  SLING-9860 When merging artifacts with the ALL strategy, incorrect feature-origin metadata is recorded
     new 7d7bf8a  Merge pull request #22 from bosschaert/feature-origins-bug
244c1cf is described below

commit 244c1cf2dd499dfedb03d8cc8c5a8383bba17ba5
Author: David Bosschaert <bo...@adobe.com>
AuthorDate: Wed Oct 28 15:25:51 2020 +0000

    SLING-9860 When merging artifacts with the ALL strategy, incorrect feature-origin metadata is recorded
    
    When merging with the ALL strategy, don't add the feature-origins from the
    source feature to the existing artifacts in the target feature.
---
 src/main/java/org/apache/sling/feature/builder/BuilderUtil.java     | 2 +-
 .../java/org/apache/sling/feature/builder/FeatureBuilderTest.java   | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/builder/BuilderUtil.java b/src/main/java/org/apache/sling/feature/builder/BuilderUtil.java
index 4d02111..9298f36 100644
--- a/src/main/java/org/apache/sling/feature/builder/BuilderUtil.java
+++ b/src/main/java/org/apache/sling/feature/builder/BuilderUtil.java
@@ -241,7 +241,7 @@ class BuilderUtil {
                     String rule = override.getVersion();
 
                     if (BuilderContext.VERSION_OVERRIDE_ALL.equalsIgnoreCase(rule)) {
-                        result.add(addFeatureOrigin(fromTarget, source, fromSource, fromTarget));
+                        result.add(fromTarget);
                         result.add(fromSource);
                     } else if (BuilderContext.VERSION_OVERRIDE_HIGHEST.equalsIgnoreCase(rule)) {
                         Version a1v = fromTarget.getId().getOSGiVersion();
diff --git a/src/test/java/org/apache/sling/feature/builder/FeatureBuilderTest.java b/src/test/java/org/apache/sling/feature/builder/FeatureBuilderTest.java
index 9e8357a..d58d472 100644
--- a/src/test/java/org/apache/sling/feature/builder/FeatureBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/builder/FeatureBuilderTest.java
@@ -230,10 +230,8 @@ public class FeatureBuilderTest {
 
         ab = new Feature(ArtifactId.fromMvnId("g:ab:1"));
         for (Artifact bundle : a.getBundles()) {
-            ab.getBundles()
-                    .add(BuilderUtilTest.createBundle(bundle.getId().toMvnId(), bundle.getStartOrder(),
-                            new AbstractMap.SimpleEntry<>(Artifact.KEY_FEATURE_ORIGINS,
-                                    a.getId() + "," + b.getId())));
+            ab.getBundles().add(BuilderUtilTest.createBundle(bundle.getId().toMvnId(), bundle.getStartOrder(),
+                    new AbstractMap.SimpleEntry<>(Artifact.KEY_FEATURE_ORIGINS, a.getId().toMvnId())));
         }
         for (Artifact bundle : b.getBundles()) {
             ab.getBundles().add(BuilderUtilTest.createBundle(bundle.getId().toMvnId(), bundle.getStartOrder(),