summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-09-15 18:10:17 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-09-15 18:18:38 +0530
commit81d56617f980394d45be5fee716c507eeea739f2 (patch)
tree252bcb7c326da4ecca929f2d174c37d4d9a92298 /framework
parent72b4cdffcd021828e2b4ac00b59496b0b3bc7a26 (diff)
Fixes SONAR critical bugs
CLI-43 Change-Id: I8a901da62617589ec17b125b788104d201afafef Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java4
-rw-r--r--framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java13
-rw-r--r--framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterCacheTest.java35
-rw-r--r--framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java1
4 files changed, 51 insertions, 2 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
index 9b824d32..4cde5088 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
@@ -1637,7 +1637,7 @@ public class OnapCommandUtils {
mapper.writerWithDefaultPrettyPrinter().writeValue(file, params);
}
} catch (IOException e1) {
- // Never occur // NOSONAR
+ // pass // NOSONAR
}
}
}
@@ -1713,7 +1713,7 @@ public class OnapCommandUtils {
params.addAll(Arrays.asList(list));
}
} catch (IOException e) {
- // Never occur // NOSONAR
+ // pass // NOSONAR
}
return params;
diff --git a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
index 840a75d7..ecbbf972 100644
--- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
@@ -139,6 +139,19 @@ public class OnapCommandRegistrarTest {
public void listTest() {
registerar.listCommands();
}
+
+ @Test
+ public void testParamCache() throws OnapCommandException {
+ OnapCommandRegistrar.getRegistrar().addParamCache("a", "b");
+ OnapCommandRegistrar.getRegistrar().getParamCache();
+ OnapCommandRegistrar.getRegistrar().getAvailableProductVersions();
+ OnapCommandRegistrar.getRegistrar().setDevMode(true);
+ OnapCommandRegistrar.getRegistrar().isDevMode();
+ OnapCommandRegistrar.getRegistrar().isInteractiveMode();
+ OnapCommandRegistrar.getRegistrar().getEnabledProductVersion();
+ OnapCommandRegistrar.getRegistrar().setEnabledProductVersion("cli-1.0");
+
+ }
}
@OnapCommandSchema(name = OnapCommandTest.CMD_NAME, version = "cli-1.0", schema = "sample-test-schema.yaml")
diff --git a/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterCacheTest.java b/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterCacheTest.java
new file mode 100644
index 00000000..ea06ea1b
--- /dev/null
+++ b/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterCacheTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.cli.fw.input;
+
+import org.junit.Test;
+import org.onap.cli.fw.input.cache.OnapCommandParameterCache;
+
+public class OnapCommandParameterCacheTest {
+
+ @Test
+ public void test() {
+ OnapCommandParameterCache cache = OnapCommandParameterCache.getInstance();
+
+ cache.add("1.0", "a", "b");
+ cache.remove("1.0", "a");
+ cache.setProfile("test");
+ cache.getParams("1.0");
+ }
+
+
+}
diff --git a/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java b/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
index 0a5ad006..0c481405 100644
--- a/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
@@ -35,6 +35,7 @@ public class ParameterTypeTest {
&& ParameterType.BOOL.equals(ParameterType.get("bool"))
&& ParameterType.MAP.equals(ParameterType.get("map"))
&& ParameterType.BINARY.equals(ParameterType.get("binary"))
+ && ParameterType.TEXT.equals(ParameterType.get("text"))
&& ParameterType.ARRAY.equals(ParameterType.get("array")));
} catch (OnapCommandInvalidParameterType e) {
fail("Shouldn't have thrown this exception : " + e.getMessage());