Merge "Eliminate Sphinx Warnings from svnfm repo"
authorDénes Németh <denes.nemeth@nokia.com>
Wed, 19 Sep 2018 20:23:36 +0000 (20:23 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 19 Sep 2018 20:23:36 +0000 (20:23 +0000)
22 files changed:
huawei/pom.xml
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/ScaleManager.java
huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/RestfulConfigureTest.java [new file with mode: 0644]
huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManagerTest.java
huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check2.txt [new file with mode: 0644]
huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check3.txt [new file with mode: 0644]
huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check4.txt [new file with mode: 0644]
huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check5.txt [new file with mode: 0644]
huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check7.txt [new file with mode: 0644]
nokia/pom.xml
nokiav2/deployment/pom.xml
nokiav2/driver/pom.xml
nokiav2/driverwar/pom.xml
nokiav2/generatedapis/pom.xml
nokiav2/pom.xml
pom.xml
version.properties
zte/pom.xml
zte/vmanager/driver/swagger/swagger.json [deleted file]
zte/vmanager/driver/swagger/tests.py [deleted file]
zte/vmanager/driver/swagger/urls.py
zte/vmanager/driver/swagger/views.py [deleted file]

index b6f765e..275d5cc 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId>
         <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId>
-        <version>1.1.0-SNAPSHOT</version>
+        <version>1.2.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.huawei</groupId>
index e92da07..ce4e29b 100644 (file)
@@ -56,7 +56,7 @@ public abstract class ScaleManager {
             JSONArray vms = queryVms.getJSONObject("data").getJSONArray("vms");
             writeVmIdsToFile(vnfId, vms);
         } catch(JSONException e) {
-            LOG.error("function=beforeScaleOut, msg=recode current vms JSONException");
+            LOG.error("function=beforeScaleOut, msg=recode current vms JSONException", e);
         }
     }
 
@@ -77,7 +77,7 @@ public abstract class ScaleManager {
                 }
             }
         } catch(JSONException e) {
-            LOG.error("function=beforeScaleIn, msg=recode current vms JSONException");
+            LOG.error("function=beforeScaleIn, msg=recode current vms JSONException", e);
         }
         return vmList;
     }
@@ -136,9 +136,9 @@ public abstract class ScaleManager {
                 return JSONArray.fromObject(fileContent);
             }
         } catch(IOException e) {
-            LOG.error("function=readVmIdsFile, msg=read vms from file IOException, filePath : {}", filePath);
+            LOG.error("function=readVmIdsFile, msg=read vms from file IOException, filePath : {}" + filePath, " Load File Exception : " + e);
         } catch(JSONException e) {
-            LOG.error("function=readVmIdsFile, msg=read vms from file JSONException, fileContent : {}", fileContent);
+            LOG.error("function=readVmIdsFile, msg=read vms from file JSONException, fileContent : {}", fileContent, " JSON Exception : " + e);
         }
         return new JSONArray();
     }
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/RestfulConfigureTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/RestfulConfigureTest.java
new file mode 100644 (file)
index 0000000..9a40cda
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.restclient;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import net.sf.json.JSONException;
+
+public class RestfulConfigureTest {
+
+       @Test
+       public void testRestfulConfigure() {
+                RestfulConfigure rc = new  RestfulConfigure();
+                rc.toString();
+       }
+       
+       @Test
+       public void testRestfulConfigureStringNoFilePath() {
+                RestfulConfigure rc = new  RestfulConfigure("");
+                RestfulOptions rp = rc.getOptions();
+                assertTrue(true);
+       }
+
+       @Test
+       public void testRestfulConfigureStringNoFileExist() {
+                RestfulConfigure rc = new  RestfulConfigure("C:/Users/Public/Desktop");
+                RestfulOptions rp = rc.getOptions();
+                assertTrue(true);
+       }
+       
+       @Test
+       public void testRestfulConfigureString() {
+                RestfulConfigure rc = new  RestfulConfigure("src/test/resources/Check7.txt");
+                RestfulOptions rp = rc.getOptions();
+                assertTrue(true);
+       }
+       
+       @Test
+       public void testRestfulConfigureStringNoFile() {
+                RestfulConfigure rc = new  RestfulConfigure("src/test/resources/Check1.txt");
+                RestfulOptions rp = rc.getOptions();
+                assertTrue(true);
+       }
+       
+       @Test
+       public void testRestfulConfigureStringWrongFile() {
+                RestfulConfigure rc = new  RestfulConfigure("src/test/resources/Check2.txt");
+                RestfulOptions rp = rc.getOptions();
+                assertTrue(true);
+       }
+       
+       @Test
+       public void testRestfulConfigureStringEmptyFile() {
+                RestfulConfigure rc = new  RestfulConfigure("src/test/resources/Check3.txt");
+                RestfulOptions rp = rc.getOptions();
+                assertTrue(true);
+       }
+       @Test
+       public void testRestfulConfigureStringNoHostFile() {
+                RestfulConfigure rc = new  RestfulConfigure("src/test/resources/Check4.txt");
+                RestfulOptions rp = rc.getOptions();
+                assertTrue(true);
+       }
+       @Test(expected=JSONException.class)
+       public void testRestfulConfigureStringZeroFile() throws IOException {
+                RestfulConfigure rc = new  RestfulConfigure("src/test/resources/Check5.txt");
+                rc.getOptions();
+       }
+       /*@Test
+       public void testRestfulConfigureStringClose()  {
+                RestfulConfigure rc = new  RestfulConfigure("src/test/resources/Check6.txt");
+                rc.getOptions();
+       }*/
+}
index 9572733..1b4e9c3 100644 (file)
@@ -23,16 +23,23 @@ import java.io.IOException;
 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.adapter.impl.AdapterResourceManager;
