From 81d56617f980394d45be5fee716c507eeea739f2 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Fri, 15 Sep 2017 18:10:17 +0530 Subject: Fixes SONAR critical bugs CLI-43 Change-Id: I8a901da62617589ec17b125b788104d201afafef Signed-off-by: Kanagaraj Manickam k00365106 --- .../org/onap/cli/fw/OnapCommandRegistrarTest.java | 13 ++++++++ .../fw/input/OnapCommandParameterCacheTest.java | 35 ++++++++++++++++++++++ .../org/onap/cli/fw/input/ParameterTypeTest.java | 1 + 3 files changed, 49 insertions(+) create mode 100644 framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterCacheTest.java (limited to 'framework/src/test/java/org') 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()); -- cgit 1.2.3-korg