You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/05/02 10:14:13 UTC
[sling-org-apache-sling-feature-cpconverter] branch master updated:
SLING-8383 - Syntax incorrect for Factory configurations on conversion with
content-package converter
This is an automated email from the ASF dual-hosted git repository.
simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git
The following commit(s) were added to refs/heads/master by this push:
new c06dd91 SLING-8383 - Syntax incorrect for Factory configurations on conversion with content-package converter
c06dd91 is described below
commit c06dd911b0449bc71e90f42b96b06e76c19ef44f
Author: stripodi <st...@simos-mbp>
AuthorDate: Thu May 2 12:12:02 2019 +0200
SLING-8383 - Syntax incorrect for Factory configurations on conversion
with content-package converter
---
.../handlers/AbstractConfigurationEntryHandler.java | 17 ++++++++++++++---
.../ContentPackage2FeatureModelConverterTest.java | 8 ++++----
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java b/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java
index e53a54a..49d348b 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java
@@ -34,11 +34,22 @@ abstract class AbstractConfigurationEntryHandler extends AbstractRegexEntryHandl
public final void handle(String path, Archive archive, Entry entry, ContentPackage2FeatureModelConverter converter) throws Exception {
String pid = entry.getName().substring(0, entry.getName().lastIndexOf('.'));
- logger.info("Processing configuration '{}'.", pid);
+ String id;
+ int n = pid.indexOf('~');
+ if (n == -1) {
+ n = pid.indexOf('-');
+ }
+ if (n > 0) {
+ id = pid.substring(0, n).concat("~").concat(pid.substring(n + 1));
+ } else {
+ id = pid;
+ }
+
+ logger.info("Processing configuration '{}'.", id);
Dictionary<String, Object> configurationProperties;
try (InputStream input = archive.openInputStream(entry)) {
- configurationProperties = parseConfiguration(pid, input);
+ configurationProperties = parseConfiguration(id, input);
}
if (configurationProperties == null) {
@@ -66,7 +77,7 @@ abstract class AbstractConfigurationEntryHandler extends AbstractRegexEntryHandl
+ "' but it does not, currently");
}
- converter.addConfiguration(runMode, pid, configurationProperties);
+ converter.addConfiguration(runMode, id, configurationProperties);
}
protected abstract Dictionary<String, Object> parseConfiguration(String name, InputStream input) throws Exception;
diff --git a/src/test/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverterTest.java b/src/test/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverterTest.java
index 5eae872..b924a4c 100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverterTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverterTest.java
@@ -134,7 +134,7 @@ public class ContentPackage2FeatureModelConverterTest {
"asd.retail.all.json",
"asd.sample:asd.retail.all:slingosgifeature:0.0.1",
Arrays.asList("org.apache.felix:org.apache.felix.framework:6.0.1"),
- Arrays.asList("org.apache.sling.commons.log.LogManager.factory.config-asd-retail"),
+ Arrays.asList("org.apache.sling.commons.log.LogManager.factory.config~asd-retail"),
Arrays.asList("asd.sample:asd.retail.all:zip:cp2fm-converted:0.0.1"));
verifyFeatureFile(outputDirectory,
"asd.retail.all-author.json",
@@ -146,7 +146,7 @@ public class ContentPackage2FeatureModelConverterTest {
"asd.retail.all-publish.json",
"asd.sample:asd.retail.all:slingosgifeature:publish:0.0.1",
Arrays.asList("org.apache.sling:org.apache.sling.models.api:1.3.8"),
- Arrays.asList("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-asd-retail"),
+ Arrays.asList("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~asd-retail"),
Collections.emptyList());
// verify the runmode.mapper integrity
@@ -297,7 +297,7 @@ public class ContentPackage2FeatureModelConverterTest {
"asd.retail.all.json",
"${project.groupId}:${project.artifactId}:slingosgifeature:asd.test.all-1.0.0:${project.version}",
Arrays.asList("org.apache.felix:org.apache.felix.framework:6.0.1"),
- Arrays.asList("org.apache.sling.commons.log.LogManager.factory.config-asd-retail"),
+ Arrays.asList("org.apache.sling.commons.log.LogManager.factory.config~asd-retail"),
Arrays.asList("asd.sample:asd.retail.all:zip:cp2fm-converted:0.0.1"));
verifyFeatureFile(outputDirectory,
"asd.retail.all-author.json",
@@ -309,7 +309,7 @@ public class ContentPackage2FeatureModelConverterTest {
"asd.retail.all-publish.json",
"${project.groupId}:${project.artifactId}:slingosgifeature:asd.test.all-1.0.0-publish:${project.version}",
Arrays.asList("org.apache.sling:org.apache.sling.models.api:1.3.8"),
- Arrays.asList("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-asd-retail"),
+ Arrays.asList("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~asd-retail"),
Collections.emptyList());
ZipFile zipFile = new ZipFile(new File(outputDirectory, "asd/sample/asd.retail.all/0.0.1/asd.retail.all-0.0.1-cp2fm-converted.zip"));