added test case to ConfigComponentAdaptorTest 01/65401/5
authorSandeep J <sandeejh@in.ibm.com>
Tue, 11 Sep 2018 13:20:52 +0000 (18:50 +0530)
committerTakamune Cho <tc012c@att.com>
Tue, 11 Sep 2018 14:39:49 +0000 (14:39 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: I49259f114ed7e180c0dd4d71de11da331634dc12
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
appc-config/appc-config-adaptor/provider/src/main/java/org/onap/appc/ccadaptor/ConfigComponentAdaptor.java
appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java

index bffa396..a224b7f 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * =============================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * =============================================================================
  * 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
@@ -54,6 +56,39 @@ private String configPassword = null;
 private String auditUrl = null;
 private String auditUser = null;
 private String auditPassword = null;
+
+public String getConfigUrl() {
+       return configUrl;
+}
+
+public String getConfigUser() {
+       return configUser;
+}
+
+public String getConfigPassword() {
+       return configPassword;
+}
+
+public String getAuditUrl() {
+       return auditUrl;
+}
+
+public String getAuditUser() {
+       return auditUser;
+}
+
+public String getAuditPassword() {
+       return auditPassword;
+}
+
+public String getConfigCallbackUrl() {
+       return configCallbackUrl;
+}
+
+public String getAuditCallbackUrl() {
+       return auditCallbackUrl;
+}
+
 private String configCallbackUrl = null;
 private String auditCallbackUrl = null;
 private int DEFAULT_TIMEOUT_GETRUNNING_CLI = 120 * 1000 ;
index e7c00a5..1cf9b8e 100644 (file)
@@ -306,5 +306,29 @@ public class ConfigComponentAdaptorTest {
         String result = Whitebox.invokeMethod(cca, "prepare", ctx, "test", "test");
         Assert.assertEquals("template", result);
     }
+    
+    @Test
+    public void testConstructorForNonNullProperties() throws Exception {
+        Properties props = new Properties();
+        props.setProperty("configComponent.url", "testConfigUrl");
+        props.setProperty("configComponent.user", "testConfigUser");
+        props.setProperty("configComponent.passwd", "testConfigPwd");
+        props.setProperty("auditComponent.url", "testAuditUrl");
+        props.setProperty("auditComponent.user", "testAuditUser");
+        props.setProperty("auditComponent.passwd", "testAuditPwd");
+        props.setProperty("service-configuration-notification-url", "testServiceNotificationUrl");
+        props.setProperty("audit-configuration-notification-url", "testAuditNotificationUrl");
+        
+        ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
+        Assert.assertEquals("testConfigUrl", cca.getConfigUrl());
+        Assert.assertEquals("testConfigUser", cca.getConfigUser());
+        Assert.assertEquals("testConfigPwd", cca.getConfigPassword());
+        Assert.assertEquals("testAuditUrl", cca.getAuditUrl());
+        Assert.assertEquals("testAuditUser", cca.getAuditUser());
+        Assert.assertEquals("testAuditPwd", cca.getAuditPassword());
+        Assert.assertEquals("testServiceNotificationUrl", cca.getConfigCallbackUrl());
+        Assert.assertEquals("testAuditNotificationUrl", cca.getAuditCallbackUrl());
+        
+    }
 
 }