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 2019/02/01 16:56:58 UTC

[sling-org-apache-sling-feature-extension-content] 24/46: SLING-8092 - using relocation to workaround the relocation issue of MSHADE-156

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-extension-content.git

commit 31086b6f5f939c91e4a64bff6cd9ab29773f34cf
Author: Dominik Suess <su...@adobe.com>
AuthorDate: Mon Nov 12 11:27:01 2018 +0100

    SLING-8092 - using relocation to workaround the relocation issue of MSHADE-156
---
 pom.xml                                                            | 4 ++++
 .../org/apache/sling/feature/extension/content/ContentHandler.java | 7 ++++---
 .../apache/sling/feature/extension/content/ContentHandlerTest.java | 4 ++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index a9d4c04..dc15f7f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,6 +92,10 @@
                                 <exclude>org.apache.sling.feature.**</exclude>
                               </excludes>
                             </relocation>
+                            <relocation>
+                              <pattern>org.UNSHADE.apache</pattern>
+                              <shadedPattern>org.apache</shadedPattern>
+                            </relocation>
                           </relocations>
                         </configuration>
                     </execution>
diff --git a/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java b/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
index 8f039b7..8986d41 100644
--- a/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
+++ b/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
@@ -119,11 +119,12 @@ public class ContentHandler implements ExtensionHandler {
                 builder.save(baos);
                 executionPlans.add(baos.toString("UTF-8"));
             }
-            final Configuration initcfg = new Configuration("org.apache.sling.jcr.packageinit.impl.ExecutionPlanRepoInitializer");
+            // Workaround for too bold relocation mechanism - corresponding details at https://issues.apache.org/jira/browse/MSHADE-156 
+            final Configuration initcfg = new Configuration("org.UNSHADE.apache.sling.jcr.packageinit.impl.ExecutionPlanRepoInitializer");
             initcfg.getProperties().put("executionplans", executionPlans.toArray(new String[executionPlans.size()]));
             installationContext.addConfiguration(initcfg.getPid(), initcfg.getFactoryPid(), initcfg.getProperties());
-            
-            final Configuration registrycfg = new Configuration("org.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry");
+         // Workaround for too bold relocation mechanism - corresponding details at https://issues.apache.org/jira/browse/MSHADE-156 
+            final Configuration registrycfg = new Configuration("org.UNSHADE.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry");
             registrycfg.getProperties().put("homePath", REGISTRY_FOLDER);
             installationContext.addConfiguration(registrycfg.getPid(), registrycfg.getFactoryPid(), registrycfg.getProperties());;
 
diff --git a/src/test/java/org/apache/sling/feature/extension/content/ContentHandlerTest.java b/src/test/java/org/apache/sling/feature/extension/content/ContentHandlerTest.java
index 3e97c18..06b7cff 100644
--- a/src/test/java/org/apache/sling/feature/extension/content/ContentHandlerTest.java
+++ b/src/test/java/org/apache/sling/feature/extension/content/ContentHandlerTest.java
@@ -105,8 +105,8 @@ public class ContentHandlerTest {
         ArgumentCaptor<Dictionary<String, Object>> executionPlanCaptor = ArgumentCaptor.forClass(Dictionary.class);
         
         ch.handle(ext, prepareContext, installationContext);
-        verify(installationContext).addConfiguration(eq("org.apache.sling.jcr.packageinit.impl.ExecutionPlanRepoInitializer"), any(), executionPlanCaptor.capture());
-        verify(installationContext).addConfiguration(eq("org.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry"), any(), any());
+        verify(installationContext).addConfiguration(eq("org.UNSHADE.apache.sling.jcr.packageinit.impl.ExecutionPlanRepoInitializer"), any(), executionPlanCaptor.capture());
+        verify(installationContext).addConfiguration(eq("org.UNSHADE.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry"), any(), any());
         Iterator<Dictionary<String, Object>> dictIt = executionPlanCaptor.getAllValues().iterator();
         final String[] executionplans = (String[]) dictIt.next().get("executionplans");
         final String expected_0 =