diff options
author | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2018-05-15 15:11:25 +0530 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2018-05-15 17:41:07 +0530 |
commit | a09d9cc71b803ece5b32305f8e8fdb558c308fd7 (patch) | |
tree | 10a5bca5ba050ccc96930053b56794037ee081e4 | |
parent | f351ac2fbefeeb289d60210472343dac7b20e04f (diff) |
Make CLI into pojo
Issue-ID: CLI-100
Change-Id: Iba7f9690efba645f425cb33392cd07ae456eda83
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
-rw-r--r-- | main/src/main/java/org/onap/cli/main/OnapCli.java | 27 |
1 files changed, 24 insertions, 3 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 cf87c19a..30f5ab70 100644 --- a/main/src/main/java/org/onap/cli/main/OnapCli.java +++ b/main/src/main/java/org/onap/cli/main/OnapCli.java @@ -65,12 +65,28 @@ public class OnapCli { private int exitCode = -1; public OnapCli(String[] args) { - this.args.addAll(Arrays.asList(args)); + this.setArgs(args); } public OnapCli(String product, String[] args) { this(args); - this.product = product; + this.setProduct(product); + } + + public OnapCli() { + } + + public void resetExitCode() { + this.exitCode = -1; + } + + public void setArgs(String [] args) { + this.args.clear(); + this.args.addAll(Arrays.asList(args)); + } + + public void setProduct(String product) { + this.product = product; } private void exitSuccessfully() { @@ -260,7 +276,12 @@ public class OnapCli { if (contextOpt.isPresent()) { HashMap map = new HashMap(); - map.put(OnapCommandConstants.VERIFY_MOCO, sampleTest.get(OnapCommandConstants.VERIFY_MOCO)); + + Object moco = sampleTest.get(OnapCommandConstants.VERIFY_MOCO); + if (moco == null) { + continue; + } + map.put(OnapCommandConstants.VERIFY_MOCO, moco); if (contextOptArg.isPresent()) { OnapCommandParameter contextArg = contextOptArg.get(); |