aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorjitendra007 <jitendra.sharma1@huawei.com>2020-06-18 16:25:39 +0530
committerpriyanka.akhade <priyanka.akhade@huawei.com>2020-07-09 13:06:31 +0530
commit5f23e02caa5ab128a4c01866dec91eaea8dc7cee (patch)
treeca3c4f31dc56ce64aa9c0165b8cac4dab8e70b7c /main
parentc3391bef9e04c2ad38ed96bd28a5c43ab6d961de (diff)
Fixed sonarcloud issues
Issue-ID: CLI-270 Signed-off-by: jitendra007 <jitendra.sharma1@huawei.com> Change-Id: Ibb52afb2fe8fe7c9be4299d1a1cb1e3d32ab0eca
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/cli/main/OnapCli.java6
-rw-r--r--main/src/main/java/org/onap/cli/main/interactive/StringCompleter.java2
-rw-r--r--main/src/test/java/org/onap/cli/main/OnapCliMainTest.java23
3 files changed, 26 insertions, 5 deletions
diff --git a/main/src/main/java/org/onap/cli/main/OnapCli.java b/main/src/main/java/org/onap/cli/main/OnapCli.java
index 4c12d7eb..b11b1b2b 100644
--- a/main/src/main/java/org/onap/cli/main/OnapCli.java
+++ b/main/src/main/java/org/onap/cli/main/OnapCli.java
@@ -287,7 +287,7 @@ public class OnapCli {
.filter(e -> e.getName().equals(OnapCommandConstants.VERIFY_CONTEXT_PARAM))
.findFirst();
- List<Map<String, ?>> testSuite = OnapCommandRegistrar.getRegistrar().getTestSuite(
+ List<Map<String, Object>> testSuite = OnapCommandRegistrar.getRegistrar().getTestSuite(
cmd.getName(),
cmd.getInfo().getProduct());
@@ -544,8 +544,7 @@ public class OnapCli {
OnapCliArgsParser.populateParams(cmd.getParameters(), this.args);
//start the execution
- if (this.requestId != null && this.product != null && !this.requestId.isEmpty()) {
- if (!(this.product.equalsIgnoreCase("open-cli") &&
+ if (this.requestId != null && this.product != null && !this.requestId.isEmpty()&& !(this.product.equalsIgnoreCase("open-cli") &&
this.cmdName.equalsIgnoreCase("execution-list"))) {
String input = cmd.getArgsJson(true);
executionStoreContext = OnapCommandExecutionStore.getStore().storeExectutionStart(
@@ -556,7 +555,6 @@ public class OnapCli {
this.profile,
input);
}
- }
cmd.setExecutionContext(executionStoreContext);
OnapCommandResult result = cmd.execute();
diff --git a/main/src/main/java/org/onap/cli/main/interactive/StringCompleter.java b/main/src/main/java/org/onap/cli/main/interactive/StringCompleter.java
index cf2a6c55..115e4f4c 100644
--- a/main/src/main/java/org/onap/cli/main/interactive/StringCompleter.java
+++ b/main/src/main/java/org/onap/cli/main/interactive/StringCompleter.java
@@ -29,7 +29,7 @@ import java.util.TreeSet;
*
*/
public class StringCompleter implements Completer {
- private final SortedSet<String> strings = new TreeSet<String>();
+ private final SortedSet<String> strings = new TreeSet<>();
/**
* Public Constructor takes collection of strings.
diff --git a/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java b/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java
index 0fb83287..c1e05093 100644
--- a/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java
+++ b/main/src/test/java/org/onap/cli/main/OnapCliMainTest.java
@@ -30,7 +30,11 @@ import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.error.OnapCommandHelpFailed;
import org.onap.cli.fw.registrar.OnapCommandRegistrar;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import java.util.Arrays;
import org.onap.cli.fw.error.OnapCommandInvalidSchema;
import org.onap.cli.fw.utils.OnapCommandDiscoveryUtils;
import static org.junit.Assert.assertFalse;
@@ -222,4 +226,23 @@ public class OnapCliMainTest {
Map<String,?> map = OnapCommandDiscoveryUtils.loadYaml("src/test/resources/open-cli-schema/sample-test-schema.yaml");
assertFalse(map.isEmpty());
}
+ @Test
+ public void testverifyCommand() throws OnapCommandException {
+ cli = new OnapCli(new String[] {"schema-validate","--verify" });
+ new MockUp<OnapCommandRegistrar>(){
+ @Mock
+ public List<Map<String, Object>> getTestSuite(String cmd, String product) throws OnapCommandException {
+ List<Map<String, Object>> list=new ArrayList<>();
+ Map<String,Object>map=new HashMap<>();
+ map.put("output","output");
+ map.put("input", Arrays.asList(new String[]{"--verify"}));
+ map.put("sampleid","sample1");
+ map.put("samplefileid","schema-validate-sample.yaml");
+ map.put("moco","schema-validate-moco.json");
+ list.add(map);
+ return list;
+ }
+ };
+ cli.handleCommand();
+ }
}