From 1ccd9c36ba12849148f9eb73e8ff2ffe4ade5870 Mon Sep 17 00:00:00 2001 From: efiacor Date: Tue, 8 Oct 2019 16:24:28 +0100 Subject: Update AAF loading procedure Signed-off-by: efiacor Issue-ID: DMAAP-1318 Change-Id: I8dc75bdbcd05e5316b5c05cbc258010068fb63e8 --- .../datarouter/node/NodeAafPropsUtilsTest.java | 39 ++++++++++++++++++++++ .../datarouter/node/NodeConfigManagerTest.java | 6 ++-- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeAafPropsUtilsTest.java (limited to 'datarouter-node/src/test/java/org/onap') diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeAafPropsUtilsTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeAafPropsUtilsTest.java new file mode 100644 index 00000000..aa5368b5 --- /dev/null +++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeAafPropsUtilsTest.java @@ -0,0 +1,39 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.dmaap.datarouter.node; + +import java.io.File; +import java.io.IOException; +import org.junit.Assert; +import org.junit.Test; + +public class NodeAafPropsUtilsTest { + + @Test + public void Veirfy_Aaf_Pass_Decryp_Successful() { + NodeAafPropsUtils nodeAafPropsUtils = null; + try { + nodeAafPropsUtils = new NodeAafPropsUtils(new File("src/test/resources/aaf/org.onap.dmaap-dr.props")); + } catch (IOException e) { + e.printStackTrace(); + } + Assert.assertEquals("tVac2#@Stx%tIOE^x[c&2fgZ", nodeAafPropsUtils.getDecryptedPass("cadi_keystore_password")); + } +} diff --git a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java index 87c2bdf6..578053aa 100644 --- a/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java +++ b/datarouter-node/src/test/java/org/onap/dmaap/datarouter/node/NodeConfigManagerTest.java @@ -35,7 +35,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PowerMockIgnore({"javax.net.ssl.*", "javax.security.auth.x500.X500Principal"}) +@PowerMockIgnore({"javax.net.ssl.*", "javax.security.auth.x500.X500Principal", "javax.crypto.*"}) @PrepareForTest({InetAddress.class, URL.class}) public class NodeConfigManagerTest { @@ -57,7 +57,7 @@ public class NodeConfigManagerTest { Assert.assertEquals("legacy", nodeConfigManager.getAafInstance()); Assert.assertEquals("src/test/resources/spool/f", nodeConfigManager.getSpoolDir()); Assert.assertEquals("src/test/resources/spool", nodeConfigManager.getSpoolBase()); - Assert.assertEquals("jks", nodeConfigManager.getKSType()); + Assert.assertEquals("PKCS12", nodeConfigManager.getKSType()); Assert.assertEquals(8080, nodeConfigManager.getHttpPort()); Assert.assertEquals(8443, nodeConfigManager.getHttpsPort()); Assert.assertEquals(443, nodeConfigManager.getExtHttpsPort()); @@ -70,7 +70,7 @@ public class NodeConfigManagerTest { Assert.assertEquals(new String[] {"TLSv1.1", "TLSv1.2"}, nodeConfigManager.getEnabledprotocols()); Assert.assertEquals("org.onap.dmaap-dr.feed", nodeConfigManager.getAafType()); Assert.assertEquals("publish", nodeConfigManager.getAafAction()); - Assert.assertEquals("https://aaf-onap-test.osaaf.org:8095", nodeConfigManager.getAafURL()); + Assert.assertEquals("https://aaf-locate:8095", nodeConfigManager.getAafURL()); Assert.assertFalse(nodeConfigManager.getCadiEnabled()); Assert.assertFalse(nodeConfigManager.isShutdown()); Assert.assertFalse(nodeConfigManager.isConfigured()); -- cgit 1.2.3-korg