summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
authorSravanKumarGunda <sravan.kumar1@huawei.com>2020-08-04 21:02:32 +0530
committerSravanKumarGunda <sravan.kumar1@huawei.com>2020-08-04 21:02:32 +0530
commit1b9f8877186932d84c5ed4405aa0d73242d33cdf (patch)
tree8a94f379e87b06d974fbb01221cfa6b06561b7bd /framework
parent6941680edbc46f1525ef739305f11781d1ddd70a (diff)
code improvements-sonar fixes
Signed-off-by: SravanKumarGunda <sravan.kumar1@huawei.com> Issue-ID: CLI-270 Change-Id: I3f663df51e27e7295f9cad51ace100d784ab94bb
Diffstat (limited to 'framework')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java4
-rw-r--r--framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java3
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java4
7 files changed, 12 insertions, 9 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java
index 1c90e9a0..90f8c468 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java
@@ -26,7 +26,7 @@ public class OnapCommandInvalidRegistration extends OnapCommandException {
private static final long serialVersionUID = 7722163282274482532L;
- public OnapCommandInvalidRegistration(Class cls) {
+ public OnapCommandInvalidRegistration(Class<?> cls) {
super("0x2001", "Invalid commad class " + cls.getCanonicalName() + " registration, it should be derived from "
+ OnapCommand.class.getCanonicalName());
}
diff --git a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java
index 09050c6c..c548f6dc 100644
--- a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java
+++ b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java
@@ -290,6 +290,6 @@ public class OnapCommandPrint {
throw new OnapCommandOutputPrintingFailed(e); // NOSONAR
}
*/
- return "";
+ return ""; //NOSONAR
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java
index 9a6a4e78..0712603a 100644
--- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java
+++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java
@@ -35,6 +35,10 @@ public class OnapCommandSchemaMerger {
static Logger logger = LoggerFactory.getLogger(OnapCommandSchemaMerger.class);
+ private OnapCommandSchemaMerger(){
+ //It is made private in order to resolve: Utility classes should not have public constructors
+ }
+
public static Map<String, Object> mergeSchemas(OnapCommand cmd) throws OnapCommandException {
Map<String, Object> mergedResult = new LinkedHashMap<>();
diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java
index 839d1427..774e1fd7 100644
--- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java
+++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java
@@ -453,8 +453,7 @@ public class OnapCommandExecutionStore {
private File getExecutionDir(String executionId) throws OnapCommandExecutionNotFound {
File []f = new File(getBasePath()).listFiles((dir, name) -> {
- if (name.startsWith(executionId)) return true;
- return false;
+ return name.startsWith(executionId);
});
if (f.length == 0) {
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
index 614eb2a9..923ae243 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
@@ -480,7 +480,7 @@ public class OnapCommandDiscoveryUtils {
public static List<Map<String, Object>> createTestSuite(String cmd, String version) throws OnapCommandException {
- ArrayList<Map<String, Object>> testSamples = new ArrayList();
+ ArrayList<Map<String, Object>> testSamples = new ArrayList<>();
List<Resource> resources = new ArrayList<>();
diff --git a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
index 6d9b2d2c..507490c6 100644
--- a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
@@ -154,7 +154,7 @@ public class ValidateSchemaTest {
paraValues.put("is_default_param","yes");
list.add(paraValues);
values.put("parameters",list);
- assertTrue(OnapCommandSchemaLoader.parseSchema(cmd,values,true).size()==2);
+ assertEquals(2, OnapCommandSchemaLoader.parseSchema(cmd,values,true).size());
}
@Test
@@ -172,7 +172,7 @@ public class ValidateSchemaTest {
list.add(paraValues);
attributesValues.put("attributes",list);
values.put("results",attributesValues);
- assertTrue(OnapCommandSchemaLoader.parseSchema(cmd,values,true).size()==2);
+ assertEquals(2, OnapCommandSchemaLoader.parseSchema(cmd,values,true).size());
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
index 44c18194..e5fa45b7 100644
--- a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
@@ -546,8 +546,8 @@ public class OnapCommandUtilsTest {
mapExample.put("key1", "paramA");
mapExample.put("key2", "paramB");
OnapCommandUtils.replaceLineFromResults("line $r{paramA} line $r{paramB}", mapExample);
- assertTrue(mapExample.get("key1").equals("paramA"));
- assertTrue(mapExample.get("key2").equals("paramB"));
+ assertEquals("paramA", mapExample.get("key1"));
+ assertEquals("paramB", mapExample.get("key2"));
}
@Test