Skip to content

Commit

Permalink
SLING-11865 - Conversion fails when initial content document does not…
Browse files Browse the repository at this point in the history
… include namespace declaration

Added failing test
  • Loading branch information
rombert committed May 8, 2023
1 parent c157341 commit 90bb795
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,30 @@ public void testSlingInitialContentContainingConfigurationExtractAndKeep() throw
"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 {
Expand Down

0 comments on commit 90bb795

Please sign in to comment.