+import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.servicetoken.VnfmRestfulUtil;
+import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.connect.ConnectMgrVnfm;
 import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.testutils.JsonUtil;
-import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.restclient.RestfulResponse;
 
 import mockit.Mock;
 import mockit.MockUp;
+import net.sf.json.JSONArray;
 import net.sf.json.JSONException;
 import net.sf.json.JSONObject;
 
@@ -45,22 +52,25 @@ public class AdapterResourceManagerTest {
         manager = new AdapterResourceManager();
     }
 
-    @Test(expected = JSONException.class)
+    @Test(expected=JSONException.class)
     public void uploadVNFPackageTestJsonException() {
         JSONObject vnfpkg = new JSONObject();
         Map<String, String> paramsMap = new HashMap<>();
         JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
-        assertTrue(res != null);
-
     }
-
-    @Test(expected = JSONException.class)
-    public void uploadVNFPackageTestJsonException2() {
+    
+     @Test
+    public void uploadVNFPackageTestJsonException1() {
         JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("", "");
         Map<String, String> paramsMap = new HashMap<>();
-        JSONObject res = manager.uploadVNFPackage(null, paramsMap);
-        assertTrue(res != null);
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+    }
 
+    @Test(expected=JSONException.class)
+    public void uploadVNFPackageTestJsonException2() {
+        Map<String, String> paramsMap = new HashMap<>();
+         manager.uploadVNFPackage(null, paramsMap);
     }
 
     @Test
@@ -83,11 +93,10 @@ public class AdapterResourceManagerTest {
 
     }
 
-    @Test
+    @Test(expected=NullPointerException.class)
     public void uploadVNFPackageTestNullParam() {
         JSONObject vnfpkg = new JSONObject();
         vnfpkg.put("name", "test");
-        Map<String, String> paramsMap = new HashMap<>();
         JSONObject res = manager.uploadVNFPackage(vnfpkg, null);
         assertTrue(res.get("reason").equals("csarid and vnfmid are null."));
 
@@ -309,4 +318,3286 @@ public class AdapterResourceManagerTest {
         manager.getVnfdVersion("http://","127.0.0.1","token");
     }
 
+    @Test(expected=NullPointerException.class)
+    public void testgetVNFDPlanInfoNull(){
+       
+       manager.getVNFDPlanInfo(null, null, null);
+       }
+    
+    @Test
+    public void testgetVNFDPlanInfo(){
+       
+       manager.getVNFDPlanInfo("https://127.0.0.1:80", "vnfd123", "token");
+       }
+    
+    @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;
+                                  }
+               
+           };
+       
+       manager.getVNFDPlanInfo("https://127.0.0.1:80", "vnfd123", "accessSession");
+       }
+    
+    @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;
+                                  }
+               
+           };
+       
+       manager.getVNFDPlanInfo("https://127.0.0.1:80", "vnfd123", "accessSession");
+       }
+    
+    
+    @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;
+                                  }
+               
+           };
+           
+           JSONObject jobj = manager.getVnfdVersion("http://","127.0.0.1:80","accessSession");
+    }
+    
+    @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;
+                          }
+           };
+           
+        manager.getVnfdVersion("http://","127.0.0.1:80","accessSession");
+    }
+    
+    @Test
+    public void uploadVNFPackageTestcsarid() {
+        RestfulParametes rp = new RestfulParametes();
+         rp.setRawData("success");
+         rp.setRawData("sdjhbfj");
+         HashMap<String,String>  headerMap = new HashMap<String,String>();
+         headerMap.put("Content-Type", "application/json");
+         headerMap.put("X-TransactionId", "5851");
+         rp.setHeaderMap(headerMap);
+         HashMap<String,String>  paramMap = new HashMap<String,String>();
+         paramMap.put("id", "1234");
+         rp.setParamMap(paramMap);
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        vnfpkg.put("Restfulparameters", rp);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid200");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+    }
+    
+    @Test
+    public void uploadVNFPackageTestcsaridNull() {
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "caser200");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @Test
+    public void uploadVNFPackageTestParamEmpty() {
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        Map<String, String> paramsMap = new HashMap<>();
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+    }
+    
+    @Test
+    public void downloadCsarTestUrlAndFilePathWrong() {
+        String url = "http://localhost:8080";
+        String filePath = "Tset";
+        JSONObject res = manager.downloadCsar(url, filePath);
+    }
+    @Test
+    public void downloadCsarTestUrlAndFilePath() {
+        String url = "https://127.0.0.1:31943";
+        String filePath = "src/test/resources/Check.txt";
+        JSONObject res = manager.downloadCsar(url, filePath);
+    }
+     
+    @Test
+    public void testGetAllCloudUrlEmpty(){
+        String url = "";
+        manager.getAllCloud(url,null);
+    }
+    
+    @Test
+    public void testGetAllCloudUrlandConn(){
+        String url = "http://127.0.0.1:31943";
+        String conn = "conn";
+        manager.getAllCloud(url,conn);
+    }
+    
+    @Test
+    public void testUnzipCSAREmpty(){
+        manager.unzipCSAR("vCpe.zip","");
+    }
+    @Test
+    public void testUnzipCSAREmpty1(){
+        manager.unzipCSAR("","/opt");
+    }
+    
+    @Test
+    public void readVfnPkgInfoFromJsonTest() throws IOException{
+       
+       System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+       AdapterResourceManager.readVfnPkgInfoFromJson();
+    }
+    @Test
+    public void readVfnPkgInfoFromJsonTestNumBelowZero() throws IOException{
+       
+       System.setProperty("catalina.base", "C:/Users/Huawei/Desktop");
+       AdapterResourceManager.readVfnPkgInfoFromJson();
+    }
+    
+    @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;
+                                  }
+               
+           };
+           
+           System.setProperty("catalina.base", "C:/Users/Huawei/Desktop");
+        String url = "http://127.0.0.1:31943";
+        String conn = "accessSession";
+        manager.getAllCloud(url,conn);
+    }
+    
+    @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;
+                                  }
+               
+           };
+           
+           System.setProperty("catalina.base", "C:/Users/Huawei/Desktop");
+        String url = "http://127.0.0.1:31943";
+        String conn = "accessSession";
+        manager.getAllCloud(url,conn);
+    }
+    
+    @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;
+                                  }
+               
+           };
+           
+       JSONObject vnfpackage = new JSONObject();
+       vnfpackage.put("UserName", "User");
+       vnfpackage.put("password", "Pass");
+       String vnfmurl = "http://127.0.0.1:31943";
+         String conntoken = "accessSession";
+         System.setProperty("catalina.base", "src/test/resources/");
+       manager.upload(vnfpackage, vnfmurl, conntoken);
+    }
+    
+    @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;
+                                  }
+               
+           };
+           
+       JSONObject vnfpackage = new JSONObject();
+       vnfpackage.put("UserName", "User");
+       vnfpackage.put("password", "Pass");
+       String vnfmurl = "http://127.0.0.1:31943";
+         String conntoken = "accessSession";
+         System.setProperty("catalina.base", "src/test/resources/");
+       manager.upload(vnfpackage, vnfmurl, conntoken);
+    }
+    
+    @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;
+                                  }
+               
+           };
+           
+       JSONObject vnfpackage = new JSONObject();
+       vnfpackage.put("UserName", "User");
+       vnfpackage.put("password", "Pass");
+       String vnfmurl = "http://127.0.0.1:31943";
+         String conntoken = "accessSession";
+         System.setProperty("catalina.base", "src/test/resources/");
+       manager.upload(vnfpackage, vnfmurl, conntoken);
+    }
+    
+    @Test
+    public void testGetVnfmCsarInfoEmpty(){
+       manager.getVnfmCsarInfo("");
+    }
+    @Test
+    public void testGetVnfmCsarInfoNull(){
+       manager.getVnfmCsarInfo(null);
+    }
+    /*@Test
+    public void testGetVnfmCsarInfo(){
+       manager.getVnfmCsarInfo("casr-id-123");
+    }*/
+    @Test
+    public void downloadCsarTest() {
+       
+       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";
+        JSONObject res = manager.downloadCsar(url, filePath);
+        assertTrue(true);
+    }
+    
+    @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;
+       }
+       };
+
+       JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(true);
+
+    }
+    
+    @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";
+               
+               }
+               };
+       
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(true);
+
+    }
+    
+    @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;
+               
+               }
+               };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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;
+               
+               }
+               };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        obj.put("ftp_server_ip", "https:127.0.0.1:80");
+        obj.put("ftp_username", "FtpUser");
+        obj.put("ftp_password", "FtpPass");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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;
+               
+               }
+               };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(true);
+
+    }
+    
+    
+    @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;
+               
+               }
+               };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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;
+                       }
+                       
+               };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(true);
+
+    }
+    
+    @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;
+                                          }
+                   };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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;
+                                          }
+                   };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(true);
+
+    }
+    
+    @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;
+                                          }
+                   };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    @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;
+                                          }
+                   };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    @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;
+                                          }
+                   };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    @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;
+                                          }
+                   };
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(true);
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+
+    
+    @Test
+    public void uploadVNFPackageTestParamMapEmpty() {
+       
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("", "");
+        paramsMap.put("", "");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(true);
+    }
+    
+    @Test
+    public void uploadVNFPackageTestVnfpkgEmpty() {
+       
+        JSONObject vnfpkg = new JSONObject();
+         vnfpkg.put("", "");
+         JSONObject obj = new JSONObject();
+         obj.put("csar_file_path", "src/test/resources/Check10.txt");
+         obj.put("csar_file_name", "casrFile");
+         vnfpkg.put("template", obj);
+         Map<String, String> paramsMap = new HashMap<>();
+         paramsMap.put("csarid", "csarid123");
+         paramsMap.put("vnfmid", "vnfmid1234");
+         JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+         assertTrue(true);
+    }
+    
+       @Test
+    public void readScaleInVmIdFromJsonTest() {
+       
+       System.setProperty("catalina.base", "D:/VFC/23-08-2018/svnfm/huawei/vnfmadapter/VnfmadapterService/deployment/src/main/release");
+       AdapterResourceManager.readScaleInVmIdFromJson();
+    }
+       
+       @Test
+    public void readScaleInVmIdFromJsonTestNoFile() {
+       
+               System.setProperty("catalina.base", "src/test/resources");
+       AdapterResourceManager.readScaleInVmIdFromJson();
+    }
+       
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("download csar file failed."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg, paramsMap);
+        assertTrue(res.get("reason").equals("download csar file failed."));
+
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        JSONObject vnfpkg1 = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg1, paramsMap);
+        assertTrue(res.get("reason").equals("download csar file failed."));
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        JSONObject vnfpkg1 = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg1, paramsMap);
+        assertTrue(res.get("reason").equals("download csar file failed."));
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        JSONObject vnfpkg1 = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg1, paramsMap);
+        assertTrue(res.get("reason").equals("unzip csar file failed."));
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        JSONObject vnfpkg1 = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg1, paramsMap);
+        assertTrue(res.get("reason").equals("connect fail."));
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        JSONObject vnfpkg1 = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg1, paramsMap);
+        assertTrue(res.get("reason").equals("RestfulResponse is null."));
+    }
+    
+    @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");
+               
+        JSONObject vnfpkg = new JSONObject();
+        JSONObject vnfpkg1 = new JSONObject();
+        vnfpkg.put("name", "test");
+        JSONObject obj = new JSONObject();
+        obj.put("csar_file_path", "src/test/resources/Check10.txt");
+        obj.put("csar_file_name", "casrFile");
+        vnfpkg.put("template", obj);
+        Map<String, String> paramsMap = new HashMap<>();
+        paramsMap.put("csarid", "csarid123");
+        paramsMap.put("vnfmid", "vnfmid1234");
+        JSONObject res = manager.uploadVNFPackage(vnfpkg1, paramsMap);
+        assertTrue(res.get("reason").equals("get allcloud failed and IOException.Connection refused: connect"));
+    }
+    
 }
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check2.txt b/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check2.txt
new file mode 100644 (file)
index 0000000..926dc20
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "defaultServer":
+    {
+        "host":"",
+        "port":"80"
+    },
+"ConnectTimeout":"300000",
+"thread":"10",
+"idletimeout":"500000",
+"timeout":"300000"
+}
+               
\ No newline at end of file
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check3.txt b/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check3.txt
new file mode 100644 (file)
index 0000000..08e3741
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "":
+    {
+        "host":"",
+        "port":""
+    },
+"":"",
+"":"",
+"":"",
+"":""
+}
+               
\ No newline at end of file
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check4.txt b/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check4.txt
new file mode 100644 (file)
index 0000000..7ccbf2b
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "defaultServer":
+    {
+        "":"127.0.0.1",
+        "port":"80"
+    },
+"ConnectTimeout":"300000",
+"thread":"10",
+"idletimeout":"500000",
+"timeout":"300000"
+}
+               
\ No newline at end of file
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check5.txt b/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check5.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check7.txt b/huawei/vnfmadapter/VnfmadapterService/service/src/test/resources/Check7.txt
new file mode 100644 (file)
index 0000000..47c4e08
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "defaultServer":
+    {
+        "host":"127.0.0.1",
+        "port":"80"
+    },
+"ConnectTimeout":"300000",
+"thread":"10",
+"idletimeout":"500000",
+"timeout":"300000"
+}
+               
\ No newline at end of file
index 7fd5cdf..c3d3dc5 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId>
         <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId>
