summaryrefslogtreecommitdiffstats
path: root/pomba/service-decomposition/src/test
diff options
context:
space:
mode:
authorMohammadreza Pasandideh <mohammadreza.pasandideh@amdocs.com>2018-08-13 16:37:33 -0400
committerMohammadreza Pasandideh <mohammadreza.pasandideh@amdocs.com>2018-08-13 16:58:18 -0400
commit41a3f1b3b0e14fb1df40273adb4b4b1937c5a977 (patch)
treeb9b120e75e4489932b894a36493cd35b7cf3ad71 /pomba/service-decomposition/src/test
parente80c1047cfd31742c8f876b06a99a738969c8c3d (diff)
Added code for password obfuscation
Issue-ID: SDNC-317 Change-Id: I5114f1dd7dd093e9df6ebd3d91c3cbd47ef31ef9 Signed-off-by: Mohammadreza Pasandideh <mohammadreza.pasandideh@amdocs.com>
Diffstat (limited to 'pomba/service-decomposition/src/test')
-rw-r--r--pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/AuthorizationConfigurationTest.java39
-rw-r--r--pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/ServiceDecompositionTest.java6
2 files changed, 43 insertions, 2 deletions
diff --git a/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/AuthorizationConfigurationTest.java b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/AuthorizationConfigurationTest.java
new file mode 100644
index 0000000..4c7830b
--- /dev/null
+++ b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/AuthorizationConfigurationTest.java
@@ -0,0 +1,39 @@
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * 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.sdnc.apps.pomba.servicedecomposition.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.onap.sdnc.apps.pomba.servicedecomposition.AuthorizationConfiguration;
+
+public class AuthorizationConfigurationTest
+{
+ AuthorizationConfiguration authorizationConfiguration =
+ mock(AuthorizationConfiguration.class);
+
+ @Test
+ public void testGetSdBasicAuthHeader() {
+ String msg = "Basic YWRtaW46YWRtaW4=";
+ when(authorizationConfiguration.getSdBasicAuthHeader()).thenReturn(msg);
+ assertEquals(msg, authorizationConfiguration.getSdBasicAuthHeader());
+ }
+}
diff --git a/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/ServiceDecompositionTest.java b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/ServiceDecompositionTest.java
index ba20a88..771ca99 100644
--- a/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/ServiceDecompositionTest.java
+++ b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/ServiceDecompositionTest.java
@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
+import org.eclipse.jetty.util.security.Password;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Rule;
@@ -61,11 +62,12 @@ import org.springframework.test.context.web.WebAppConfiguration;
"aai.host=localhost",
"aai.port=8081",
"basicAuth.username=admin",
- "basicAuth.password=admin"
+ "basicAuth.password=OBF:1u2a1toa1w8v1tok1u30"
})
public class ServiceDecompositionTest {
- private static final String AUTH = "Basic " + Base64.getEncoder().encodeToString("admin:admin".getBytes());
+ private static final String AUTH = "Basic " + Base64.getEncoder().encodeToString((
+ "admin:" + Password.deobfuscate("OBF:1u2a1toa1w8v1tok1u30")).getBytes());
// TODO missing code coverage for VNFC resources