karlpauls closed pull request #5: SLING-8092 - using relocation to workaround the relocation issue of M… URL: https://github.com/apache/sling-org-apache-sling-feature-extension-content/pull/5
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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 boolean handle(Extension extension, LauncherPrepareContext prepareContext 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 void testMultipleStartOrders() throws Exception { 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 = ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services