This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch bugfix/treat-config-and-install-similarly in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git
commit 6bb0afa8350157004c857172543593e0600ae82d Author: Konrad Windszus <[email protected]> AuthorDate: Mon Apr 12 12:20:50 2021 +0200 SLING-10278 allow configurations below "install" and bundles below "config" --- .../handlers/AbstractConfigurationEntryHandler.java | 2 +- .../cpconverter/handlers/BundleEntryHandler.java | 2 +- .../cpconverter/handlers/BundleEntryHandlerTest.java | 3 ++- .../handlers/ConfigurationEntryHandlerTest.java | 2 ++ .../apps/asd/config.publish/test-framework.jar | Bin 0 -> 13288 bytes ...erviceusermapping.impl.ServiceUserMapperImpl.config | 17 +++++++++++++++++ 6 files changed, 23 insertions(+), 3 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 22bb540..30c3b2d 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 @@ -44,7 +44,7 @@ abstract class AbstractConfigurationEntryHandler extends AbstractRegexEntryHandl private boolean enforceServiceMappingByPrincipal; public AbstractConfigurationEntryHandler(@NotNull String extension) { - super("/jcr_root/(?:apps|libs)/.+/config(\\.(?<runmode>[^/]+))?/(?<pid>.*)\\." + extension); + super("/jcr_root/(?:apps|libs)/.+/(?:config|install)(\\.(?<runmode>[^/]+))?/(?<pid>.*)\\." + extension); } void setEnforceServiceMappingByPrincipal(boolean enforceServiceMappingByPrincipal) { diff --git a/src/main/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandler.java b/src/main/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandler.java index 43ee7fb..44f2aac 100644 --- a/src/main/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandler.java +++ b/src/main/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandler.java @@ -63,7 +63,7 @@ public final class BundleEntryHandler extends AbstractRegexEntryHandler { private final Pattern pomXmlPropertiesPattern = Pattern.compile("META-INF/maven/[^/]+/[^/]+/pom.xml"); public BundleEntryHandler() { - super("/jcr_root/(?:apps|libs)/.+/install(?:\\.([^/]+))?/(?:([0-9]+)/)?.+\\.jar"); + super("/jcr_root/(?:apps|libs)/.+/(?:install|config)(?:\\.([^/]+))?/(?:([0-9]+)/)?.+\\.jar"); } @Override diff --git a/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandlerTest.java b/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandlerTest.java index 949eb66..28d1e86 100644 --- a/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandlerTest.java +++ b/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandlerTest.java @@ -142,7 +142,8 @@ public final class BundleEntryHandlerTest { { "/jcr_root/apps/asd/install/9/test-framework.jar", bundleEntryHandler, 9 }, { "/jcr_root/apps/asd/install.author/test-framework.jar", bundleEntryHandler, 20 }, { "/jcr_root/apps/asd/install.author/9/test-framework.jar", bundleEntryHandler, 9 }, - { "/jcr_root/apps/asd/install.publish/test-framework.jar", bundleEntryHandler, 20 } + { "/jcr_root/apps/asd/install.publish/test-framework.jar", bundleEntryHandler, 20 }, + { "/jcr_root/apps/asd/config.publish/test-framework.jar", bundleEntryHandler, 20 } }); } diff --git a/src/test/java/org/apache/sling/feature/cpconverter/handlers/ConfigurationEntryHandlerTest.java b/src/test/java/org/apache/sling/feature/cpconverter/handlers/ConfigurationEntryHandlerTest.java index 849f259..447b389 100644 --- a/src/test/java/org/apache/sling/feature/cpconverter/handlers/ConfigurationEntryHandlerTest.java +++ b/src/test/java/org/apache/sling/feature/cpconverter/handlers/ConfigurationEntryHandlerTest.java @@ -226,6 +226,8 @@ public class ConfigurationEntryHandlerTest { //test typed config { TYPED_TESTCONFIG_PATH, 1, 6, 3, new XmlConfigurationEntryHandler(), null, true }, + // configuration in "install" folder + { "/jcr_root/apps/asd/install.publish/" + EXPECTED_PID + ".config", 1, 2, 3, new ConfigurationEntryHandler(), "publish", false }, }); } diff --git a/src/test/resources/org/apache/sling/feature/cpconverter/handlers/jcr_root/apps/asd/config.publish/test-framework.jar b/src/test/resources/org/apache/sling/feature/cpconverter/handlers/jcr_root/apps/asd/config.publish/test-framework.jar new file mode 100644 index 0000000..9ce022d Binary files /dev/null and b/src/test/resources/org/apache/sling/feature/cpconverter/handlers/jcr_root/apps/asd/config.publish/test-framework.jar differ diff --git a/src/test/resources/org/apache/sling/feature/cpconverter/handlers/jcr_root/apps/asd/install.publish/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.config b/src/test/resources/org/apache/sling/feature/cpconverter/handlers/jcr_root/apps/asd/install.publish/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.config new file mode 100644 index 0000000..fc60138 --- /dev/null +++ b/src/test/resources/org/apache/sling/feature/cpconverter/handlers/jcr_root/apps/asd/install.publish/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.config @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to You under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +user.default="admin" +user.mapping=["org.apache.sling.testbundle:sub-service-1\=service1","org.apache.sling.testbundle:sub-service-2\=[service1,service2]","org.apache.sling.testbundle\=org.apache.sling.testbundle\=[service1,external-service-user]"]
