This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch issue/SLING-11865
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git

commit 90bb7957e4a40bd6fa253e856a7027c64f23dd69
Author: Robert Munteanu <[email protected]>
AuthorDate: Mon May 8 15:32:22 2023 +0200

    SLING-11865 - Conversion fails when initial content document does not 
include namespace declaration
    
    Added failing test
---
 .../BundleEntryHandleSlingInitialContentTest.java  | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git 
a/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandleSlingInitialContentTest.java
 
b/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandleSlingInitialContentTest.java
index 3af8484..8547b3a 100644
--- 
a/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandleSlingInitialContentTest.java
+++ 
b/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandleSlingInitialContentTest.java
@@ -606,6 +606,30 @@ public class BundleEntryHandleSlingInitialContentTest 
extends AbstractBundleEntr
                 "com.composum.nodes.pckgmgr",
                 "com.composum.nodes.pckginstall" }, 
(String[])dictionaryCaptor.getValue().get("whitelist.bundles"));
     }
+    
+    @Test
+    public void testSlingInitialContentWithMissingNamespaceDeclaration() 
throws Exception {
+        String embeddedEntryPath = 
"/jcr_root/apps/mysite-packages/application/install/mysite.core-1.0.0-SNAPSHOT.jar";
+        
+        setUpArchive(embeddedEntryPath, "mysite.core-1.0.0-SNAPSHOT.jar");
+        
+        DefaultEntryHandlersManager handlersManager = new 
DefaultEntryHandlersManager();
+        converter.setEntryHandlersManager(handlersManager);
+        
when(converter.isSubContentPackageIncluded(embeddedEntryPath)).thenReturn(true);
+        VaultPackageAssembler assembler = 
Mockito.mock(VaultPackageAssembler.class);
+        Properties props = new Properties();
+        props.setProperty(PackageProperties.NAME_GROUP, "org.apache.sling");
+        props.setProperty(PackageProperties.NAME_NAME, 
"testSlingInitialContentWithMissingNamespaceDeclaration");
+        props.setProperty(PackageProperties.NAME_VERSION, "1.0-SNAPSHOT");
+        when(assembler.getPackageProperties()).thenReturn(props);
+        converter.setMainPackageAssembler(assembler);
+        converter.setAclManager(new DefaultAclManager());
+        BundleSlingInitialContentExtractor extractor = new 
BundleSlingInitialContentExtractor();
+
+        handler.setBundleSlingInitialContentExtractor(extractor);
+        
handler.setSlingInitialContentPolicy(SlingInitialContentPolicy.EXTRACT_AND_KEEP);
+        handler.handle(embeddedEntryPath, archive, entry, converter);
+    }
 
     @Test
     public void testSlingInitialContentEscapingPropertyValues() throws 
Exception {

Reply via email to