summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2018-08-09 15:12:38 -0400
committerTait,Trevor(rt0435) <rtait@amdocs.com>2018-08-10 11:35:44 -0400
commit898d73492585a43a60f0ae29b5365187189e551d (patch)
tree270d56bc8ec6af397162758d02e2e62288d02f22 /src/test
parent76c55b6805cb8a6ab274c2e7723be1efbaaeb294 (diff)
Add code for password obfuscation
Issue-ID: LOG-602 Change-Id: Ia35966d14c232e1381a8cd4cfb831bdc4921e491 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java
index c838a1c..8567b75 100644
--- a/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java
+++ b/src/test/java/org/onap/pomba/contextbuilder/sdc/test/SDCClientConfigurationTest.java
@@ -15,29 +15,42 @@
* limitations under the License.
* ============LICENSE_END=====================================================
*/
-package org.onap.pomba.contextbuilder.sdc.test;
-import org.onap.pomba.contextbuilder.sdc.SDCClientConfiguration;
-import org.junit.Test;
+package org.onap.pomba.contextbuilder.sdc.test;
import static org.junit.Assert.assertEquals;
+import org.eclipse.jetty.util.security.Password;
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdc.SDCClientConfiguration;
+import org.openecomp.sdc.api.consumer.IConfiguration;
+import org.openecomp.sdc.http.SdcConnectorClient;
+
public class SDCClientConfigurationTest {
@Test
public void testSDCClientConfig() throws Exception {
SDCClientConfiguration config = new SDCClientConfiguration();
- config.setConsumerID("consumerID");
- config.setPassword("password");
+ config.setUsername("pomba");
config.setSdcAddress("10.147.58.6:30204");
- config.setUsername("username");
+ config.setPassword("OBF:1uha1uh81w8v1ugi1ugg");
+ config.setConsumerID("consumerID");
config.setPollingTimeout("6666");
- assertEquals("username", config.getUsername());
+ assertEquals("pomba", config.getUsername());
+ assertEquals("10.147.58.6:30204", config.getSdcAddress());
assertEquals("consumerID", config.getConsumerID());
- assertEquals("password", config.getPassword());
+ assertEquals("pomba", Password.deobfuscate(config.getPassword()));
assertEquals("6666", config.getPollingTimeout());
- assertEquals("10.147.58.6:30204", config.getSdcAddress());
+
+ SdcConnectorClient sdcClient = config.asdcConnectorClient();
+ IConfiguration sdcClientConfig = sdcClient.getConfiguration();
+ assertEquals("pomba", sdcClientConfig.getUser());
+ assertEquals("10.147.58.6:30204", sdcClientConfig.getAsdcAddress());
+ assertEquals("consumerID", sdcClientConfig.getConsumerID());
+ assertEquals("pomba", sdcClientConfig.getPassword());
+ assertEquals(6666, sdcClientConfig.getPollingTimeout());
+
}
@@ -46,7 +59,7 @@ public class SDCClientConfigurationTest {
String msg = "Basic YWRtaW46YWRtaW4=";
SDCClientConfiguration config = new SDCClientConfiguration();
config.setHttpUserId("admin");
- config.setHttpPassword("admin");
+ config.setHttpPassword("OBF:1u2a1toa1w8v1tok1u30");
assertEquals(msg, config.getHttpBasicAuth());
}
}