You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2022/01/20 18:25:38 UTC

[sling-org-apache-sling-repoinit-parser] branch SLING-11078 created (now 0ee646d)

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

dklco pushed a change to branch SLING-11078
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git.


      at 0ee646d  SLING-11078 - Adding JavaDocs to describe the Operation.asRepoInitString() contract and validate line separate compliance

This branch includes the following new commits:

     new 4b632e9  SLING-11078 - Fixing regression in DeleteGroup where line separater no longer aded to asRepoInitString()
     new 0ee646d  SLING-11078 - Adding JavaDocs to describe the Operation.asRepoInitString() contract and validate line separate compliance

The 2 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-repoinit-parser] 01/02: SLING-11078 - Fixing regression in DeleteGroup where line separater no longer aded to asRepoInitString()

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

dklco pushed a commit to branch SLING-11078
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit 4b632e9b6ec1a4ea52ba2079681982376ff26c08
Author: Dan Klco <kl...@adobe.com>
AuthorDate: Thu Jan 20 13:23:26 2022 -0500

    SLING-11078 - Fixing regression in DeleteGroup where line separater no longer aded to asRepoInitString()
---
 .../java/org/apache/sling/repoinit/parser/operations/DeleteGroup.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/DeleteGroup.java b/src/main/java/org/apache/sling/repoinit/parser/operations/DeleteGroup.java
index 3fc1d85..690cd4f 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/DeleteGroup.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/DeleteGroup.java
@@ -47,7 +47,7 @@ public class DeleteGroup extends Operation {
     @NotNull
     @Override
     public String asRepoInitString() {
-        return String.format("delete group %s", QuotableStringUtil.forRepoInitString(groupname));
+        return String.format("delete group %s%n", QuotableStringUtil.forRepoInitString(groupname));
     }
 
     public String getGroupname() {

[sling-org-apache-sling-repoinit-parser] 02/02: SLING-11078 - Adding JavaDocs to describe the Operation.asRepoInitString() contract and validate line separate compliance

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

dklco pushed a commit to branch SLING-11078
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-repoinit-parser.git

commit 0ee646daf979b495eb9a9d5c9208ea4b02bd9d8c
Author: Dan Klco <kl...@adobe.com>
AuthorDate: Thu Jan 20 13:25:22 2022 -0500

    SLING-11078 - Adding JavaDocs to describe the Operation.asRepoInitString() contract and validate line separate compliance
---
 .../org/apache/sling/repoinit/parser/operations/Operation.java   | 8 ++++++++
 .../apache/sling/repoinit/parser/operations/AsRepoInitTest.java  | 9 ++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/Operation.java b/src/main/java/org/apache/sling/repoinit/parser/operations/Operation.java
index 9aa4157..aed4b43 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/Operation.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/Operation.java
@@ -31,6 +31,14 @@ public abstract class Operation {
     
     protected abstract String getParametersDescription();
 
+    /**
+     * Converts this operation instance to a RepoInit string representation
+     * including the current operation parameters. The representation must be
+     * parsable back into an equivalent operation and must end with a OS-compatible
+     * line separator.
+     * 
+     * @return the repoinit string for the operation
+     */
     @NotNull
     public abstract String asRepoInitString();
 
diff --git a/src/test/java/org/apache/sling/repoinit/parser/operations/AsRepoInitTest.java b/src/test/java/org/apache/sling/repoinit/parser/operations/AsRepoInitTest.java
index fe12c50..1c19cd2 100644
--- a/src/test/java/org/apache/sling/repoinit/parser/operations/AsRepoInitTest.java
+++ b/src/test/java/org/apache/sling/repoinit/parser/operations/AsRepoInitTest.java
@@ -25,6 +25,8 @@ import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
+import static org.junit.Assert.assertTrue;
+
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
@@ -52,7 +54,12 @@ public class AsRepoInitTest {
     private static Reader rebuildInputScript(Reader input) throws Exception {
         StringBuilder sb = new StringBuilder();
         for (Operation o : new RepoInitParserService().parse(input)) {
-            sb.append(o.asRepoInitString());
+            String repoinitStatement = o.asRepoInitString();
+            assertTrue(
+                    "Operation.asRepoInitString() should always end with an-OS agnostic line separator. Not found for "
+                            + o.toString(),
+                    repoinitStatement.endsWith(System.lineSeparator()));
+            sb.append(repoinitStatement);
         }
         return new StringReader(sb.toString());
     }