You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/20 14:39:29 UTC

[sling-org-apache-sling-repoinit-parser] 20/46: SLING-6219 - clarify tests about parsing of the password encoding

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

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

commit 6cc5700d5a52522e8d534b8e012d8895711e8965
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Nov 8 09:33:29 2016 +0000

    SLING-6219 - clarify tests about parsing of the password encoding
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1768648 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/repoinit/parser/operations/CreateUser.java    |  4 ++++
 .../sling/repoinit/parser/test/OperationToStringVisitor.java   | 10 +++++++++-
 src/test/resources/testcases/test-60-output.txt                |  8 ++++----
 src/test/resources/testcases/test-60.txt                       |  2 +-
 src/test/resources/testcases/test-99-output.txt                |  4 ++--
 5 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/sling/repoinit/parser/operations/CreateUser.java b/src/main/java/org/apache/sling/repoinit/parser/operations/CreateUser.java
index 05e39e4..f9190e6 100644
--- a/src/main/java/org/apache/sling/repoinit/parser/operations/CreateUser.java
+++ b/src/main/java/org/apache/sling/repoinit/parser/operations/CreateUser.java
@@ -58,4 +58,8 @@ public class CreateUser extends Operation {
     public String getPassword() {
         return password;
     }
+    
+    public String getPasswordEncoding() {
+        return passwordEncoding;
+    }
 }
diff --git a/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java b/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
index 0663e59..9ac4601 100644
--- a/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
+++ b/src/test/java/org/apache/sling/repoinit/parser/test/OperationToStringVisitor.java
@@ -55,7 +55,15 @@ class OperationToStringVisitor implements OperationVisitor {
 
     @Override
     public void visitCreateUser(CreateUser u) {
-        out.println(u.toString());
+        final StringBuilder sb = new StringBuilder();
+        sb.append(u.toString());
+        if(u.getPassword() != null) {
+            sb.append(", password=").append(u.getPassword());
+        }
+        if(u.getPasswordEncoding() != null) {
+            sb.append(", passwordEncoding=").append(u.getPasswordEncoding());
+        }
+        out.println(sb.toString());
     }
 
     @Override
diff --git a/src/test/resources/testcases/test-60-output.txt b/src/test/resources/testcases/test-60-output.txt
index db94843..1a70cdf 100644
--- a/src/test/resources/testcases/test-60-output.txt
+++ b/src/test/resources/testcases/test-60-output.txt
@@ -1,6 +1,6 @@
 DeleteUser userB
 CreateUser userB
-CreateUser userC (with password)
-CreateUser userD (with encoded password)
-CreateUser userE (with encoded password)
-CreateUser one_with-more-chars.ok:/123456 (with encoded password)
\ No newline at end of file
+CreateUser userC (with password), password=some_password
+CreateUser userD (with encoded password), password=dc460da4ad72c, passwordEncoding=SHA-256
+CreateUser userE (with encoded password), password=afdgwdsdf, passwordEncoding=someEncoding
+CreateUser one_with-more-chars.ok:/123456 (with encoded password), password=pw-with.ok-:/13456, passwordEncoding=encoding_with.ok-:/12345
\ No newline at end of file
diff --git a/src/test/resources/testcases/test-60.txt b/src/test/resources/testcases/test-60.txt
index e39f331..9e9a8df 100644
--- a/src/test/resources/testcases/test-60.txt
+++ b/src/test/resources/testcases/test-60.txt
@@ -4,7 +4,7 @@ delete user userB
 create user userB
 
 create user userC with password some_password
-create user userD with password {SHA-256}dc460da4ad72c482231e28e688e01f2778a88ce31a08826899d54ef7183998b5
+create user userD with password {SHA-256}dc460da4ad72c
 
 create user userE with password {someEncoding} afdgwdsdf
 
diff --git a/src/test/resources/testcases/test-99-output.txt b/src/test/resources/testcases/test-99-output.txt
index b7927c7..eaa7451 100644
--- a/src/test/resources/testcases/test-99-output.txt
+++ b/src/test/resources/testcases/test-99-output.txt
@@ -23,6 +23,6 @@ RegisterNodetypes:
  [slingevent:Event] > nt:unstructured, nt:hierarchyNode
       - slingevent:topic (string)
       - slingevent:properties (binary)
-CreateUser userE (with encoded password)
-CreateUser one_with-more-chars.ok:/123456 (with encoded password)
+CreateUser userE (with encoded password), password=afdgwdsdf, passwordEncoding=someEncoding
+CreateUser one_with-more-chars.ok:/123456 (with encoded password), password=pw-with.ok-:/13456, passwordEncoding=encoding_with.ok-:/12345
 CreateServiceUser the-last-one
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.