diff options
author | Lizi <li.zi30@zte.com.cn> | 2018-01-12 06:57:31 +0000 |
---|---|---|
committer | Lizi <li.zi30@zte.com.cn> | 2018-01-12 06:57:41 +0000 |
commit | 7051ea74d3d0d2cd15de7acec391c1f08563fea3 (patch) | |
tree | 560bd3727f476bc679d8a7d607060e1718302be0 /esr-mgr/src | |
parent | 486ed42762fedbc7cd0cc43704389ed41434eacd (diff) |
Fix the sonar issue.
Change-Id: I477338e083b98f6cc2a80d068229d7c00181b0fc
Issue-ID: AAI-638
Signed-off-by: Lizi <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr/src')
3 files changed, 18 insertions, 38 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java index 2e19f7d..8f7a1f4 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java @@ -37,9 +37,7 @@ public class ExternalSystemProxy { } public static void registerVnfm(String vnfmId, EsrVnfmDetail esrVnfmDetail) throws ExtsysException { - if (isTest) { - - } else { + if (!isTest){ ClientConfig config = new ClientConfig(new VnfmRegisterProvider()); IExternalSystem registerVnfmServiceproxy = ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java index fb85333..63ffa87 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java @@ -50,8 +50,7 @@ public class EmsManagerWrapper { public Response registerEms(EmsRegisterInfo emsRegisterInfo) { CommonRegisterResponse result = new CommonRegisterResponse(); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); + EsrEmsDetail esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); String emsId = esrEmsDetail.getEmsId(); try { ExternalSystemProxy.registerEms(emsId, esrEmsDetail); @@ -65,8 +64,7 @@ public class EmsManagerWrapper { public Response updateEms(EmsRegisterInfo emsRegisterInfo, String emsId) { CommonRegisterResponse result = new CommonRegisterResponse(); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = getNewEsrEmsDetail(emsRegisterInfo, emsId); + EsrEmsDetail esrEmsDetail = getNewEsrEmsDetail(emsRegisterInfo, emsId); try { ExternalSystemProxy.registerEms(emsId, esrEmsDetail); result.setId(emsId); @@ -102,8 +100,7 @@ public class EmsManagerWrapper { } public Response delEms(String emsId) { - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = queryEsrEmsDetail(emsId); + EsrEmsDetail esrEmsDetail = queryEsrEmsDetail(emsId); String resourceVersion = esrEmsDetail.getResourceVersion(); try { ExternalSystemProxy.deleteEms(emsId, resourceVersion); @@ -130,10 +127,9 @@ public class EmsManagerWrapper { private List<EmsRegisterInfo> getEmsDetailList(EsrEmsList esrEms) { List<EmsRegisterInfo> emsInfoList = new ArrayList<>(); - EmsRegisterInfo emsInfo = new EmsRegisterInfo(); for (int i = 0; i < esrEms.getEsrEms().size(); i++) { String emsId = esrEms.getEsrEms().get(i).getEmsId(); - emsInfo = queryEmsDetail(emsId); + EmsRegisterInfo emsInfo = queryEmsDetail(emsId); if (emsInfo != null) { emsInfoList.add(emsInfo); } @@ -154,24 +150,17 @@ public class EmsManagerWrapper { } private EsrEmsDetail getNewEsrEmsDetail(EmsRegisterInfo emsRegisterInfo, String emsId) { - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - List<EsrSystemInfo> newEsrSysInfoList = new ArrayList<>(); - EsrSystemInfo newEsrSystemInfo = new EsrSystemInfo(); - EsrEmsDetail oriEsrEmsDetail = new EsrEmsDetail(); - List<EsrSystemInfo> oriEsrSysInfoList = new ArrayList<>(); - EsrSystemInfo originalEsrSystemInfo = new EsrSystemInfo(); - - oriEsrEmsDetail = queryEsrEmsDetail(emsId); - esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); + EsrEmsDetail oriEsrEmsDetail = queryEsrEmsDetail(emsId); + EsrEmsDetail esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); String emsResourceVersion = oriEsrEmsDetail.getResourceVersion(); esrEmsDetail.setResourceVersion(emsResourceVersion); esrEmsDetail.setEmsId(emsId); - newEsrSysInfoList = esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); - oriEsrSysInfoList = oriEsrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); + List<EsrSystemInfo> newEsrSysInfoList = esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); + List<EsrSystemInfo> oriEsrSysInfoList = oriEsrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); for (int i = 0; i < oriEsrSysInfoList.size(); i++) { - originalEsrSystemInfo = oriEsrSysInfoList.get(i); + EsrSystemInfo originalEsrSystemInfo = oriEsrSysInfoList.get(i); for (int j = 0; j < newEsrSysInfoList.size(); j++) { - newEsrSystemInfo = newEsrSysInfoList.get(j); + EsrSystemInfo newEsrSystemInfo = newEsrSysInfoList.get(j); if (originalEsrSystemInfo.getSystemType().equals(newEsrSystemInfo.getSystemType())) { esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java index e34217d..ce80807 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java @@ -60,9 +60,8 @@ public class VimManagerWrapper { public Response registerVim(VimRegisterInfo vimRegisterInfo) { LOG.info("Start register VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); - CloudRegionDetail cloudRegion = new CloudRegionDetail(); VimRegisterResponse result = new VimRegisterResponse(); - cloudRegion = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); + CloudRegionDetail cloudRegion = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); String cloudOwner = vimRegisterInfo.getCloudOwner(); String cloudRegionId = vimRegisterInfo.getCloudRegionId(); try { @@ -85,10 +84,9 @@ public class VimManagerWrapper { public Response updateVim(String cloudOwner, String cloudRegionId, VimRegisterInfo vimRegisterInfo) { LOG.info("Start update VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); VimRegisterResponse result = new VimRegisterResponse(); - cloudRegionDetail = getVimUpdateInfo(vimRegisterInfo); + CloudRegionDetail cloudRegionDetail = getVimUpdateInfo(vimRegisterInfo); try { cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegionDetail); result.setCloudOwner(cloudOwner); @@ -133,12 +131,11 @@ public class VimManagerWrapper { private List<VimRegisterInfo> getVimDetailList(CloudRegionList cloudRegionList) { List<VimRegisterInfo> vimRegisterInfos = new ArrayList<>(); - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); int cloudRegionNum = cloudRegionList.getCloudRegion().size(); for (int i = 0; i < cloudRegionNum; i++) { String cloudOwner = cloudRegionList.getCloudRegion().get(i).getCloudOwner(); String cloudRegionId = cloudRegionList.getCloudRegion().get(i).getCloudRegionId(); - vimRegisterInfo = getVimDetail(cloudOwner, cloudRegionId); + VimRegisterInfo vimRegisterInfo = getVimDetail(cloudOwner, cloudRegionId); vimRegisterInfos.add(vimRegisterInfo); } return vimRegisterInfos; @@ -172,17 +169,14 @@ public class VimManagerWrapper { } private CloudRegionDetail getVimUpdateInfo(VimRegisterInfo vimRegisterInfo) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - CloudRegionDetail originalCloudRegionDetail = new CloudRegionDetail(); - EsrSystemInfo originalSystemInfo = new EsrSystemInfo(); String cloudOwner = vimRegisterInfo.getCloudOwner(); String cloudRegionId = vimRegisterInfo.getCloudRegionId(); - originalCloudRegionDetail = getOriginalCloudRegion(cloudOwner, cloudRegionId); + CloudRegionDetail originalCloudRegionDetail = getOriginalCloudRegion(cloudOwner, cloudRegionId); String resourceVersion = originalCloudRegionDetail.getResourceVersion(); - cloudRegionDetail = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); + CloudRegionDetail cloudRegionDetail = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); if (resourceVersion != null) { cloudRegionDetail.setResourceVersion(resourceVersion); - originalSystemInfo = originalCloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); + EsrSystemInfo originalSystemInfo = originalCloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) .setEsrSystemInfoId(originalSystemInfo.getEsrSystemInfoId()); cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) @@ -192,8 +186,7 @@ public class VimManagerWrapper { } public Response delVim(String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - cloudRegionDetail = queryCloudRegionDetail(cloudOwner, cloudRegionId); + CloudRegionDetail cloudRegionDetail = queryCloudRegionDetail(cloudOwner, cloudRegionId); String resourceVersion = cloudRegionDetail.getResourceVersion(); try { cloudRegionProxy.deleteVim(cloudOwner, cloudRegionId, resourceVersion); |