summaryrefslogtreecommitdiffstats
path: root/huawei
diff options
context:
space:
mode:
Diffstat (limited to 'huawei')
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java68
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestHttpRest.java24
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestRestfulFactory.java16
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/servicetoken/VNFRestfulUtilTest.java66
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java5637
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/Driver2MSBManagerTest.java228
6 files changed, 3067 insertions, 2972 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java
index 8792f528..d6606622 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtilTest.java
@@ -31,14 +31,14 @@ public class ResultRequestUtilTest {
@Test
public void callTestInternalError() {
- new MockUp<ConnectMgrVnfm>() {
-
- @Mock
- public int connect(JSONObject vnfmObj) {
- return 500;
- }
- };
-
+// new MockUp<ConnectMgrVnfm>() {
+//
+// @Mock
+// public int connect(JSONObject vnfmObj) {
+// return 500;
+// }
+// };
+//
JSONObject vnfmObject = new JSONObject();
String path = "http://localhost:8080";
@@ -53,13 +53,13 @@ public class ResultRequestUtilTest {
@Test
public void callTestConnectionErrot() {
- new MockUp<ConnectMgrVnfm>() {
-
- @Mock
- public int connect(JSONObject vnfmObj) {
- return 200;
- }
- };
+// new MockUp<ConnectMgrVnfm>() {
+//
+// @Mock
+// public int connect(JSONObject vnfmObj) {
+// return 200;
+// }
+// };
JSONObject vnfmObject = new JSONObject();
vnfmObject.put("url", "/test/123");
String path = "http://localhost:8080";
@@ -71,24 +71,24 @@ public class ResultRequestUtilTest {
@Test
public void callTest() {
- new MockUp<ConnectMgrVnfm>() {
-
- @Mock
- public int connect(JSONObject vnfmObj) {
- return 200;
- }
-
- @Mock
- public String getRoaRand() {
- return "1234";
- }
-
- @Mock
- public String getAccessSession() {
- return "1234";
- }
-
- };
+// new MockUp<ConnectMgrVnfm>() {
+//
+// @Mock
+// public int connect(JSONObject vnfmObj) {
+// return 200;
+// }
+//
+// @Mock
+// public String getRoaRand() {
+// return "1234";
+// }
+//
+// @Mock
+// public String getAccessSession() {
+// return "1234";
+// }
+//
+// };
JSONObject vnfmObject = new JSONObject();
vnfmObject.put("url", "/test/123");
@@ -126,5 +126,5 @@ public class ResultRequestUtilTest {
String paramsJson = "";
assertNotNull(ResultRequestUtil.callSouth(vnfmObject, path, methodName, paramsJson, "authModel"));
}
-
+
}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestHttpRest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestHttpRest.java
index 84de1a25..fb220392 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestHttpRest.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestHttpRest.java
@@ -79,12 +79,12 @@ public class TestHttpRest {
httpClient.start();
Request request = httpClient.newRequest("http://reqres.in/api/users/2");
ContentResponse contentResponse = request.send();
- new MockUp<HttpBaseRest>() {
- @Mock
- public ContentResponse getResponse() {
- return contentResponse;
- }
- };
+// new MockUp<HttpBaseRest>() {
+// @Mock
+// public ContentResponse getResponse() {
+// return contentResponse;
+// }
+// };
}
/**
@@ -127,12 +127,12 @@ public class TestHttpRest {
@Test
public void testInitHttpRest() throws Exception {
final RestfulOptions options = new RestfulOptions();
- new MockUp<HttpClient>() {
-
- @Mock
- public void doStart() {
- }
- };
+// new MockUp<HttpClient>() {
+//
+// @Mock
+// public void doStart() {
+// }
+// };
final HttpRest httpRest = new HttpRest();
httpRest.initHttpRest(options);
final Field httpClient = HttpBaseRest.class.getDeclaredField("client");
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestRestfulFactory.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestRestfulFactory.java
index eccbb8d7..820d3391 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestRestfulFactory.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/TestRestfulFactory.java
@@ -89,14 +89,14 @@ public class TestRestfulFactory {
public void testGetRestInstance() {
Restful instance = RestfulFactory.getRestInstance("https");
- new MockUp<HttpRest>() {
-
- @Mock
- public void initHttpRest(final RestfulOptions option) throws ServiceException {
- throw new ServiceException();
- }
-
- };
+// new MockUp<HttpRest>() {
+//
+// @Mock
+// public void initHttpRest(final RestfulOptions option) throws ServiceException {
+// throw new ServiceException();
+// }
+//
+// };
instance = RestfulFactory.getRestInstance("http");
assertNotNull(instance);
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/servicetoken/VNFRestfulUtilTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/servicetoken/VNFRestfulUtilTest.java
index 2bdbc11d..929733e9 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/servicetoken/VNFRestfulUtilTest.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/servicetoken/VNFRestfulUtilTest.java
@@ -83,17 +83,17 @@ public class VNFRestfulUtilTest {
}
@Test
public void sendReqToAppTest(){
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
- RestfulResponse resp = new RestfulResponse();
- resp.setStatus(200);
- Map<String,Object> map = new HashMap<>();
- map.put("retCode", 1);
- resp.setResponseJson(toJson(map));
- return resp;
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+// RestfulResponse resp = new RestfulResponse();
+// resp.setStatus(200);
+// Map<String,Object> map = new HashMap<>();
+// map.put("retCode", 1);
+// resp.setResponseJson(toJson(map));
+// return resp;
+// }
+// };
String path="http://localhost:8080/vnfdmgr/v1";
String methodNames = "get";
JSONObject bodyParam = new JSONObject();
@@ -104,17 +104,17 @@ public class VNFRestfulUtilTest {
@Test
public void sendReqToAppTest2(){
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
- RestfulResponse resp = new RestfulResponse();
- resp.setStatus(200);
- Map<String,Object> map = new HashMap<>();
- map.put("retCode", -1);
- resp.setResponseJson(toJson(map));
- return resp;
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+// RestfulResponse resp = new RestfulResponse();
+// resp.setStatus(200);
+// Map<String,Object> map = new HashMap<>();
+// map.put("retCode", -1);
+// resp.setResponseJson(toJson(map));
+// return resp;
+// }
+// };
String path="http://localhost:8080/vnfdmgr/v1";
String methodNames = "get";
JSONObject bodyParam = new JSONObject();
@@ -124,17 +124,17 @@ public class VNFRestfulUtilTest {
}
@Test
public void sendReqToAppTest3(){
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
- RestfulResponse resp = new RestfulResponse();
- resp.setStatus(500);
- Map<String,Object> map = new HashMap<>();
- map.put("retCode", -1);
- resp.setResponseJson(toJson(map));
- return resp;
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRestResByDefault(String path, String methodNames, JSONObject bodyParam) {
+// RestfulResponse resp = new RestfulResponse();
+// resp.setStatus(500);
+// Map<String,Object> map = new HashMap<>();
+// map.put("retCode", -1);
+// resp.setResponseJson(toJson(map));
+// return resp;
+// }
+// };
String path="http://localhost:8080/vnfdmgr/v1";
String methodNames = "get";
JSONObject bodyParam = new JSONObject();
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java
index b79d0414..a0381e94 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java
@@ -20,25 +20,15 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodBase;
import org.junit.Before;
import org.junit.Test;
-import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.DownloadCsarManager;
-import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.VnfmUtil;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.restclient.RestfulParametes;
-import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.restclient.RestfulResponse;
-import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.servicetoken.VNFRestfulUtil;
-import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.connect.ConnectMgrVnfm;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.testutils.JsonUtil;
-import mockit.Mock;
-import mockit.MockUp;
-import net.sf.json.JSONArray;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
@@ -193,21 +183,21 @@ public class AdapterResourceManagerTest {
@Test
public void getVnfmConnInfoTestSuccess() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse resp = new RestfulResponse();
- resp.setStatus(200);
- Map<String, String> objMap = new HashMap<String, String>();
- objMap.put("id", "test123");
-
- String responseString = toJson(objMap);
- resp.setResponseJson(responseString);
- return resp;
- }
-
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse resp = new RestfulResponse();
+// resp.setStatus(200);
+// Map<String, String> objMap = new HashMap<String, String>();
+// objMap.put("id", "test123");
+//
+// String responseString = toJson(objMap);
+// resp.setResponseJson(responseString);
+// return resp;
+// }
+//
+// };
Map<String, String> paramsMap = new HashMap<String, String>();
JSONObject res = manager.getVnfmConnInfo(paramsMap);
assertTrue(res.get("id").equals("test123"));
@@ -215,15 +205,15 @@ public class AdapterResourceManagerTest {
@Test
public void getVnfmConnInfoTestNullResp() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
-
- return null;
- }
-
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+//
+// return null;
+// }
+//
+// };
Map<String, String> paramsMap = new HashMap<String, String>();
JSONObject res = manager.getVnfmConnInfo(paramsMap);
assertTrue(res.get("reason").equals("RestfulResponse is null."));
@@ -231,21 +221,21 @@ public class AdapterResourceManagerTest {
@Test
public void getVnfmConnInfoTestServerError() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse resp = new RestfulResponse();
- resp.setStatus(500);
- Map<String, String> objMap = new HashMap<String, String>();
- objMap.put("id", "test123");
-
- String responseString = toJson(objMap);
- resp.setResponseJson(responseString);
- return resp;
- }
-
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse resp = new RestfulResponse();
+// resp.setStatus(500);
+// Map<String, String> objMap = new HashMap<String, String>();
+// objMap.put("id", "test123");
+//
+// String responseString = toJson(objMap);
+// resp.setResponseJson(responseString);
+// return resp;
+// }
+//
+// };
Map<String, String> paramsMap = new HashMap<String, String>();
JSONObject res = manager.getVnfmConnInfo(paramsMap);
assertTrue(res.get("reason").equals("ESR return fail."));
@@ -293,22 +283,22 @@ public class AdapterResourceManagerTest {
}
@Test
public void testUnzipCSAR4(){
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName,String filePath){
- return 0;
- }
- };
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName,String filePath){
+// return 0;
+// }
+// };
manager.unzipCSAR("vCpe.zip","/opt");
}
@Test
public void testUnzipCSAR5(){
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName,String filePath){
- return -1;
- }
- };
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName,String filePath){
+// return -1;
+// }
+// };
manager.unzipCSAR("vCpe.zip","/opt");
}
@@ -332,34 +322,34 @@ public class AdapterResourceManagerTest {
@Test
public void testgetVNFDPlanInfoConn(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- String str = jobj.toString();
- return str;
- }
-
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// String str = jobj.toString();
+// return str;
+// }
+//
+// };
manager.getVNFDPlanInfo("https://127.0.0.1:80", "vnfd123", "accessSession");
}
@@ -367,30 +357,30 @@ public class AdapterResourceManagerTest {
@Test
public void testgetVNFDPlanInfoConn500(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 500;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "Failed";
- return str;
- }
-
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 500;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "Failed";
+// return str;
+// }
+//
+// };
manager.getVNFDPlanInfo("https://127.0.0.1:80", "vnfd123", "accessSession");
}
@@ -399,34 +389,34 @@ public class AdapterResourceManagerTest {
@Test
public void testGetVnfdVersion200(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- String str = jobj.toString();
- return str;
- }
-
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// String str = jobj.toString();
+// return str;
+// }
+//
+// };
JSONObject jobj = manager.getVnfdVersion("http://","127.0.0.1:80","accessSession");
}
@@ -434,29 +424,29 @@ public class AdapterResourceManagerTest {
@Test
public void testGetVnfdVersion500(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 500;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "Failed";
- return str;
- }
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 500;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "Failed";
+// return str;
+// }
+// };
manager.getVnfdVersion("http://","127.0.0.1:80","accessSession");
}
@@ -554,38 +544,38 @@ public class AdapterResourceManagerTest {
@Test
public void testGetAllCloudUrlandaccessSession(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "{\n\t\"driverInfo\": {\n\t\t\"driverName\": \"hwvnfm\",\n\t\t\"instanceID\": \"hwvnfm-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\"services\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\"support_sys\": [{\n\t\t\t\t\"type\": \"vnfm\",\n\t\t\t\t\"version\": \"V100R001\"\n\t\t\t}]\n\t\t}]\n\t}\n}";
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- JSONArray ja = new JSONArray();
- ja.add(str);
- jobj.put("vim_info", ja);
- String str1 = jobj.toString();
- return str1;
- }
-
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "{\n\t\"driverInfo\": {\n\t\t\"driverName\": \"hwvnfm\",\n\t\t\"instanceID\": \"hwvnfm-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\"services\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\"support_sys\": [{\n\t\t\t\t\"type\": \"vnfm\",\n\t\t\t\t\"version\": \"V100R001\"\n\t\t\t}]\n\t\t}]\n\t}\n}";
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// JSONArray ja = new JSONArray();
+// ja.add(str);
+// jobj.put("vim_info", ja);
+// String str1 = jobj.toString();
+// return str1;
+// }
+//
+// };
System.setProperty("catalina.base", "C:/Users/Huawei/Desktop");
String url = "http://127.0.0.1:31943";
@@ -596,30 +586,30 @@ public class AdapterResourceManagerTest {
@Test
public void testGetAllCloudUrlandaccessSession500(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 500;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "Failed";
- return str;
- }
-
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 500;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "Failed";
+// return str;
+// }
+//
+// };
System.setProperty("catalina.base", "C:/Users/Huawei/Desktop");
String url = "http://127.0.0.1:31943";
@@ -630,34 +620,34 @@ public class AdapterResourceManagerTest {
@Test
public void testUpload(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- String str = jobj.toString();
- return str;
- }
-
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// String str = jobj.toString();
+// return str;
+// }
+//
+// };
JSONObject vnfpackage = new JSONObject();
vnfpackage.put("UserName", "User");
@@ -671,31 +661,31 @@ public class AdapterResourceManagerTest {
@Test
public void testUploadNoJson(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
-
- String str = "Test";
- return str;
- }
-
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+//
+// String str = "Test";
+// return str;
+// }
+//
+// };
JSONObject vnfpackage = new JSONObject();
vnfpackage.put("UserName", "User");
@@ -709,30 +699,30 @@ public class AdapterResourceManagerTest {
@Test
public void testUpload500(){
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 500;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "Failed";
- return str;
- }
-
- };
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 500;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "Failed";
+// return str;
+// }
+//
+// };
JSONObject vnfpackage = new JSONObject();
vnfpackage.put("UserName", "User");
@@ -758,13 +748,13 @@ public class AdapterResourceManagerTest {
@Test
public void downloadCsarTest() {
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
String url = "http://localhost:8080";
String filePath = "src/test/resources/Check.txt";
@@ -775,42 +765,42 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTest() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("downloadUri", "http://127.0.0.1:80");
- return js;
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// return js;
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -829,50 +819,50 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccess() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("downloadUri", "http://127.0.0.1:80");
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -891,58 +881,58 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessUNZIP() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("downloadUri", "http://127.0.0.1:80");
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -961,58 +951,58 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessUNZIPFTPSClient() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("downloadUri", "http://127.0.0.1:80");
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1034,60 +1024,60 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessUNZIPWithUrl() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1107,41 +1097,41 @@ public class AdapterResourceManagerTest {
@Test
public void uploadVNFPackageTestSuccessUNZIP1() {
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("downloadUri", "http://127.0.0.1:80");
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1160,71 +1150,71 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessConnect() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
-
- authModel = "accessSession";
- return 200;
- }
-
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+//
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1243,113 +1233,113 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessConnectPath() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- js.put("vim_info", ja);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- JSONArray ja = new JSONArray();
- ja.add(str);
- jobj.put("vim_info", ja);
- String str1 = jobj.toString();
- return str1;
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// js.put("vim_info", ja);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// JSONArray ja = new JSONArray();
+// ja.add(str);
+// jobj.put("vim_info", ja);
+// String str1 = jobj.toString();
+// return str1;
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1367,114 +1357,114 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessConnectPath500() {
-
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- js.put("vim_info", ja);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 500;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 500);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- JSONArray ja = new JSONArray();
- ja.add(str);
- jobj.put("vim_info", ja);
- String str1 = jobj.toString();
- return str1;
- }
- };
+//
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// js.put("vim_info", ja);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 500;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 500);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// JSONArray ja = new JSONArray();
+// ja.add(str);
+// jobj.put("vim_info", ja);
+// String str1 = jobj.toString();
+// return str1;
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1493,113 +1483,113 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessConnectPathEmpty() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n\"vim_id\": \"\",\n\t\t\"vim-info\": \"1\",\n\t\t\"vim-name\": \"\"\n}";
- ja.add(str);
- js.put("vim_info", ja);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- JSONArray ja = new JSONArray();
- ja.add(str);
- jobj.put("vim_info", ja);
- String str1 = jobj.toString();
- return str1;
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n\"vim_id\": \"\",\n\t\t\"vim-info\": \"1\",\n\t\t\"vim-name\": \"\"\n}";
+// ja.add(str);
+// js.put("vim_info", ja);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// JSONArray ja = new JSONArray();
+// ja.add(str);
+// jobj.put("vim_info", ja);
+// String str1 = jobj.toString();
+// return str1;
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1617,114 +1607,114 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessId() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- js.put("vim_info", ja);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- JSONArray ja = new JSONArray();
- ja.add(str);
- jobj.put("vim_info", ja);
- String str1 = jobj.toString();
- return str1;
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// js.put("vim_info", ja);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// JSONArray ja = new JSONArray();
+// ja.add(str);
+// jobj.put("vim_info", ja);
+// String str1 = jobj.toString();
+// return str1;
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1742,115 +1732,115 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessIdNull() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", null);
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- js.put("vim_info", ja);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- JSONArray ja = new JSONArray();
- ja.add(str);
- jobj.put("vim_info", ja);
- String str1 = jobj.toString();
- return str1;
- }
- };
-
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", null);
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// js.put("vim_info", ja);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// JSONArray ja = new JSONArray();
+// ja.add(str);
+// jobj.put("vim_info", ja);
+// String str1 = jobj.toString();
+// return str1;
+// }
+// };
+//
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
JSONObject obj = new JSONObject();
@@ -1867,114 +1857,114 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessIdFile0() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/Check10.txt");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- js.put("vim_info", ja);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- @Mock
- public String getResponseBodyAsString()
- throws IOException
- {
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- JSONObject jobj = new JSONObject();
- jobj.put("Status", 200);
- jobj.put("UserName", "User");
- jobj.put("password", "pass");
- JSONArray ja = new JSONArray();
- ja.add(str);
- jobj.put("vim_info", ja);
- String str1 = jobj.toString();
- return str1;
- }
- };
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/Check10.txt");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// js.put("vim_info", ja);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// @Mock
+// public String getResponseBodyAsString()
+// throws IOException
+// {
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// JSONObject jobj = new JSONObject();
+// jobj.put("Status", 200);
+// jobj.put("UserName", "User");
+// jobj.put("password", "pass");
+// JSONArray ja = new JSONArray();
+// ja.add(str);
+// jobj.put("vim_info", ja);
+// String str1 = jobj.toString();
+// return str1;
+// }
+// };
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -1993,90 +1983,90 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessId500() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- js.put("vim_info", ja);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
-
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// js.put("vim_info", ja);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+//
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
JSONObject obj = new JSONObject();
@@ -2094,90 +2084,90 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessIdEmpty() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- js.put("vim_info", ja);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
-
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// js.put("vim_info", ja);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+//
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
JSONObject obj = new JSONObject();
@@ -2195,93 +2185,93 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessTemplete() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja1.add(str1);
- js.put("vim_info", ja);
- js.put("templates", ja1);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja1.add(str1);
+// js.put("vim_info", ja);
+// js.put("templates", ja1);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2300,101 +2290,101 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestSuccessTempleteForVPlan() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "Csar_Check");
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "Csar_Check");
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2463,101 +2453,101 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestWithCscf() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<RestfulResponse>(){
-
- @Mock
- public String getResponseContent() {
-
- return "Success";
- }
-
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- return "Success";
-
- }
- };
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF_SI");
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
- return 0;
-
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
-
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
- vnfmObj.put("connToken", "accessSession");
- vnfmObj.put("Content-Type", "Application/Json");
- authModel = "accessSession";
- return 200;
- }
-
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<RestfulResponse>(){
+//
+// @Mock
+// public String getResponseContent() {
+//
+// return "Success";
+// }
+//
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// return "Success";
+//
+// }
+// };
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF_SI");
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+// return 0;
+//
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+//
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+// vnfmObj.put("connToken", "accessSession");
+// vnfmObj.put("Content-Type", "Application/Json");
+// authModel = "accessSession";
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2576,57 +2566,57 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestWithMME() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "MME");
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "MME");
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2645,57 +2635,57 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestWithSPGW() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "SPGW");
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "SPGW");
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2714,57 +2704,57 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestWithHSS() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "HSS");
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "HSS");
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2783,57 +2773,57 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestWithSBC() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "SBC");
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "SBC");
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2852,57 +2842,57 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestWithPCRF() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "PCRF");
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "PCRF");
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2921,57 +2911,57 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestWithTAS() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "TAS");
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "TAS");
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/ONAP-VFC/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
vnfpkg.put("name", "test");
@@ -2990,66 +2980,66 @@ public class AdapterResourceManagerTest {
@Test
public void uploadVNFPackageTestWithCSCF() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF");
- JSONObject jsEms = new JSONObject();
- jsEms.put("emsUuid", "123erbhi-hjdek123");
- JSONObject jsCsar = new JSONObject();
- jsCsar.put("csar_file_path", "/home/ubuntu/check/");
- jsCsar.put("csar_file_name", "Csar_File");
- jsCsar.put("emsUuid", jsEms);
- JSONObject jsTemp = new JSONObject();
- jsTemp.put("template", jsCsar);
- js.put("vCSCF", jsTemp);
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF");
+// JSONObject jsEms = new JSONObject();
+// jsEms.put("emsUuid", "123erbhi-hjdek123");
+// JSONObject jsCsar = new JSONObject();
+// jsCsar.put("csar_file_path", "/home/ubuntu/check/");
+// jsCsar.put("csar_file_name", "Csar_File");
+// jsCsar.put("emsUuid", jsEms);
+// JSONObject jsTemp = new JSONObject();
+// jsTemp.put("template", jsCsar);
+// js.put("vCSCF", jsTemp);
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
JSONObject vnfpkg1 = new JSONObject();
@@ -3068,63 +3058,63 @@ public class AdapterResourceManagerTest {
@Test
public void uploadVNFPackageTestWithOutEmsUid() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF");
- JSONObject jsCsar = new JSONObject();
- jsCsar.put("csar_file_path", "/home/ubuntu/check/");
- jsCsar.put("csar_file_name", "Csar_File");
- JSONObject jsTemp = new JSONObject();
- jsTemp.put("template", jsCsar);
- js.put("vCSCF", jsTemp);
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF");
+// JSONObject jsCsar = new JSONObject();
+// jsCsar.put("csar_file_path", "/home/ubuntu/check/");
+// jsCsar.put("csar_file_name", "Csar_File");
+// JSONObject jsTemp = new JSONObject();
+// jsTemp.put("template", jsCsar);
+// js.put("vCSCF", jsTemp);
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
JSONObject vnfpkg1 = new JSONObject();
@@ -3143,74 +3133,74 @@ public class AdapterResourceManagerTest {
@Test
public void uploadVNFPackageTestWithCSDowCsar() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- String response = "Success";
- return response;
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF");
- JSONObject jsEms = new JSONObject();
- jsEms.put("emsUuid", "123erbhi-hjdek123");
- JSONObject jsCsar = new JSONObject();
- jsCsar.put("csar_file_path", "/home/ubuntu/check/");
- jsCsar.put("csar_file_name", "Csar_File");
- jsCsar.put("emsUuid", jsEms);
- JSONObject jsTemp = new JSONObject();
- jsTemp.put("template", jsCsar);
- js.put("vCSCF", jsTemp);
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// String response = "Success";
+// return response;
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF");
+// JSONObject jsEms = new JSONObject();
+// jsEms.put("emsUuid", "123erbhi-hjdek123");
+// JSONObject jsCsar = new JSONObject();
+// jsCsar.put("csar_file_path", "/home/ubuntu/check/");
+// jsCsar.put("csar_file_name", "Csar_File");
+// jsCsar.put("emsUuid", jsEms);
+// JSONObject jsTemp = new JSONObject();
+// jsTemp.put("template", jsCsar);
+// js.put("vCSCF", jsTemp);
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
JSONObject vnfpkg1 = new JSONObject();
@@ -3229,102 +3219,102 @@ public class AdapterResourceManagerTest {
@Test
public void uploadVNFPackageTestWithUnZipCsar() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
- return rr;
-
- }
- };
-
- new MockUp<VnfmUtil>(){
- @Mock
- public JSONObject getVnfmById(String vnfmId) {
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("url", "https://localhost:80");
- jsonObject.put("userName", "ubuntu");
- jsonObject.put("password", "******");
- return jsonObject;
-
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- String response = "Success";
- return response;
- }
-
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
-
- return 0;
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
-
-
- return 404;
-
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF");
- JSONObject jsEms = new JSONObject();
- jsEms.put("emsUuid", "123erbhi-hjdek123");
- JSONObject jsCsar = new JSONObject();
- jsCsar.put("csar_file_path", "/home/ubuntu/check/");
- jsCsar.put("csar_file_name", "Csar_File");
- jsCsar.put("emsUuid", jsEms);
- JSONObject jsTemp = new JSONObject();
- jsTemp.put("template", jsCsar);
- js.put("vCSCF", jsTemp);
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<VnfmUtil>(){
+// @Mock
+// public JSONObject getVnfmById(String vnfmId) {
+//
+// JSONObject jsonObject = new JSONObject();
+// jsonObject.put("url", "https://localhost:80");
+// jsonObject.put("userName", "ubuntu");
+// jsonObject.put("password", "******");
+// return jsonObject;
+//
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// String response = "Success";
+// return response;
+// }
+//
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+//
+// return 0;
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+//
+//
+// return 404;
+//
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF");
+// JSONObject jsEms = new JSONObject();
+// jsEms.put("emsUuid", "123erbhi-hjdek123");
+// JSONObject jsCsar = new JSONObject();
+// jsCsar.put("csar_file_path", "/home/ubuntu/check/");
+// jsCsar.put("csar_file_name", "Csar_File");
+// jsCsar.put("emsUuid", jsEms);
+// JSONObject jsTemp = new JSONObject();
+// jsTemp.put("template", jsCsar);
+// js.put("vCSCF", jsTemp);
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
JSONObject vnfpkg1 = new JSONObject();
@@ -3343,126 +3333,126 @@ public class AdapterResourceManagerTest {
@Test(expected=JSONException.class)
public void uploadVNFPackageTestWithConnectMgr() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<VnfmUtil>(){
- @Mock
- public JSONObject getVnfmById(String vnfmId) {
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("url", "https://localhost:80");
- jsonObject.put("userName", "ubuntu");
- jsonObject.put("password", "******");
- return jsonObject;
-
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- String response = "Success";
- return response;
- }
-
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
-
- return 0;
- }
- };
-
- new MockUp<HttpClient>(){
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>(){
-
- @Mock
- public int getStatusCode(){
-
- return 200;
- }
-
- };
-
- new MockUp<ConnectMgrVnfm>(){
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
-
-
- return 200;
-
- }
-
- @Mock
- public String getAccessSession() {
-
- return "conn";
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF");
- JSONObject jsEms = new JSONObject();
- jsEms.put("emsUuid", "123erbhi-hjdek123");
- JSONObject jsCsar = new JSONObject();
- jsCsar.put("csar_file_path", "/home/ubuntu/check/");
- jsCsar.put("csar_file_name", "Csar_File");
- jsCsar.put("emsUuid", jsEms);
- JSONObject jsTemp = new JSONObject();
- jsTemp.put("template", jsCsar);
- js.put("vCSCF", jsTemp);
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<VnfmUtil>(){
+// @Mock
+// public JSONObject getVnfmById(String vnfmId) {
+//
+// JSONObject jsonObject = new JSONObject();
+// jsonObject.put("url", "https://localhost:80");
+// jsonObject.put("userName", "ubuntu");
+// jsonObject.put("password", "******");
+// return jsonObject;
+//
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// String response = "Success";
+// return response;
+// }
+//
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+//
+// return 0;
+// }
+// };
+//
+// new MockUp<HttpClient>(){
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>(){
+//
+// @Mock
+// public int getStatusCode(){
+//
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+//
+//
+// return 200;
+//
+// }
+//
+// @Mock
+// public String getAccessSession() {
+//
+// return "conn";
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF");
+// JSONObject jsEms = new JSONObject();
+// jsEms.put("emsUuid", "123erbhi-hjdek123");
+// JSONObject jsCsar = new JSONObject();
+// jsCsar.put("csar_file_path", "/home/ubuntu/check/");
+// jsCsar.put("csar_file_name", "Csar_File");
+// jsCsar.put("emsUuid", jsEms);
+// JSONObject jsTemp = new JSONObject();
+// jsTemp.put("template", jsCsar);
+// js.put("vCSCF", jsTemp);
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
JSONObject vnfpkg1 = new JSONObject();
@@ -3481,109 +3471,109 @@ public class AdapterResourceManagerTest {
@Test
public void uploadVNFPackageTestWithConnectMgrGetAllFail() {
- new MockUp<VNFRestfulUtil>(){
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<VnfmUtil>(){
- @Mock
- public JSONObject getVnfmById(String vnfmId) {
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("url", "https://localhost:80");
- jsonObject.put("userName", "ubuntu");
- jsonObject.put("password", "******");
- return jsonObject;
-
- }
- };
-
- new MockUp<DownloadCsarManager>(){
- @Mock
- public String download(String url, String filepath) {
- String response = "Success";
- return response;
- }
-
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
-
- return 0;
- }
- };
-
- new MockUp<ConnectMgrVnfm>(){
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
-
-
- return 200;
-
- }
-
- @Mock
- public String getAccessSession() {
-
- return "conn";
- }
- };
-
- new MockUp<JSONObject>(){
- @Mock
- public JSONObject fromObject(Object object){
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF");
- JSONObject jsEms = new JSONObject();
- jsEms.put("emsUuid", "123erbhi-hjdek123");
- JSONObject jsCsar = new JSONObject();
- jsCsar.put("csar_file_path", "/home/ubuntu/check/");
- jsCsar.put("csar_file_name", "Csar_File");
- jsCsar.put("emsUuid", jsEms);
- JSONObject jsTemp = new JSONObject();
- jsTemp.put("template", jsCsar);
- js.put("vCSCF", jsTemp);
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>(){
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<VnfmUtil>(){
+// @Mock
+// public JSONObject getVnfmById(String vnfmId) {
+//
+// JSONObject jsonObject = new JSONObject();
+// jsonObject.put("url", "https://localhost:80");
+// jsonObject.put("userName", "ubuntu");
+// jsonObject.put("password", "******");
+// return jsonObject;
+//
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>(){
+// @Mock
+// public String download(String url, String filepath) {
+// String response = "Success";
+// return response;
+// }
+//
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+//
+// return 0;
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>(){
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+//
+//
+// return 200;
+//
+// }
+//
+// @Mock
+// public String getAccessSession() {
+//
+// return "conn";
+// }
+// };
+//
+// new MockUp<JSONObject>(){
+// @Mock
+// public JSONObject fromObject(Object object){
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF");
+// JSONObject jsEms = new JSONObject();
+// jsEms.put("emsUuid", "123erbhi-hjdek123");
+// JSONObject jsCsar = new JSONObject();
+// jsCsar.put("csar_file_path", "/home/ubuntu/check/");
+// jsCsar.put("csar_file_name", "Csar_File");
+// jsCsar.put("emsUuid", jsEms);
+// JSONObject jsTemp = new JSONObject();
+// jsTemp.put("template", jsCsar);
+// js.put("vCSCF", jsTemp);
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
JSONObject vnfpkg1 = new JSONObject();
@@ -3602,110 +3592,110 @@ public class AdapterResourceManagerTest {
@Test
public void uploadVNFPackageTestVnfdPlanInfo() throws IOException {
- new MockUp<VNFRestfulUtil>() {
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<VnfmUtil>() {
- @Mock
- public JSONObject getVnfmById(String vnfmId) {
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("url", "https://localhost:80");
- jsonObject.put("userName", "ubuntu");
- jsonObject.put("password", "******");
- return jsonObject;
-
- }
- };
-
- new MockUp<DownloadCsarManager>() {
- @Mock
- public String download(String url, String filepath) {
- String response = "Success";
- return response;
- }
-
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
-
- return 0;
- }
- };
-
- new MockUp<ConnectMgrVnfm>() {
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
-
- return 200;
-
- }
-
- @Mock
- public String getAccessSession() {
-
- return "conn";
- }
- };
-
- new MockUp<JSONObject>() {
- @Mock
- public JSONObject fromObject(Object object) {
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
- ja2.add(str2);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF");
- JSONObject jsEms = new JSONObject();
- jsEms.put("emsUuid", "123erbhi-hjdek123");
- JSONObject jsCsar = new JSONObject();
- jsCsar.put("csar_file_path", "/home/ubuntu/check/");
- jsCsar.put("csar_file_name", "Csar_File");
- jsCsar.put("emsUuid", jsEms);
- JSONObject jsTemp = new JSONObject();
- jsTemp.put("template", jsCsar);
- js.put("vCSCF", jsTemp);
- js.put("vim_info", ja);
- js.put("template", ja2);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base",
- "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>() {
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<VnfmUtil>() {
+// @Mock
+// public JSONObject getVnfmById(String vnfmId) {
+//
+// JSONObject jsonObject = new JSONObject();
+// jsonObject.put("url", "https://localhost:80");
+// jsonObject.put("userName", "ubuntu");
+// jsonObject.put("password", "******");
+// return jsonObject;
+//
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>() {
+// @Mock
+// public String download(String url, String filepath) {
+// String response = "Success";
+// return response;
+// }
+//
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+//
+// return 0;
+// }
+// };
+//
+// new MockUp<ConnectMgrVnfm>() {
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+//
+// return 200;
+//
+// }
+//
+// @Mock
+// public String getAccessSession() {
+//
+// return "conn";
+// }
+// };
+//
+// new MockUp<JSONObject>() {
+// @Mock
+// public JSONObject fromObject(Object object) {
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\n \"template_name\": \"vnfd-name-123\",\n \"topology_template\": [{\n\t\t\t\"service_url\": \"/api/hwvnfm/v1\",\n\t\t\t\n\t\t}]\n\t\n\t\n}";
+// ja2.add(str2);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF");
+// JSONObject jsEms = new JSONObject();
+// jsEms.put("emsUuid", "123erbhi-hjdek123");
+// JSONObject jsCsar = new JSONObject();
+// jsCsar.put("csar_file_path", "/home/ubuntu/check/");
+// jsCsar.put("csar_file_name", "Csar_File");
+// jsCsar.put("emsUuid", jsEms);
+// JSONObject jsTemp = new JSONObject();
+// jsTemp.put("template", jsCsar);
+// js.put("vCSCF", jsTemp);
+// js.put("vim_info", ja);
+// js.put("template", ja2);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base",
+// "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
JSONObject vnfpkg1 = new JSONObject();
@@ -3726,128 +3716,128 @@ public class AdapterResourceManagerTest {
@Test
public void uploadVNFPackageSuccessTest() {
- new MockUp<VNFRestfulUtil>() {
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse rr = new RestfulResponse();
- Map<String, String> header = new HashMap<>();
- header.put("Content-Type", "Application/Json");
- header.put("X-FormId", "jhfdl");
- rr.setRespHeaderMap(header);
- rr.setStatus(200);
- rr.setResponseJson("shdfhj");
-
- return rr;
-
- }
- };
-
- new MockUp<VnfmUtil>() {
- @Mock
- public JSONObject getVnfmById(String vnfmId) {
-
- JSONObject jsonObject = new JSONObject();
- jsonObject.put("url", "https://localhost:80");
- jsonObject.put("userName", "ubuntu");
- jsonObject.put("password", "******");
- return jsonObject;
-
- }
- };
-
- new MockUp<DownloadCsarManager>() {
- @Mock
- public String download(String url, String filepath) {
- String response = "Success";
- return response;
- }
-
- @Mock
- public int unzipCSAR(String fileName, String filePath) {
-
- return 0;
- }
- };
-
- new MockUp<HttpClient>() {
- @Mock
- public int executeMethod(HttpMethod method) {
- return 200;
- }
- };
-
- new MockUp<HttpMethodBase>() {
-
- @Mock
- public int getStatusCode() {
-
- return 200;
- }
-
- };
-
- new MockUp<ConnectMgrVnfm>() {
- @Mock
- public int connect(JSONObject vnfmObj, String authModel) {
-
- return 200;
-
- }
-
- @Mock
- public String getAccessSession() {
-
- return "conn";
- }
- };
-
- new MockUp<JSONObject>() {
- @Mock
- public JSONObject fromObject(Object object) {
- JSONObject js = new JSONObject();
- js.put("id", "upload-id-123");
- js.put("Result", "Success");
- js.put("Check", "Ok");
- js.put("url", "http://localhost:80");
- js.put("userName", "User");
- js.put("password", "pass");
- js.put("downloadUri", "http://127.0.0.1:80");
- js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
- js.put("keyStorePass", "Changeme_123");
- js.put("keyStoreType", "PKCS12");
- JSONArray ja = new JSONArray();
- String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ja.add(str);
- JSONArray ja1 = new JSONArray();
- String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
- ;
- ja1.add(str1);
- JSONArray ja2 = new JSONArray();
- String str2 = "{\"template_name\": \"VNFD_vUGW\",\"topology_template\":[{\"plan_name\": \"Normal_E9K\",\"plan_id\": \"Normal_E9K\"}]}";
- ja2.add(str2);
- JSONObject verTmpObj = ja2.getJSONObject(0);
- JSONObject jsObject = new JSONObject();
- jsObject.put("downloadUrl", "http://localhost:80");
- jsObject.put("csarName", "CSCF");
- JSONObject jsEms = new JSONObject();
- jsEms.put("emsUuid", "123erbhi-hjdek123");
- JSONObject jsCsar = new JSONObject();
- jsCsar.put("csar_file_path", "/home/ubuntu/check/");
- jsCsar.put("csar_file_name", "Csar_File");
- jsCsar.put("emsUuid", jsEms);
- JSONObject jsTemp = new JSONObject();
- jsTemp.put("template", jsCsar);
- js.put("vCSCF", jsTemp);
- js.put("vim_info", ja);
- js.put("template", verTmpObj);
- js.put("templates", ja1);
- js.put("packageInfo", jsObject);
- return js;
- }
- };
-
- System.setProperty("catalina.base",
- "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+// new MockUp<VNFRestfulUtil>() {
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse rr = new RestfulResponse();
+// Map<String, String> header = new HashMap<>();
+// header.put("Content-Type", "Application/Json");
+// header.put("X-FormId", "jhfdl");
+// rr.setRespHeaderMap(header);
+// rr.setStatus(200);
+// rr.setResponseJson("shdfhj");
+//
+// return rr;
+//
+// }
+// };
+//
+// new MockUp<VnfmUtil>() {
+// @Mock
+// public JSONObject getVnfmById(String vnfmId) {
+//
+// JSONObject jsonObject = new JSONObject();
+// jsonObject.put("url", "https://localhost:80");
+// jsonObject.put("userName", "ubuntu");
+// jsonObject.put("password", "******");
+// return jsonObject;
+//
+// }
+// };
+//
+// new MockUp<DownloadCsarManager>() {
+// @Mock
+// public String download(String url, String filepath) {
+// String response = "Success";
+// return response;
+// }
+//
+// @Mock
+// public int unzipCSAR(String fileName, String filePath) {
+//
+// return 0;
+// }
+// };
+//
+// new MockUp<HttpClient>() {
+// @Mock
+// public int executeMethod(HttpMethod method) {
+// return 200;
+// }
+// };
+//
+// new MockUp<HttpMethodBase>() {
+//
+// @Mock
+// public int getStatusCode() {
+//
+// return 200;
+// }
+//
+// };
+//
+// new MockUp<ConnectMgrVnfm>() {
+// @Mock
+// public int connect(JSONObject vnfmObj, String authModel) {
+//
+// return 200;
+//
+// }
+//
+// @Mock
+// public String getAccessSession() {
+//
+// return "conn";
+// }
+// };
+//
+// new MockUp<JSONObject>() {
+// @Mock
+// public JSONObject fromObject(Object object) {
+// JSONObject js = new JSONObject();
+// js.put("id", "upload-id-123");
+// js.put("Result", "Success");
+// js.put("Check", "Ok");
+// js.put("url", "http://localhost:80");
+// js.put("userName", "User");
+// js.put("password", "pass");
+// js.put("downloadUri", "http://127.0.0.1:80");
+// js.put("keyStore", "C:/Users/Huawei/Desktop/etc/conf/server.p12");
+// js.put("keyStorePass", "Changeme_123");
+// js.put("keyStoreType", "PKCS12");
+// JSONArray ja = new JSONArray();
+// String str = "{\n \"vim_id\": \"vim-0-1\",\n\t\"vim-info\": {\n\t\t\"vim-name\": \"vim-name-123\",\n\t\t\"vim-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ja.add(str);
+// JSONArray ja1 = new JSONArray();
+// String str1 = "{\n \"vnfdVersion\": \"1.0version\",\n\t\"vnfd-info\": {\n\t\t\"vnfd-name\": \"vnfd-name-123\",\n\t\t\"vnfd-id\": \"vim-0-1\",\n\t\t\"ip\": \"127.0.0.1\",\n\t\t\"port\": \"8482\",\n\t\t\"protocol\": \"http\",\n\t\t\n\t}\n}";
+// ;
+// ja1.add(str1);
+// JSONArray ja2 = new JSONArray();
+// String str2 = "{\"template_name\": \"VNFD_vUGW\",\"topology_template\":[{\"plan_name\": \"Normal_E9K\",\"plan_id\": \"Normal_E9K\"}]}";
+// ja2.add(str2);
+// JSONObject verTmpObj = ja2.getJSONObject(0);
+// JSONObject jsObject = new JSONObject();
+// jsObject.put("downloadUrl", "http://localhost:80");
+// jsObject.put("csarName", "CSCF");
+// JSONObject jsEms = new JSONObject();
+// jsEms.put("emsUuid", "123erbhi-hjdek123");
+// JSONObject jsCsar = new JSONObject();
+// jsCsar.put("csar_file_path", "/home/ubuntu/check/");
+// jsCsar.put("csar_file_name", "Csar_File");
+// jsCsar.put("emsUuid", jsEms);
+// JSONObject jsTemp = new JSONObject();
+// jsTemp.put("template", jsCsar);
+// js.put("vCSCF", jsTemp);
+// js.put("vim_info", ja);
+// js.put("template", verTmpObj);
+// js.put("templates", ja1);
+// js.put("packageInfo", jsObject);
+// return js;
+// }
+// };
+//
+// System.setProperty("catalina.base",
+// "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
JSONObject vnfpkg = new JSONObject();
JSONObject vnfpkg1 = new JSONObject();
@@ -3862,4 +3852,109 @@ public class AdapterResourceManagerTest {
JSONObject res = manager.uploadVNFPackage(vnfpkg1, paramsMap);
assertEquals(res.get("retCode"), 200);
}
+
+
+ @Test
+ public void transferFromCsarSI() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "CSCF_SI");
+ }
+
+ @Test
+ public void transferFromCsarCSCF() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "CSCF");
+ }
+
+ @Test
+ public void transferFromCsarMME() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "MME");
+ }
+
+ @Test
+ public void transferFromCsarSPGW() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "SPGW");
+ }
+
+ @Test
+ public void transferFromCsarHSS() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "HSS");
+ }
+
+ @Test
+ public void transferFromCsarSBC() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "SBC");
+ }
+
+ @Test
+ public void transferFromCsarPCRF() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "PCRF");
+ }
+
+ @Test
+ public void transferFromCsarTAS() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "TAS");
+ }
+
+ @Test
+ public void transferFromCsar() throws Exception {
+
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("transferFromCsar", new Class[] {String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, "transferFromCsar");
+ }
+
+ @Test
+ public void uploadCsar() throws Exception {
+ JSONObject vnfpkg = new JSONObject();
+ vnfpkg.put("ftp_server_ip","127.0.0.1");
+ vnfpkg.put("ftp_username","ftp_username");
+ vnfpkg.put("ftp_password","ftp_password");
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("uploadCsar", new Class[] {JSONObject.class,String.class});
+ m.setAccessible(true);
+ m.invoke(arManager, vnfpkg,"csarfilepath");
+
+ }
+
+
+ @Test
+ public void readVnfdIdInfoFromJson() throws Exception{
+ AdapterResourceManager arManager = new AdapterResourceManager();
+ Method m =AdapterResourceManager.class.getDeclaredMethod("readVnfdIdInfoFromJson");
+ m.setAccessible(true);
+ m.invoke(arManager);
+ }
+
} \ No newline at end of file
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/Driver2MSBManagerTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/Driver2MSBManagerTest.java
index 92263620..94a256a7 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/Driver2MSBManagerTest.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/Driver2MSBManagerTest.java
@@ -60,15 +60,15 @@ public class Driver2MSBManagerTest {
@Test
public void registerDriverTestNullResp() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
-
- return null;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+//
+// return null;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -79,18 +79,18 @@ public class Driver2MSBManagerTest {
@Test
public void registerDriverCreateSuccess() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
- response.setStatus(201);
-
- String vimStr = toJson(vim);
- response.setResponseJson(vimStr);
- return response;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+// response.setStatus(201);
+//
+// String vimStr = toJson(vim);
+// response.setResponseJson(vimStr);
+// return response;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -101,18 +101,18 @@ public class Driver2MSBManagerTest {
@Test
public void registerDriverOkSuccess() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
- response.setStatus(200);
-
- String vimStr = toJson(vim);
- response.setResponseJson(vimStr);
- return response;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+// response.setStatus(200);
+//
+// String vimStr = toJson(vim);
+// response.setResponseJson(vimStr);
+// return response;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -123,18 +123,18 @@ public class Driver2MSBManagerTest {
@Test
public void registerDriverTestInvalidParams() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
- response.setStatus(415);
-
- String vimStr = toJson(vim);
- response.setResponseJson(vimStr);
- return response;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+// response.setStatus(415);
+//
+// String vimStr = toJson(vim);
+// response.setResponseJson(vimStr);
+// return response;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -145,18 +145,18 @@ public class Driver2MSBManagerTest {
@Test
public void registerDriverTestInternalError() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
- response.setStatus(500);
-
- String vimStr = toJson(vim);
- response.setResponseJson(vimStr);
- return response;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+// response.setStatus(500);
+//
+// String vimStr = toJson(vim);
+// response.setResponseJson(vimStr);
+// return response;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -167,15 +167,15 @@ public class Driver2MSBManagerTest {
@Test
public void unregisterDriverTestNullResp() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
-
- return null;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+//
+// return null;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -186,18 +186,18 @@ public class Driver2MSBManagerTest {
@Test
public void unregisterDriverDeleteSuccess() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
- response.setStatus(204);
-
- String vimStr = toJson(vim);
- response.setResponseJson(vimStr);
- return response;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+// response.setStatus(204);
+//
+// String vimStr = toJson(vim);
+// response.setResponseJson(vimStr);
+// return response;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -208,18 +208,18 @@ public class Driver2MSBManagerTest {
@Test
public void unregisterDriverResourceNotFound() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
- response.setStatus(404);
-
- String vimStr = toJson(vim);
- response.setResponseJson(vimStr);
- return response;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+// response.setStatus(404);
+//
+// String vimStr = toJson(vim);
+// response.setResponseJson(vimStr);
+// return response;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -230,18 +230,18 @@ public class Driver2MSBManagerTest {
@Test
public void unregisterDriverTestInvalidParams() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
- response.setStatus(415);
-
- String vimStr = toJson(vim);
- response.setResponseJson(vimStr);
- return response;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+// response.setStatus(415);
+//
+// String vimStr = toJson(vim);
+// response.setResponseJson(vimStr);
+// return response;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");
@@ -252,18 +252,18 @@ public class Driver2MSBManagerTest {
@Test
public void unregisterDriverTestInternalError() {
- new MockUp<VNFRestfulUtil>() {
-
- @Mock
- public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
- RestfulResponse response = new RestfulResponse();
- response.setStatus(500);
-
- String vimStr = toJson(vim);
- response.setResponseJson(vimStr);
- return response;
- }
- };
+// new MockUp<VNFRestfulUtil>() {
+//
+// @Mock
+// public RestfulResponse getRemoteResponse(Map<String, String> paramsMap, String params) {
+// RestfulResponse response = new RestfulResponse();
+// response.setStatus(500);
+//
+// String vimStr = toJson(vim);
+// response.setResponseJson(vimStr);
+// return response;
+// }
+// };
Map<String, String> paramsMap = new HashMap<>();
paramsMap.put("url", "/test/api");
paramsMap.put("path", "http://localhost:8080");