-        <version>1.1.0-SNAPSHOT</version>
+        <version>1.2.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia</groupId>
index 2f300e7..abf8ef1 100644 (file)
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <artifactId>deployment</artifactId>
-  <version>1.1.1-SNAPSHOT</version>
+  <version>1.2.0-SNAPSHOT</version>
   <packaging>pom</packaging>
   <name>vfc/nfvo/driver/vnfm/svnfm/nokiav2/deployment</name>
   <description>Nokia SVNFM driver deployment files</description>
   <parent>
     <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
     <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>1.2.0-SNAPSHOT</version>
   </parent>
   <build>
     <plugins>
index 956ef95..5fe7d3c 100644 (file)
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <artifactId>driver</artifactId>
-  <version>1.1.1-SNAPSHOT</version>
+  <version>1.2.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <name>vfc/nfvo/driver/vnfm/svnfm/nokiav2/driver</name>
   <description>svnfm vnfm driver</description>
   <parent>
     <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
     <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>1.2.0-SNAPSHOT</version>
   </parent>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -35,7 +35,7 @@
     <dependency>
       <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
       <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2-clients</artifactId>
-      <version>1.1.1-SNAPSHOT</version>
+      <version>1.2.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.springframework.boot</groupId>
@@ -84,7 +84,6 @@
     <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
