From: Felix Sangalang Date: Mon, 9 Apr 2018 20:21:59 +0000 (-0700) Subject: Add junit coverage for CryptoHandler java X-Git-Tag: v1.2.1~207 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F03%2F41803%2F1;p=so.git 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 --- 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