You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by an...@apache.org on 2021/05/20 10:17:52 UTC

[sling-org-apache-sling-repoinit-parser] branch SLING-10361 created (now f6b3800)

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

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


      at f6b3800  SLING-10361 : Extra space in DisableServiceUser.asRepoInitString

This branch includes the following new commits:

     new f6b3800  SLING-10361 : Extra space in DisableServiceUser.asRepoInitString

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-repoinit-parser] 01/01: SLING-10361 : Extra space in DisableServiceUser.asRepoInitString

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

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

commit f6b380057e8c2f662c4f1fe1ea8e5c308e12119b
Author: angela <an...@adobe.com>
AuthorDate: Thu May 20 12:17:24 2021 +0200

    SLING-10361 : Extra space in DisableServiceUser.asRepoInitString
---
 .../parser/operations/DisableServiceUser.java      |  2 +-
 .../parser/operations/DisableServiceUserTest.java  | 34 ++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/DisableServiceUser.java b/src/main/java/org/apache/sling/repoinit/parser/operations/DisableServiceUser.java
index 0aedc58..7cc5429 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/DisableServiceUser.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/DisableServiceUser.java
@@ -60,7 +60,7 @@ public class DisableServiceUser extends ServiceUserOperation {
     @Override
     public String asRepoInitString() {
         final String userType = isServiceUser ? "service " : "";
-        return String.format("disable %s user %s : %s%n", userType, username, escapeQuotes(reason));
+        return String.format("disable %suser %s : %s%n", userType, username, escapeQuotes(reason));
     }
 
     @Override
diff --git a/src/test/java/org/apache/sling/repoinit/parser/operations/DisableServiceUserTest.java b/src/test/java/org/apache/sling/repoinit/parser/operations/DisableServiceUserTest.java
new file mode 100644
index 0000000..5cdd545
--- /dev/null
+++ b/src/test/java/org/apache/sling/repoinit/parser/operations/DisableServiceUserTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.repoinit.parser.operations;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class DisableServiceUserTest {
+
+
+    @Test
+    public void testAsRepoiniString() {
+        DisableServiceUser dsu = new DisableServiceUser("name", "reason");
+        assertEquals(String.format("disable user name : \"reason\"%n"), dsu.asRepoInitString());
+        
+        dsu.setServiceUser(true);
+        assertEquals(String.format("disable service user name : \"reason\"%n"), dsu.asRepoInitString());
+    }
+}
\ No newline at end of file