diff options
author | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2017-08-30 10:38:50 +0530 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2017-08-30 11:03:50 +0530 |
commit | af8413e2b168187d7a1683b8b8bf9d1ab16fafbf (patch) | |
tree | ab10506337a4d99dd996930d46d51868cfec9ef2 /framework/src | |
parent | a4cd2403a5a171d6ab6aa6b1b0b1aae83345121b (diff) |
Update Schema refresh to report product version
CLI-37
Change-Id: Ifabd3e0581c74fd76cc60ec2a5b3005fb023e55e
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src')
5 files changed, 16 insertions, 6 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java index 81cdfca2..7a156cac 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java @@ -30,7 +30,7 @@ import java.util.List; * Refresh external schema. * */ -@OnapCommandSchema(name = "schema-refresh", version="0.0", schema = "schema-refresh.yaml") +@OnapCommandSchema(name = "schema-refresh", version="cli-1.0", schema = "schema-refresh.yaml") public class OnapSchemaRefreshCommand extends OnapCommand { @Override @@ -44,6 +44,7 @@ public class OnapSchemaRefreshCommand extends OnapCommand { List<String> cmdNames = new ArrayList<>(); List<String> cmdFiles = new ArrayList<>(); List<String> versions = new ArrayList<>(); + List<String> cmdVersions = new ArrayList<>(); for (int i = 0; i < schemas.size(); i++) { ExternalSchema schema = schemas.get(i); @@ -51,12 +52,15 @@ public class OnapSchemaRefreshCommand extends OnapCommand { cmdNames.add(schema.getCmdName()); cmdFiles.add(schema.getSchemaName()); versions.add(schema.getVersion()); + cmdVersions.add(schema.getCmdVersion()); } for (OnapCommandResultAttribute attribute : this.getResult().getRecords()) { if ("sl-no".equals(attribute.getName())) { attribute.setValues(slNumbers); } else if ("command".equals(attribute.getName())) { attribute.setValues(cmdNames); + } else if ("product-version".equals(attribute.getName())) { + attribute.setValues(cmdVersions); } else if ("schema".equals(attribute.getName())) { attribute.setValues(cmdFiles); } else if ("version".equals(attribute.getName())) { diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java index 140ac818..3119f9c7 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java @@ -29,7 +29,7 @@ import java.util.Map; /** * Validate schema command. */ -@OnapCommandSchema(name = "schema-validate", version="0.0", schema = "schema-validate.yaml") +@OnapCommandSchema(name = "schema-validate", version="cli-1.0", schema = "schema-validate.yaml") public class OnapSchemaValidateCommand extends OnapCommand { @Override diff --git a/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml b/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml index 56492502..2cd90bcd 100644 --- a/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml +++ b/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml @@ -1,7 +1,7 @@ onap_cmd_schema_version: 1.0 name: schema-refresh description: Onap command to refresh schemas stored in onap_cli_schema folders. -version: 0.0 +version: cli-1.0 service: auth: none name: onap-cli @@ -17,6 +17,10 @@ results: description: Command name scope: short type: string + - name: product-version + description: Command product version + scope: short + type: string - name: schema description: Schema name scope: short diff --git a/framework/src/main/resources/onap-cli-schema/schema-validate.yaml b/framework/src/main/resources/onap-cli-schema/schema-validate.yaml index a4c1fd29..74abfdc4 100644 --- a/framework/src/main/resources/onap-cli-schema/schema-validate.yaml +++ b/framework/src/main/resources/onap-cli-schema/schema-validate.yaml @@ -1,7 +1,7 @@ onap_cmd_schema_version: 1.0 name: schema-validate description: Onap command to validate schema -version: 0.0 +version: cli-1.0 service: auth: none name: onap-cli diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java index eda6a591..b0aa2119 100644 --- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java +++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java @@ -37,13 +37,15 @@ public class OnapSchemaRefreshCommandTest { String s1Number = onapCommandResultAttribute.get(0).getValues().get(0); String cmdName = onapCommandResultAttribute.get(1).getValues().get(0); - String cmdFile = onapCommandResultAttribute.get(2).getValues().get(0); - String version = onapCommandResultAttribute.get(3).getValues().get(0); + String cmdVer = onapCommandResultAttribute.get(2).getValues().get(0); + String cmdFile = onapCommandResultAttribute.get(3).getValues().get(0); + String version = onapCommandResultAttribute.get(4).getValues().get(0); assertTrue(s1Number.equalsIgnoreCase("1")); assertTrue(cmdName.equalsIgnoreCase("sample-test1")); assertTrue(cmdFile.equalsIgnoreCase("sample-test1-schema-http.yaml")); assertTrue(version.equalsIgnoreCase("1.0")); + assertTrue(cmdVer.equalsIgnoreCase("cli-1.0")); } } |