-      <version>25.0-jre</version>
     </dependency>
     <dependency>
       <groupId>org.apache.httpcomponents</groupId>
@@ -95,7 +94,7 @@
       <!-- parsing VNFDs -->
       <groupId>org.yaml</groupId>
       <artifactId>snakeyaml</artifactId>
-      <version>1.19</version>
+      <version>1.23</version>
     </dependency>
     <dependency>
       <groupId>pl.pojo</groupId>
     <dependency>
       <groupId>org.eclipse.jetty</groupId>
       <artifactId>jetty-server</artifactId>
-      <version>9.4.9.v20180320</version>
+      <version>9.4.12.v20180830</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.7.0</version>
+        <version>3.8.0</version>
         <configuration>
           <source>1.8</source>
           <target>1.8</target>
index 7215e3f..76bb6ef 100644 (file)
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
   <artifactId>driverwar</artifactId>
-  <version>1.1.1-SNAPSHOT</version>
+  <version>1.2.0-SNAPSHOT</version>
   <packaging>war</packaging>
   <name>vfc/nfvo/driver/vnfm/svnfm/nokiav2/driverwar</name>
   <description>svnfm vnfm driver</description>
   <parent>
     <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
     <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>1.2.0-SNAPSHOT</version>
   </parent>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -36,7 +36,7 @@
     <dependency>
       <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
       <artifactId>driver</artifactId>
