aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/main/java
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2021-01-12 11:57:59 +0100
committerZebek Bogumil <bogumil.zebek@nokia.com>2021-01-12 11:59:15 +0100
commit81a0c6fd575fcb32be259383766ab53ce947d702 (patch)
treea2d028c7e511653fc1d2d06afd4e3ded0aac866c /framework/src/main/java
parent1ade33bf7ca87020a6bc7a734d8d86961e332536 (diff)
Fix OnapCommand class model
- No Metadata in OnapCommand Info section - Optional parameters with default values are lost after overriding selected parameter Issue-ID: CLI-349 CLI-348 Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com> Change-Id: I893bb01809737b4262a99f355d6c7681c8c275bb
Diffstat (limited to 'framework/src/main/java')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java4
-rw-r--r--framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java7
2 files changed, 10 insertions, 1 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java
index 74e488b4..167379d7 100644
--- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java
+++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java
@@ -1,5 +1,6 @@
/*
* Copyright 2017 Huawei Technologies Co., Ltd.
+ * Copyright 2020 Nokia
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -125,7 +126,7 @@ public abstract class OnapCommand {
}
public void setParameters(Set<OnapCommandParameter> parameters) {
- this.cmdParameters = parameters;
+ this.cmdParameters.addAll(parameters);
}
public Set<OnapCommandParameter> getParameters() {
@@ -200,6 +201,7 @@ public abstract class OnapCommand {
}
public List<String> initializeSchema(OnapCommandSchemaInfo schema) throws OnapCommandException {
+ this.getInfo().setMetadata(schema.getMetadata());
return this.initializeSchema(schema.getSchemaName(), false);
}
diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java
index aa45f58e..e051d5dd 100644
--- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java
+++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java
@@ -1,5 +1,6 @@
/*
* Copyright 2017 Huawei Technologies Co., Ltd.
+ * Copyright 2020 Nokia
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@ import static org.onap.cli.fw.conf.OnapCommandConstants.DIRECTION;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_AUTHOR;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_IGNORE;
+import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_METADATA;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PARAMS_LIST;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PARAMS_MANDATORY_LIST;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PRODUCT;
@@ -262,6 +264,11 @@ public class OnapCommandSchemaLoader {
info.setAuthor(mode.toString());
break;
+ case INFO_METADATA:
+ Object metadata = infoMap.get(key1);
+ info.setMetadata((Map<String,String>)metadata);
+ break;
+
case INFO_IGNORE:
Object ignore = infoMap.get(key1);
info.setIgnore(ignore.toString().equalsIgnoreCase(OnapCommandConstants.BOOLEAN_TRUE));