From 2881c40136f418693ccee5202e230b1b5b075f43 Mon Sep 17 00:00:00 2001 From: Felix Sangalang Date: Mon, 9 Apr 2018 13:21:59 -0700 Subject: Add junit coverage for CryptoHandler java junit coverage for CryptoHandler Issue-ID: SO-568 Change-Id: I8f0a57deb96dcfbed0cf439efbf81de5b2389748 Change-Id: I8f0a57deb96dcfbed0cf439efbf81de5b2389748 Signed-off-by: Felix Sangalang --- .../mso/bpmn/common/util/CryptoHandlerTest.java | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java (limited to 'bpmn/MSOCommonBPMN') diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java new file mode 100644 index 0000000000..724d3edf4d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 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.openecomp.mso.bpmn.common.util; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class CryptoHandlerTest { + + @Test + public void test() throws Exception { + String plainPswd = "mso0206"; + String encryptPwd = "C1FC4A39E16419DD41DFC1212843F440"; + CryptoHandler cryptoHandler = new CryptoHandler(); + String aaiPassword = cryptoHandler.getMsoAaiPassword(); + assertEquals(plainPswd, aaiPassword); + String encryptPassword = cryptoHandler.encryptMsoPassword(plainPswd); + assertEquals(encryptPwd, encryptPassword); + String decryptPassword = cryptoHandler.decryptMsoPassword(encryptPwd); + assertEquals(plainPswd, decryptPassword); + } + +} \ No newline at end of file -- cgit 1.2.3-korg