cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject cayenne git commit: CAY-2020 | typo: correction to upper alpha range in Rot13PasswordEncoder
Date Wed, 05 Aug 2015 13:12:16 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master eb471c65f -> f9e918daa


CAY-2020 | typo: correction to upper alpha range in Rot13PasswordEncoder


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/f9e918da
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/f9e918da
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/f9e918da

Branch: refs/heads/master
Commit: f9e918daa7bdce5bede82fc8c077364cd8df3582
Parents: eb471c6
Author: Savva Kolbachev <s.kolbachev@gmail.com>
Authored: Wed Aug 5 16:04:22 2015 +0300
Committer: Savva Kolbachev <s.kolbachev@gmail.com>
Committed: Wed Aug 5 16:04:22 2015 +0300

----------------------------------------------------------------------
 .../cayenne/configuration/PasswordEncoding.java |  2 +-
 .../configuration/Rot13PasswordEncoder.java     | 17 +-------
 .../configuration/Rot47PasswordEncoder.java     | 15 -------
 .../configuration/Rot13PasswordEncoderTest.java | 43 ++++++++++++++++++++
 .../configuration/Rot47PasswordEncoderTest.java | 43 ++++++++++++++++++++
 docs/doc/src/main/resources/RELEASE-NOTES.txt   |  1 +
 6 files changed, 89 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/f9e918da/cayenne-server/src/main/java/org/apache/cayenne/configuration/PasswordEncoding.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/PasswordEncoding.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/PasswordEncoding.java
index 5302db1..28b35aa 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/PasswordEncoding.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/PasswordEncoding.java
@@ -43,7 +43,7 @@ public interface PasswordEncoding {
      * @param encodedPassword - The encoded password to be decoded
      * @param key - An optional data element which can be used to unlock the password.
      *            Some encoders may require the key.
-     * @return The decoded normal/plain plassword.
+     * @return The decoded normal/plain password.
      */
     String decodePassword(String encodedPassword, String key);
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f9e918da/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot13PasswordEncoder.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot13PasswordEncoder.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot13PasswordEncoder.java
index 851119b..67b7581 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot13PasswordEncoder.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot13PasswordEncoder.java
@@ -68,7 +68,7 @@ public class Rot13PasswordEncoder implements PasswordEncoding {
             // If c is a letter, rotate it by 13. Numbers/symbols are untouched.
             if ((c >= 'a' && c <= 'm') || (c >= 'A' && c <= 'M'))
                 c += 13; // The first half of the alphabet goes forward 13 letters
-            else if ((c >= 'n' && c <= 'z') || (c >= 'A' && c <=
'Z'))
+            else if ((c >= 'n' && c <= 'z') || (c >= 'N' && c <=
'Z'))
                 c -= 13; // The last half of the alphabet goes backward 13 letters
 
             result.append(c);
@@ -77,19 +77,4 @@ public class Rot13PasswordEncoder implements PasswordEncoding {
         return result.toString();
     }
 
-    /**
-     * Small test program to run text through the ROT-13 cipher. This program can also be
-     * run by hand to encode/decode values manually. The values passed on the command line
-     * are printed to standard out.
-     * 
-     * @param args The array of text values (on the command-line) to be run through the
-     *            ROT-13 cipher.
-     */
-    public static void main(String[] args) {
-        Rot13PasswordEncoder encoder = new Rot13PasswordEncoder();
-
-        for (String string : args) {
-            System.out.println(encoder.rotate(string));
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f9e918da/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot47PasswordEncoder.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot47PasswordEncoder.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot47PasswordEncoder.java
index 31c7725..5895fcd 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot47PasswordEncoder.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot47PasswordEncoder.java
@@ -86,19 +86,4 @@ public class Rot47PasswordEncoder implements PasswordEncoding {
         return result.toString();
     }
 
-    /**
-     * Small test program to run text through the ROT-47 cipher. This program can also be
-     * run by hand to encode/decode values manually. The values passed on the command line
-     * are printed to standard out.
-     * 
-     * @param args The array of text values (on the command-line) to be run through the
-     *            ROT-47 cipher.
-     */
-    public static void main(String[] args) {
-        Rot47PasswordEncoder encoder = new Rot47PasswordEncoder();
-
-        for (String string : args) {
-            System.out.println(encoder.rotate(string));
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f9e918da/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot13PasswordEncoderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot13PasswordEncoderTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot13PasswordEncoderTest.java
new file mode 100644
index 0000000..f5578be
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot13PasswordEncoderTest.java
@@ -0,0 +1,43 @@
+/*****************************************************************
+ *   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.cayenne.configuration;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class Rot13PasswordEncoderTest {
+
+    private final String message = "The Quick Brown Fox Jumps Over The Lazy Dog";
+    private final String encoded = "Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt";
+
+    @Test
+    public void testEncode() {
+        Rot13PasswordEncoder encoder = new Rot13PasswordEncoder();
+        assertEquals(encoded, encoder.encodePassword(message, null));
+    }
+
+    @Test
+    public void testDecode() {
+        Rot13PasswordEncoder encoder = new Rot13PasswordEncoder();
+        assertEquals(message, encoder.decodePassword(encoded, null));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f9e918da/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot47PasswordEncoderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot47PasswordEncoderTest.java
b/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot47PasswordEncoderTest.java
new file mode 100644
index 0000000..de151f4
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot47PasswordEncoderTest.java
@@ -0,0 +1,43 @@
+/*****************************************************************
+ *   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.cayenne.configuration;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class Rot47PasswordEncoderTest {
+
+    private final String message = "The Quick Brown Fox Jumps Over The Lazy Dog";
+    private final String encoded = "%96 \"F:4< qC@H? u@I yF>AD ~G6C %96 {2KJ s@8";
+
+    @Test
+    public void testEncode() {
+        Rot47PasswordEncoder encoder = new Rot47PasswordEncoder();
+        assertEquals(encoded, encoder.encodePassword(message, null));
+    }
+
+    @Test
+    public void testDecode() {
+        Rot47PasswordEncoder encoder = new Rot47PasswordEncoder();
+        assertEquals(message, encoder.decodePassword(encoded, null));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/f9e918da/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index 0e2e7df..9e4b338 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -41,6 +41,7 @@ CAY-1998 Speeding up PropertyUtils
 CAY-1999 Unneeded Property import for superclasses with no properties
 CAY-2003 cdbimport doesn't work properly with several includeTable tags
 CAY-2015 Joint prefetches combined with DisjointById prefetches return null incorrectly
+CAY-2020 typo: correction to upper alpha range in Rot13PasswordEncoder
 
 ----------------------------------
 Release: 4.0.M2


Mime
View raw message