You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2021/07/01 09:31:10 UTC
[sling-org-apache-sling-feature-extension-apiregions] branch master
updated: SLING-10575: fill empty bundle to feature mappings
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-extension-apiregions.git
The following commit(s) were added to refs/heads/master by this push:
new 66a745b SLING-10575: fill empty bundle to feature mappings
66a745b is described below
commit 66a745b5e4385fb74d6999a9eabae4d1d32195e5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Jul 1 11:30:42 2021 +0200
SLING-10575: fill empty bundle to feature mappings
---
.../apiregions/launcher/LauncherProperties.java | 2 +-
.../launcher/LauncherPropertiesTest.java | 33 ++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/feature/extension/apiregions/launcher/LauncherProperties.java b/src/main/java/org/apache/sling/feature/extension/apiregions/launcher/LauncherProperties.java
index 091450c..9cfc1f7 100644
--- a/src/main/java/org/apache/sling/feature/extension/apiregions/launcher/LauncherProperties.java
+++ b/src/main/java/org/apache/sling/feature/extension/apiregions/launcher/LauncherProperties.java
@@ -90,7 +90,7 @@ public class LauncherProperties
{
features = new HashSet<>();
}
- features.addAll(Arrays.asList(bundle.getFeatureOrigins()));
+ features.addAll(Arrays.asList(bundle.getFeatureOrigins(app.getId())));
return features;
});
}
diff --git a/src/test/java/org/apache/sling/feature/extension/apiregions/launcher/LauncherPropertiesTest.java b/src/test/java/org/apache/sling/feature/extension/apiregions/launcher/LauncherPropertiesTest.java
index 99cea3d..ba2a355 100644
--- a/src/test/java/org/apache/sling/feature/extension/apiregions/launcher/LauncherPropertiesTest.java
+++ b/src/test/java/org/apache/sling/feature/extension/apiregions/launcher/LauncherPropertiesTest.java
@@ -19,6 +19,9 @@ package org.apache.sling.feature.extension.apiregions.launcher;
import java.io.IOException;
import java.util.Properties;
+import org.apache.sling.feature.Artifact;
+import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.Feature;
import org.apache.sling.feature.extension.apiregions.api.ApiRegions;
import org.junit.Assert;
import org.junit.Test;
@@ -61,4 +64,34 @@ public class LauncherPropertiesTest
Assert.assertEquals("region3,region4", properties.getProperty("f:f2:1"));
Assert.assertEquals("region1,region2,region3,region4,region5", properties.getProperty("__region.order__"));
}
+
+ @Test
+ public void testGetBundleIDtoFeaturesMapWithOrigins() {
+ final ArtifactId featureId = ArtifactId.parse("g:f:1");
+ final ArtifactId artifactId = ArtifactId.parse("g:a:2");
+ final ArtifactId originId = ArtifactId.parse("g:o:5");
+
+ final Feature f = new Feature(featureId);
+ final Artifact a = new Artifact(artifactId);
+ a.setFeatureOrigins(originId);
+ f.getBundles().add(a);
+
+ final Properties prop = LauncherProperties.getBundleIDtoFeaturesMap(f);
+ Assert.assertEquals(1, prop.size());
+ Assert.assertEquals(originId.toMvnId(), prop.get(artifactId.toMvnId()));
+ }
+
+ @Test
+ public void testGetBundleIDtoFeaturesMapWithoutOrigins() {
+ final ArtifactId featureId = ArtifactId.parse("g:f:1");
+ final ArtifactId artifactId = ArtifactId.parse("g:a:2");
+
+ final Feature f = new Feature(featureId);
+ final Artifact a = new Artifact(artifactId);
+ f.getBundles().add(a);
+
+ final Properties prop = LauncherProperties.getBundleIDtoFeaturesMap(f);
+ Assert.assertEquals(1, prop.size());
+ Assert.assertEquals(featureId.toMvnId(), prop.get(artifactId.toMvnId()));
+ }
}