diff options
author | 2018-02-26 11:09:10 +0530 | |
---|---|---|
committer | 2018-02-26 11:14:31 +0530 | |
commit | 3bb98db80eedfa13cbe41ccd14cd151a2ef17d07 (patch) | |
tree | bf0a032a77b7b8ce3668abb09a506b166c3890df /huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap | |
parent | a4996ef65017d8e296d040fe50aa05d417509e63 (diff) |
Improve coverage
Issue-ID: VFC-764
Change-Id: I02ecd6eaeefc298bce133adce65a6751459ad1c0
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap')
2 files changed, 16 insertions, 6 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapter2DriverMgrService.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapter2DriverMgrService.java index 83652b70..b3ba1760 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapter2DriverMgrService.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapter2DriverMgrService.java @@ -82,12 +82,16 @@ public class VnfmAdapter2DriverMgrService implements IVnfmAdapter2DriverMgrServi * @throws IOException */ public static String readVnfmAdapterInfoFromJson() throws IOException { - String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + "adapterInfo" + System.getProperty(Constant.FILE_SEPARATOR) + VNFMADAPTER2DRIVERMGR; + return readJson(fileName); + } + + public static String readJson(String fileName) throws IOException { + String fileContent = ""; + try (InputStream ins = new FileInputStream(fileName)){ try(BufferedInputStream bins = new BufferedInputStream(ins)){ diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapterMgrService.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapterMgrService.java index dabaf380..8df2c796 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapterMgrService.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapterMgrService.java @@ -81,14 +81,19 @@ public class VnfmAdapterMgrService implements IVnfmAdapterMgrService { * @throws IOException */ public String readVnfmAdapterInfoFromJson() throws IOException { - String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + "adapterInfo" + System.getProperty(Constant.FILE_SEPARATOR) + VNFMADAPTERINFO; - try (InputStream ins = new FileInputStream(fileName)) { - try (BufferedInputStream bins = new BufferedInputStream(ins)){ + + return readJson(fileName); + } + + public static String readJson(String fileName) throws IOException { + String fileContent = ""; + + try (InputStream ins = new FileInputStream(fileName)){ + try(BufferedInputStream bins = new BufferedInputStream(ins)){ byte[] contentByte = new byte[ins.available()]; int num = bins.read(contentByte); @@ -104,6 +109,7 @@ public class VnfmAdapterMgrService implements IVnfmAdapterMgrService { return fileContent; } + private static class RegisterVnfmAdapterThread implements Runnable { private IDriver2MSBManager adapter2MSBMgr = new Driver2MSBManager(); |