-      <version>1.1.1-SNAPSHOT</version>
+      <version>1.2.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.springframework.boot</groupId>
@@ -64,7 +64,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
-        <version>3.2.0</version>
+        <version>3.2.2</version>
         <configuration>
           <failOnMissingWebXml>false</failOnMissingWebXml>
           <archive>
@@ -94,7 +94,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.7.0</version>
+        <version>3.8.0</version>
         <configuration>
           <source>1.8</source>
           <target>1.8</target>
index 294158c..21d1971 100644 (file)
   <parent>
     <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
     <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>1.2.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
   <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2-clients</artifactId>
-  <version>1.1.1-SNAPSHOT</version>
+  <version>1.2.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <name>vfc/nfvo/driver/vnfm/svnfm/nokiav2/generatedapis</name>
   <properties>
@@ -367,7 +367,6 @@ Release AAI
     <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
-      <version>25.0-jre</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
index 52a368e..fe6fe1c 100644 (file)
   <parent>
     <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId>
     <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId>
-    <version>1.1.0-SNAPSHOT</version>
+    <version>1.2.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
   <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2</artifactId>
-  <version>1.1.1-SNAPSHOT</version>
+  <version>1.2.0-SNAPSHOT</version>
   <packaging>pom</packaging>
   <name>vfc-nfvo-driver-vnfm-svnfm-nokiav2</name>
   <properties>
     <jacoco.version>0.8.0</jacoco.version>
-    <spring.boot.version>2.0.2.RELEASE</spring.boot.version>
+    <spring.boot.version>2.0.5.RELEASE</spring.boot.version>
   </properties>
   <!-- used to test dependency convergence locally
   <build>
diff --git a/pom.xml b/pom.xml
index f8f1902..e2f69cd 100644 (file)
--- a/pom.xml
+++ b/pom.xml
   <parent>
     <groupId>org.onap.oparent</groupId>
     <artifactId>oparent</artifactId>
