You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by tm...@apache.org on 2021/05/06 08:55:25 UTC

[sling-org-apache-sling-distribution-core] branch SLING-9873-1 created (now a38c4fb)

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

tmaret pushed a change to branch SLING-9873-1
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git.


      at a38c4fb  SLING-9873 - Add test that covers paths with namespaced names

This branch includes the following new commits:

     new a38c4fb  SLING-9873 - Add test that covers paths with namespaced names

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[sling-org-apache-sling-distribution-core] 01/01: SLING-9873 - Add test that covers paths with namespaced names

Posted by tm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tmaret pushed a commit to branch SLING-9873-1
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git

commit a38c4fbb4a4d506239c486bdc39bfca2510278b3
Author: tmaret <tm...@adobe.com>
AuthorDate: Thu May 6 10:55:05 2021 +0200

    SLING-9873 - Add test that covers paths with namespaced names
---
 .../packaging/impl/SimpleDistributionPackageTest.java      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java b/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java
index 5bbe4df..76d1dc1 100644
--- a/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java
+++ b/src/test/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackageTest.java
@@ -21,6 +21,7 @@ package org.apache.sling.distribution.packaging.impl;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.charset.Charset;
 import java.util.Arrays;
 
 import org.apache.commons.io.IOUtils;
@@ -30,8 +31,10 @@ import org.apache.sling.distribution.SimpleDistributionRequest;
 import org.junit.Test;
 import org.mockito.Mockito;
 
+import static org.apache.commons.io.IOUtils.toInputStream;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
@@ -44,6 +47,8 @@ import static org.mockito.Mockito.when;
  */
 public class SimpleDistributionPackageTest {
 
+    private static final String TYPE = "testPackageType";
+
     private static final String DSTRPCK_DELETE = "DSTRPCK::DELETE|/abc:/c";
     private static final String DSTRPCK_ITEM_WITH_COMMA_DELETE = "DSTRPCK::DELETE|/ab,c:/c";
 
@@ -77,6 +82,15 @@ public class SimpleDistributionPackageTest {
     }
 
     @Test
+    public void testPackageWithNamespaceInPath() {
+        DistributionRequest req = new SimpleDistributionRequest(DistributionRequestType.ADD, "/a/jcr:content", "/b");
+        SimpleDistributionPackage pkgOut = new SimpleDistributionPackage(req, TYPE);
+        SimpleDistributionPackage pkgIn = SimpleDistributionPackage.fromStream(toInputStream(pkgOut.toString(), Charset.defaultCharset()), TYPE);
+        assertNotNull(pkgIn);
+        assertArrayEquals(pkgOut.getInfo().getPaths(), pkgIn.getInfo().getPaths());
+    }
+
+    @Test
     public void testCreatedAndReadPackagesEqualityWithCommaInName() throws Exception {
         DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.DELETE, "/ab,c", "/c");
         SimpleDistributionPackage createdPackage = new SimpleDistributionPackage(request, "VOID");