Merge "Method handling nokia-vnfmdriver"
[vfc/nfvo/driver/vnfm/svnfm.git] / nokia / vnfmdriver / vfcadaptorservice / vfcadaptor / src / main / java / org / onap / vfc / nfvo / driver / vnfm / svnfm / adaptor / Driver2CbamRequestConverter.java
index 8c60cc6..cb783c4 100644 (file)
@@ -54,19 +54,15 @@ public class Driver2CbamRequestConverter {
        }
 
        public CBAMInstantiateVnfRequest instantiateRequestConvert(InstantiateVnfRequest driverRequest,
-                       NslcmGrantVnfResponse nslc, GrantInfo grant, VimComputeResourceFlavour vimco) throws IOException{
-               Gson gson = new Gson();
+                       NslcmGrantVnfResponse nslc, GrantInfo grant, VimComputeResourceFlavour vimco) throws IOException {
+        Gson gson = new Gson();
                String inputJson = readcbamInputInfoFromJsonFile();
-               CBAMInstantiateVnfRequest request = gson.fromJson(inputJson, CBAMInstantiateVnfRequest.class);
-
-               return request;
+               return gson.fromJson(inputJson, CBAMInstantiateVnfRequest.class);
        }
 
        private String readcbamInputInfoFromJsonFile() throws IOException {
                String filePath = "/etc/vnfpkginfo/cbam_input.json";
-               String fileContent = CommonUtil.getJsonStrFromFile(filePath);
-
-               return fileContent;
+               return CommonUtil.getJsonStrFromFile(filePath);
        }
 
        public CBAMTerminateVnfRequest terminateReqConvert(TerminateVnfRequest driverRequest) {
@@ -77,7 +73,7 @@ public class Driver2CbamRequestConverter {
                return request;
        }
 
-       public CBAMHealVnfRequest healReqConvert(HealVnfRequest driverRequest) {
+       public CBAMHealVnfRequest healReqConvert() {
                CBAMHealVnfRequest request = new CBAMHealVnfRequest();
                request.setCause("");
                request.setAdditionalParams("");
@@ -96,5 +92,41 @@ public class Driver2CbamRequestConverter {
                request.setAdditionalParams(driverRequest.getAdditionalParam());
                return request;
        }
-
+       
+//     public static void main(String[] argv) throws IOException {
+//             Gson gson = new Gson();
+//             String filePath = "D:\\cbam_input.json";
+//             String inputJson = readcbamInputInfo(filePath);
+//             CBAMInstantiateVnfRequest request = gson.fromJson(inputJson, CBAMInstantiateVnfRequest.class);
+//             System.out.println(gson.toJson(request));
+//     }
+//     
+//     public static String readcbamInputInfo(String filePath) throws IOException {
+//             InputStream ins = null;
+//        BufferedInputStream bins = null;
+//        String fileContent = "";
+//        String fileName = filePath;
+//
+//        try {
+//            ins = new FileInputStream(fileName);
+//            bins = new BufferedInputStream(ins);
+//
+//            byte[] contentByte = new byte[ins.available()];
+//            int num = bins.read(contentByte);
+//
+//            if(num > 0) {
+//                fileContent = new String(contentByte);
+//            }
+//        } catch(FileNotFoundException e) {
+//             e.printStackTrace();;
+//        } finally {
+//            if(ins != null) {
+//                ins.close();
+//            }
+//            if(bins != null) {
+//                bins.close();
+//            }
+//        }
+//             return fileContent;
+//     }
 }