-    <version>1.1.0</version>
+    <version>1.2.0</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId>
   <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId>
-  <version>1.1.0-SNAPSHOT</version>
+  <version>1.2.0-SNAPSHOT</version>
   <packaging>pom</packaging>
   <name>vfc-nfvo-driver-vnfm-svnfm</name>
   <description>vfc-nfvo-driver-vnfm-svnfm</description>
index d7c69cd..2cddbb0 100644 (file)
@@ -18,7 +18,7 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 major=1
-minor=1
+minor=2
 patch=0
 
 base_version=${major}.${minor}.${patch}
index 6af4bcc..e1d45b5 100644 (file)
@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId>
         <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId>
-        <version>1.1.0-SNAPSHOT</version>
+        <version>1.2.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.zte</groupId>
diff --git a/zte/vmanager/driver/swagger/swagger.json b/zte/vmanager/driver/swagger/swagger.json
deleted file mode 100644 (file)
index dfe53df..0000000
+++ /dev/null
@@ -1,545 +0,0 @@
-{
-  "swagger": "2.0",
-  "info": {
-    "version": "1.0.0",
-    "title": "ZTE VNFM Driver Service rest API"
-  },
-  "basePath": "/api/ztevnfmdriver/v1",
-  "tags": [
-    {
-      "name": "ztevnfmdriver"
-    }
-  ],
-  "paths": {
-    "/{vnfmid}/vnfs": {
-      "post": {
-        "tags": [
-          "vnf instantiate"
-        ],
-        "summary": "instantiate the vnf",
-        "description": "",
-        "operationId": "instantiate_vnf",
-        "consumes": [
-          "application/json"
-        ],
-        "produces": [
-          "application/json"
-        ],
-        "parameters": [
-          {
-            "name": "vnfmid",
-            "in": "path",
-            "description": "vnfm instance id",
-            "required": true,
-            "type": "string"
-          },
-          {
-            "name": "body",
-            "in": "body",
-            "description": "request parameters",
-            "required": true,
-            "schema": {
-              "$ref": "#/definitions/VnfRequestParams"
-            }
-          }
-        ],
-        "responses": {
-          "200": {
-            "description": "successful operation",
-            "schema": {
-              "$ref": "#/definitions/VnfResult"
-            }
-          },
-          "404": {
-            "description": "the vnfm instance id is wrong"
-          },
-          "500": {
-            "description": "the url is invalid"
-          }
-        }
-      }
-    },
-    "/{vnfmid}/vnfs/{vnfInstanceId}/terminate": {
-      "post": {
-        "tags": [
-          "vnf terminate"
-        ],
-        "summary": "terminate the vnf",
-        "description": "",
-        "operationId": "terminate_vnf",
-        "consumes": [
-          "application/json"
-        ],
-        "produces": [
-          "application/json"
-        ],
-        "parameters": [
-          {
-            "name": "vnfmid",
-            "in": "path",
-            "description": "vnfm instance id",
-            "required": true,
-            "type": "string"
-          },
-          {
-            "name": "vnfInstanceId",
-            "in": "path",
-            "description": "vnf instance id",
-            "required": true,
-            "type": "string"
-          }
-        ],
-        "responses": {
-          "200": {
-            "description": "successful operation",
-            "schema": {
-              "$ref": "#/definitions/VnfResult"
-            }
-          },
-          "404": {
-            "description": "the vnfmid and vnfInstanceId  are wrong"
-          },
-          "500": {
-            "description": "the url is invalid"
-          }
-        }
-      }
-    },
-    "/{vnfmid}/vnfs/{vnfInstanceId}": {
-      "get": {
-        "tags": [
-          "query vnf"
-        ],
-        "summary": "query the vnf",
-        "description": "",
-        "operationId": "query_vnf",
-        "consumes": [
-          "application/json"
-        ],
-        "produces": [
-          "application/json"
-        ],
-        "parameters": [
-          {
-            "name": "vnfmid",
-            "in": "path",
-            "description": "vnfm instance id",
-            "required": true,
-            "type": "string"
-          },
-          {
-            "name": "vnfInstanceId",
-            "in": "path",
-            "description": "vnf instance id",
-            "required": true,
-            "type": "string"
-          }
-        ],
-        "responses": {
-          "200": {
-            "description": "successful operation",
-            "schema": {
-              "$ref": "#/definitions/returnVnfInfo"
-            }
-          },
-          "404": {
-            "description": "the vnfmid and vnfInstanceId  are wrong"
-          },
-          "500": {
-            "description": "the url is invalid"
-          }
-        }
-      }
-    },
-    "/{vnfmid}/jobs/{jobid}": {
-      "get": {
-        "tags": [
-          "operation status"
-        ],
-        "summary": "operation status",
-        "description": "",
-        "operationId": "operation_status",
-        "consumes": [
-          "application/json"
-        ],
-        "produces": [
-          "application/json"
-        ],
-        "parameters": [
-          {
-            "name": "vnfmid",
-            "in": "path",
-            "description": "vnfm instance id",
-            "required": true,
-            "type": "string"
-          },
-          {
-            "name": "jobid",
-            "in": "path",
-            "description": "vnf job id",
-            "required": true,
-            "type": "string"
-          },
-          {
-            "name": "responseId",
-            "in": "path",
-            "description": "vnf response id",
-            "required": true,
-            "type": "integer"
-          }
-        ],
-        "responses": {
-          "200": {
-            "description": "successful operation",
-            "schema": {
-              "$ref": "#/definitions/OperationStatusInfo"
-            }
-          },
-          "404": {
-            "description": "the vnfmid ,jobid and responseId are wrong"
-          },
-          "500": {
-            "description": "the url is invalid"
-          }
-        }
-      }
-    },
-    "/resource/grant": {
-      "put": {
-        "tags": [
-          "grant vnf"
-        ],
-        "summary": "grant the vnf",
-        "description": "",
-        "operationId": "grant_vnf",
-        "consumes": [
-          "application/json"
-        ],
-        "produces": [
-          "application/json"
-        ],
-        "parameters": [
-          {
-            "name": "body",
-            "in": "body",
-            "description": "request data for grant the vnf",
-            "required": true,
-            "schema": {
-              "$ref": "#/definitions/RequestGrantParams"
-            }
-          }
-        ],
-        "responses": {
-          "201": {
-            "description": "successful grant",
-            "schema": {
-              "$ref": "#/definitions/responseGrantResult"
-            }
-          },
-          "404": {
-            "description": "the request body is wrong"
-          },
-          "500": {
-            "description": "the url is invalid"
-          }
-        }
-      }
-    },
-    "/vnfs/lifecyclechangesnotification": {
-      "post": {
-        "tags": [
-          "life cycle changes notification"
-        ],
-        "summary": "life cycle changes notification",
-        "description": "",
-        "operationId": "lifecyclechangesnotification",
-        "consumes": [
-          "application/json"
-        ],
-        "produces": [
-          "application/json"
-        ],
-        "parameters": [
-          {
-            "name": "body",
-            "in": "body",
-            "description": "request data for grant the vnf",
-            "required": true,
-            "schema": {
-              "$ref": "#/definitions/RequestNotifyParams"
-            }
-          }
-        ],
-        "responses": {
-          "201": {
-            "description": "successful Notify",
-            "schema": {
-              "$ref": "#/definitions/ResponseNotifyResult"
-            }
-          },
-          "404": {
-            "description": "the request body is wrong"
-          },
-          "500": {
-            "description": "the url is invalid"
-          }
-        }
-      }
-    },
-    "/{vnfmid}/vnfs/{nfInstanceId}/scale": {
-      "post": {
-        "tags": [
-          "scale vnf"
-        ],
-        "summary": "scale vnf",
-        "description": "",
-        "operationId": "scale_vnf",
-        "consumes": [
-          "application/json"
-        ],
-        "produces": [
-          "application/json"
-        ],
-        "parameters": [
-          {
-            "name": "vnfmid",
-            "in": "path",
-            "description": "vnfm instance id",
-            "required": true,
-            "type": "string"
-          },
-          {
-            "name": "nfInstanceId",
-            "in": "path",
-            "description": "nf instance id",
-            "required": true,
-            "type": "string"
-          },
-          {
-            "name": "body",
-            "in": "body",
-            "description": "request data for grant the vnf",
-            "required": true,
-            "schema": {
-              "$ref": "#/definitions/RequestScaleParams"
-            }
-          }
-        ],
-        "responses": {
-          "201": {
-            "description": "successful scale",
-            "schema": {
-              "$ref": "#/definitions/ResponseScaleResult"
-            }
-          },
-          "404": {
-            "description": "the request body is wrong"
-          },
-          "500": {
-            "description": "the url is invalid"
-          }
-        }
-      }
-    }
-  },
-  "definitions": {
-    "VnfRequestParams": {
-      "type": "object",
-      "properties": {
-        "vnfInstanceName": {
-          "type": "string"
-        },
-        "vnfPackageId": {
-          "type": "string"
-        },
-        "vnfDescriptorId": {
-          "type": "string"
-        },
-        "additionalParam": {
-          "type": "object",
-          "properties": {
-            "sdncontroller": {
-              "type": "string"
-            },
-            "NatIpRange": {
-              "type": "string"
-            },
-            "m6000_mng_ip": {
-              "type": "string"
-            },
-            "externalPluginManageNetworkName": {
-              "type": "string"
-            },
-            "location": {
-              "type": "string"
-            },
-            "externalManageNetworkName": {
-              "type": "string"
-            },
-            "sfc_data_network": {
-              "type": "string"
-            },
-            "externalDataNetworkName": {
-              "type": "string"
-            },
-            "inputs": {
-              "type": "object"
-            }
-          }
-        }
-      }
-    },
-    "VnfResult": {
-      "type": "object",
-      "properties": {
-        "vnfInstanceId": {
-          "type": "string"
-        },
-        "jobId": {
-          "type": "string"
-        }
-      }
-    },
-    "returnVnfInfo": {
-      "type": "object",
-      "properties": {
-        "vnfInfo": {
-          "type": "object",
-          "properties": {
-            "vnfStatus": {
-              "type": "string"
-            }
-          }
-        }
-      }
-    },
-    "OperationStatusInfo": {
-      "type": "object",
-      "properties": {
-        "responsedescriptor": {
-          "type": "object",
-          "properties": {
-            "status": {
-              "type": "string"
-            },
-            "responsehistorylist": {
-              "type": "string"
-            },
-            "responseid": {
-              "type": "integer"
-            },
-            "errorcode": {
-              "type": "string"
-            },
-            "progress": {
-              "type": "integer"
-            },
-            "statusdescription": {
-              "type": "string"
-            }
-          }
-        },
-        "jobid": {
-          "type": "string"
-        }
-      }
-    },
-    "RequestGrantParams": {
-      "type": "object",
-      "properties": {
-        "vnfmid": {
-          "type": "string"
-        },
-        "nfvoid": {
-          "type": "string"
-        },
-        "vimid": {
-          "type": "string"
-        },
-        "exvimidlist": {
-          "type": "string"
-        },
-        "tenant": {
-          "type": "string"
-        },
-        "vnfistanceid": {
-          "type": "string"
-        },
-        "operationright": {
-          "type": "string"
-        },
-        "vmlist": {
-          "type": "string"
-        }
-      }
-    },
-    "responseGrantResult": {
-      "type": "object",
-      "properties": {
-        "vimid": {
-          "type": "string"
-        },
-        "tenant": {
-          "type": "string"
-        }
-      }
-    },
-    "RequestNotifyParams": {
-      "type": "object",
-      "properties": {
-        "nfvoid": {
-          "type": "string"
-        },
-        "vnfmid": {
-          "type": "string"
-        },
-        "vimid": {
-          "type": "string"
-        },
-        "timestamp": {
-          "type": "string"
-        },
-        "vnfinstanceid": {
-          "type": "string"
-        },
-        "eventtype": {
-          "type": "string"
-        },
-        "vmlist": {
-          "type": "string"
-        }
-      }
-    },
-    "ResponseNotifyResult": {
-      "type": "object"
-    },
-    "RequestScaleParams": {
-      "type": "object",
-      "properties": {
-        "type": {
-          "type": "string"
-        },
-        "aspectId": {
-          "type": "string"
-        },
-        "numberOfSteps": {
-          "type": "string"
-        },
-        "additionalParam": {
-          "type": "object"
-        }
-      }
-    },
-    "ResponseScaleResult": {
-      "type": "object",
-      "properties": {
-        "jobid": {
-          "type": "string"
-        },
-        "nfInstanceId": {
-          "type": "string"
-        }
-      }
-    }
-  }
-}
\ No newline at end of file
diff --git a/zte/vmanager/driver/swagger/tests.py b/zte/vmanager/driver/swagger/tests.py
deleted file mode 100644 (file)
index 981329a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2017 ZTE Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import unittest
-
-from django.test import Client
-from rest_framework import status
-
-
-class SwaggerViewTest(unittest.TestCase):
-    def setUp(self):
-        self.client = Client()
-
-    def tearDown(self):
-        pass
-
-    def test_sample(self):
-        response = self.client.get("/api/ztevnfmdriver/v1/swagger.json")
-        self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
index dc377d3..56c3c8b 100644 (file)
@@ -35,7 +35,6 @@ SchemaView = get_schema_view(
 )
 
 urlpatterns = [
-    # url(r'^api/ztevnfmdriver/v1/swagger.json$', views.SwaggerView.as_view()),
     url(r'^api/ztevnfmdriver/v1/swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
     url(r'^api/ztevnfmdriver/v1/swagger$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
     url(r'^api/ztevnfmdriver/v1/redoc$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc')
diff --git a/zte/vmanager/driver/swagger/views.py b/zte/vmanager/driver/swagger/views.py
deleted file mode 100644 (file)
index 400d6dd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 2017 ZTE Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-import os
-import json
-from rest_framework.views import APIView
-from rest_framework.response import Response
-
-
-class SwaggerView(APIView):
-    def get(self, request, format=None):
-        json_file = os.path.join(os.path.dirname(__file__), 'swagger.json')
-        f = open(json_file)
-        json_data = json.JSONDecoder().decode(f.read())
-        f.close()
-        return Response(json_data)