aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorxuegao <xg353y@intl.att.com>2019-11-28 15:13:18 +0100
committerxuegao <xg353y@intl.att.com>2019-11-29 16:23:22 +0100
commit1ebfe6b467e5a6a42c756f225397da76f9e3dfc2 (patch)
tree29c55623caf2373cd51f71ceb80d80e513a1c330 /src/test/java/org
parent876d1a49367b4614680954913590372d773ec8ec (diff)
Merge ssl password
Use the aaf encrypted ssl password fot server.ssl parameters Issue-ID: CLAMP-339 Change-Id: I8869bb527f2851c1d298cd03e45327791a8acfab Signed-off-by: xuegao <xg353y@intl.att.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/clamp/util/PassDecoderTest.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/test/java/org/onap/clamp/util/PassDecoderTest.java b/src/test/java/org/onap/clamp/util/PassDecoderTest.java
new file mode 100644
index 000000000..56443e31d
--- /dev/null
+++ b/src/test/java/org/onap/clamp/util/PassDecoderTest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class PassDecoderTest {
+
+ private final String encrypted = "enc:WWCxchk4WGBNSvuzLq3MLjMs5ObRybJtts5AI0XD1Vc";
+
+ @Test
+ public final void testDecryptionNoKeyfile() throws Exception {
+ String decodedPass = PassDecoder.decode(encrypted, null);
+ assertEquals(decodedPass, encrypted);
+ }
+
+ @Test
+ public final void testDecryptionNoPassword() throws Exception {
+ String decodedPass = PassDecoder.decode(null, "src/test/resources/clds/aaf/org.onap.clamp.keyfile");
+ assertNull(decodedPass);
+ }
+
+ @Test
+ public final void testDecryption() throws Exception {
+ String decodedPass = PassDecoder.decode(encrypted, "src/test/resources/clds/aaf/org.onap.clamp.keyfile");
+ assertEquals(decodedPass, "China in the Spring");
+ }
+}