sonar fix:Code smells in emsdriver model 69/36969/1
authorajay priyadarshi <ajay.priyadarshi@ril.com>
Tue, 20 Mar 2018 07:33:34 +0000 (13:03 +0530)
committerajay priyadarshi <ajay.priyadarshi@ril.com>
Tue, 20 Mar 2018 07:35:38 +0000 (13:05 +0530)
commons/model/EMSInfo.java
file name: CollectVo.java,CrontabVo.java

Change-Id: I975e5f14b487067c98c9984604ecc746d1208ca6
Issue-ID: VFC-834
Signed-off-by: ajay priyadarshi <ajay.priyadarshi@ril.com>
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmTaskThread.java
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CollectVo.java
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVo.java
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfo.java
ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java
ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/CrontabVoTest.java
ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/commons/model/EMSInfoTest.java
ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationImpTest.java

index 7470ff3..154401a 100644 (file)
@@ -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);
index c79d3bf..844b0af 100644 (file)
@@ -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;
     }
 
 
index 1a925fe..b531526 100644 (file)
@@ -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 + "]";
     }
 
 
index 2cc2682..558b75d 100644 (file)
@@ -23,7 +23,7 @@ public class EMSInfo {
     private String name;
 
 
-    private Map<String, CollectVo> collectMap = new HashMap<String, CollectVo>();
+    private Map<String, CollectVo> 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) {
index ae2aa58..5b7a2c1 100644 (file)
@@ -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 + "]");
                     }
index 2e3d31d..363f410 100644 (file)
@@ -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());
        }
index 93a50ad..031bac6 100644 (file)
@@ -35,7 +35,7 @@ public class EMSInfoTest {
     @Test
     public void testEMSInfo() {
         EMSInfo.setName("emsName");
-        Map<String, CollectVo> collectMap = new HashMap<String, CollectVo>();
+        Map<String, CollectVo> collectMap = new HashMap<>();
         CollectVo collectVo = new CollectVo();
         collectVo.setEmsName("emsName");
         collectMap.put("pm", collectVo);
index 15284da..d42a92a 100644 (file)
@@ -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)) {