From 9e852f4d4578f3f65d6a9ee241da5e09dc1b2aa3 Mon Sep 17 00:00:00 2001 From: ajay priyadarshi Date: Tue, 20 Mar 2018 13:03:34 +0530 Subject: sonar fix:Code smells in emsdriver model commons/model/EMSInfo.java file name: CollectVo.java,CrontabVo.java Change-Id: I975e5f14b487067c98c9984604ecc746d1208ca6 Issue-ID: VFC-834 Signed-off-by: ajay priyadarshi --- .../emsdriver/collector/alarm/AlarmTaskThread.java | 4 ++-- .../nfvo/emsdriver/commons/model/CollectVo.java | 24 +++++++++++----------- .../nfvo/emsdriver/commons/model/CrontabVo.java | 12 +++++------ .../vfc/nfvo/emsdriver/commons/model/EMSInfo.java | 5 ++--- .../emsdriver/configmgr/ConfigurationManager.java | 4 ++-- .../emsdriver/commons/model/CrontabVoTest.java | 2 +- .../nfvo/emsdriver/commons/model/EMSInfoTest.java | 2 +- .../emsdriver/configmgr/ConfigurationImpTest.java | 2 +- 8 files changed, 27 insertions(+), 28 deletions(-) diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java index 7470ff3..154401a 100644 --- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java +++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java @@ -140,8 +140,8 @@ public class AlarmTaskThread extends Thread { String password = collectVo.getPassword(); try{ - if((collectVo.getRead_timeout()).trim().length()>0) - this.readTimeout = Integer.parseInt(collectVo.getRead_timeout()); + if((collectVo.getReadTimeout()).trim().length()>0) + this.readTimeout = Integer.parseInt(collectVo.getReadTimeout()); } catch (NumberFormatException e) { log.error("Unable to parse read_timout: ",e); diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java index c79d3bf..844b0af 100644 --- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java +++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java @@ -26,7 +26,7 @@ public class CollectVo { private String crontab; - private String IP; + private String ip; private String port; @@ -46,7 +46,7 @@ public class CollectVo { private boolean iscollect = false; - private String read_timeout; + private String readTimeout; /** @@ -95,14 +95,14 @@ public class CollectVo { * @return the iP */ public String getIP() { - return IP; + return ip; } /** * @param ip the iP to set */ - public void setIP(String ip) { - IP = ip; + public void setIP(String inIP) { + ip = inIP; } /** @@ -221,11 +221,11 @@ public class CollectVo { @Override public String toString() { return "CollectVo [emsName=" + emsName + ", type=" + type - + ", crontab=" + crontab + ", IP=" + IP + ", port=" + port + + ", crontab=" + crontab + ", IP=" + ip + ", port=" + port + ", user=" + user + ", password=" + password + ", remotepath=" + remotepath + ", match=" + match + ", passive=" + passive + ", ftptype=" + ftptype + ", granularity=" + granularity - + ", iscollect=" + iscollect + ", read_timeout=" + read_timeout + + ", iscollect=" + iscollect + ", readTimeout=" + readTimeout + "]"; } @@ -244,17 +244,17 @@ public class CollectVo { } /** - * @return the read_timeout + * @return the readTimeout */ - public String getRead_timeout() { - return read_timeout; + public String getReadTimeout() { + return readTimeout; } /** * @param read_timeout the read_timeout to set */ - public void setRead_timeout(String read_timeout) { - this.read_timeout = read_timeout; + public void setReadTimeout(String inReadTimeout) { + this.readTimeout = inReadTimeout; } diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVo.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVo.java index 1a925fe..b531526 100644 --- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVo.java +++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVo.java @@ -28,7 +28,7 @@ public class CrontabVo { private boolean iscollect = false; - private String read_timeout; + private String readTimeout; /** * @return the type @@ -103,22 +103,22 @@ public class CrontabVo { /** * @return the read_timeout */ - public String getRead_timeout() { - return read_timeout; + public String getReadTimeout() { + return readTimeout; } /** * @param read_timeout the read_timeout to set */ - public void setRead_timeout(String read_timeout) { - this.read_timeout = read_timeout; + public void setReadTimeout(String inReadTimeout) { + this.readTimeout = inReadTimeout; } @Override public String toString() { return "CrontabVo [type=" + type + ", crontab=" + crontab + ", match=" + match + ", granularity=" + granularity + ", iscollect=" - + iscollect + ", read_timeout=" + read_timeout + "]"; + + iscollect + ", read_timeout=" + readTimeout + "]"; } diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java index 2cc2682..558b75d 100644 --- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java +++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java @@ -23,7 +23,7 @@ public class EMSInfo { private String name; - private Map collectMap = new HashMap(); + private Map collectMap = new HashMap<>(); /** * @return the name @@ -40,8 +40,7 @@ public class EMSInfo { } public CollectVo getCollectVoByType(String type) { - CollectVo collectVo = this.collectMap.get(type); - return collectVo; + return this.collectMap.get(type); } public void putCollectMap(String type, CollectVo collectVo) { diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java index ae2aa58..5b7a2c1 100644 --- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java +++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java @@ -124,7 +124,7 @@ public class ConfigurationManager extends DriverThread { continue; } - crontabVo.setRead_timeout(child.getChildText("readtimeout")); + crontabVo.setReadTimeout(child.getChildText("readtimeout")); } else { String crontab = child.getAttributeValue("crontab"); if (!StringUtil.isBank(type) && !StringUtil.isBank(crontab)) { @@ -251,7 +251,7 @@ public class ConfigurationManager extends DriverThread { collectVo.setPort(collect.getString("port")); collectVo.setUser(collect.getString("user-name")); collectVo.setPassword(collect.getString("password")); - collectVo.setRead_timeout(crontabVo.getRead_timeout()); + collectVo.setReadTimeout(crontabVo.getReadTimeout()); } else { log.error("emsCrontab.get(system_type) result crontabVo is null system_type=[" + system_type + "]"); } diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVoTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVoTest.java index 2e3d31d..363f410 100644 --- a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVoTest.java +++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVoTest.java @@ -35,7 +35,7 @@ public class CrontabVoTest { crontabVo.setGranularity("crontab"); crontabVo.setIscollect(true); crontabVo.setMatch("crontab"); - crontabVo.setRead_timeout("10000"); + crontabVo.setReadTimeout("10000"); crontabVo.setType("qw"); assertNotNull(crontabVo.toString()); } diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java index 93a50ad..031bac6 100644 --- a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java +++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java @@ -35,7 +35,7 @@ public class EMSInfoTest { @Test public void testEMSInfo() { EMSInfo.setName("emsName"); - Map collectMap = new HashMap(); + Map collectMap = new HashMap<>(); CollectVo collectVo = new CollectVo(); collectVo.setEmsName("emsName"); collectMap.put("pm", collectVo); diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java index 15284da..d42a92a 100644 --- a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java +++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java @@ -94,7 +94,7 @@ public class ConfigurationImpTest { collectVo.setPort(collect.getChildText("port")); collectVo.setUser(collect.getChildText("user")); collectVo.setPassword(collect.getChildText("password")); - collectVo.setRead_timeout(collect.getChildText("readtimeout")); + collectVo.setReadTimeout(collect.getChildText("readtimeout")); } else { String crontab = collect.getAttributeValue("crontab"); if (!StringUtil.isBank(type) && !StringUtil.isBank(crontab)) { -- cgit 1.2.3-korg