Merge changes Ia0e3c2ea,I14a52a0e,I29aa80df
[vfc/nfvo/driver/vnfm/svnfm.git] / huawei / vnfmadapter / VnfmadapterService / service / src / test / java / org / onap / vfc / nfvo / vnfm / svnfm / vnfmadapter / common / ResultRequestUtilTest.java
index 3e93f2c..8792f52 100644 (file)
 
 package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common;
 
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
+import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.Constant;
 import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.connect.ConnectMgrVnfm;
 
 import mockit.Mock;
@@ -36,10 +38,15 @@ public class ResultRequestUtilTest {
                 return 500;
             }
         };
+       
+       
         JSONObject vnfmObject = new JSONObject();
         String path = "http://localhost:8080";
         String methodName = "get";
         String paramsJson = "";
+        vnfmObject.put("url", path);
+        vnfmObject.put(Constant.USERNAME, Constant.USERNAME);
+        vnfmObject.put(Constant.PASSWORD, Constant.PASSWORD);
         JSONObject resp = ResultRequestUtil.call(vnfmObject, path, methodName, paramsJson);
         assertTrue(resp.get("data").equals("connect fail."));
     }
@@ -91,5 +98,33 @@ public class ResultRequestUtilTest {
         JSONObject resp = ResultRequestUtil.call(vnfmObject, path, methodName, paramsJson);
         assertTrue(resp.get("data").equals("get connection error"));
     }
+    
+    
+    @Test
+    public void call() {
+    
+       JSONObject vnfmObject = new JSONObject();
+       vnfmObject.put("url","https://localhost:8080/%s" );
+       vnfmObject.put(Constant.USERNAME, Constant.USERNAME);
+       vnfmObject.put(Constant.PASSWORD, Constant.PASSWORD);
+        String path = "https://localhost:8080/%s";
+        String methodName = "get";
+        String paramsJson = "";
+         assertNotNull(ResultRequestUtil.call( vnfmObject, path,  methodName,  paramsJson,
+            "authModel"));
+       
+    }
+    
+       @Test
+       public void callSouth() {
+               JSONObject vnfmObject = new JSONObject();
+               vnfmObject.put("url", "https://localhost:8080/%s");
+               vnfmObject.put(Constant.USERNAME, Constant.USERNAME);
+               vnfmObject.put(Constant.PASSWORD, Constant.PASSWORD);
+               String path = "https://localhost:8080/%s";
+               String methodName = "get";
+               String paramsJson = "";
+               assertNotNull(ResultRequestUtil.callSouth(vnfmObject, path, methodName, paramsJson, "authModel"));
+       }
 
 }