diff options
author | 2017-12-11 20:34:44 +0530 | |
---|---|---|
committer | 2017-12-12 15:48:55 +0530 | |
commit | 0d97a835fa2052ded5a31e8921baf641c8e9bb57 (patch) | |
tree | 800584529f77c8ff26f05a73abd3fa71205a69a7 /framework/src/main/java/org/onap/cli/fw/cmd | |
parent | 03c54a40daf75644ec0bcbc73636e3eb427c1604 (diff) |
Make Http as separate plugin
Issue-ID: CLI-66
Change-Id: I8ad78f417f6dbb00e29effdd3ed8ec1939aee81d
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/main/java/org/onap/cli/fw/cmd')
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/cmd/BasicAuthLoginCommand.java | 48 | ||||
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/cmd/BasicAuthLogoutCommand.java | 29 | ||||
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/cmd/CatalogCommand.java | 28 | ||||
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java | 243 | ||||
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/cmd/OnapCommandType.java (renamed from framework/src/main/java/org/onap/cli/fw/cmd/CommandType.java) | 4 | ||||
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/cmd/OnapHttpCommand.java | 199 | ||||
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java | 11 | ||||
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java | 13 |
8 files changed, 256 insertions, 319 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/BasicAuthLoginCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/BasicAuthLoginCommand.java deleted file mode 100644 index 28a86a9b..00000000 --- a/framework/src/main/java/org/onap/cli/fw/cmd/BasicAuthLoginCommand.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.cmd; - -import java.util.Map; - -import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.http.impl.auth.BasicScheme; -import org.onap.cli.fw.OnapCommandSchema; -import org.onap.cli.fw.conf.Constants; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.input.OnapCommandParameter; - -@OnapCommandSchema(schema = "basic-login.yaml") -public class BasicAuthLoginCommand extends OnapHttpCommand { - - @Override - protected void run() throws OnapCommandException { - - //get the input arguments - Map<String, OnapCommandParameter> paramMap = getParametersMap(); - OnapCommandParameter usernameParam = paramMap.get(Constants.DEAFULT_PARAMETER_USERNAME); - String username = usernameParam.getValue().toString(); - OnapCommandParameter usernamePassword = paramMap.get(Constants.DEAFULT_PARAMETER_PASSWORD); - String password = usernamePassword.getValue().toString(); - - //Execute the command to get token - String authToken = BasicScheme.authenticate(new UsernamePasswordCredentials( - username, password), "UTF-8", false).getValue(); - - //Fill out the result part - this.getResult().getRecordsMap().get(Constants.AUTH_SERVICE_AUTHORIZATION).getValues().add(authToken); - } -} diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/BasicAuthLogoutCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/BasicAuthLogoutCommand.java deleted file mode 100644 index 553b28f8..00000000 --- a/framework/src/main/java/org/onap/cli/fw/cmd/BasicAuthLogoutCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.cmd; - -import org.onap.cli.fw.OnapCommandSchema; -import org.onap.cli.fw.error.OnapCommandException; - -@OnapCommandSchema(schema = "basic-logout.yaml") -public class BasicAuthLogoutCommand extends OnapHttpCommand { - - @Override - protected void run() throws OnapCommandException { - //do nothing // NOSONAR - } -} diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/CatalogCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/CatalogCommand.java deleted file mode 100644 index 34bf90c2..00000000 --- a/framework/src/main/java/org/onap/cli/fw/cmd/CatalogCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.cmd; - -import org.onap.cli.fw.OnapCommandSchema; -import org.onap.cli.fw.error.OnapCommandException; - -@OnapCommandSchema(schema = "catalog.yaml") -public class CatalogCommand extends OnapHttpCommand { - - @Override - protected void run() throws OnapCommandException { - } -} 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 new file mode 100644 index 00000000..4b7fe976 --- /dev/null +++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommand.java @@ -0,0 +1,243 @@ +/* + * 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.cmd; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.onap.cli.fw.conf.OnapCommandConstants; +import org.onap.cli.fw.error.OnapCommandException; +import org.onap.cli.fw.error.OnapCommandHelpFailed; +import org.onap.cli.fw.error.OnapCommandNotInitialized; +import org.onap.cli.fw.info.OnapCommandInfo; +import org.onap.cli.fw.input.OnapCommandParameter; +import org.onap.cli.fw.output.OnapCommandResult; +import org.onap.cli.fw.output.OnapCommandResultAttribute; +import org.onap.cli.fw.output.OnapCommandResultAttributeScope; +import org.onap.cli.fw.output.OnapCommandResultType; +import org.onap.cli.fw.schema.OnapCommandSchemaLoader; +import org.onap.cli.fw.utils.OnapCommandHelperUtils; +import org.onap.cli.fw.utils.OnapCommandUtils; + +/** + * Oclip Command. + * + */ +public abstract class OnapCommand { + + private String cmdDescription; + + private String cmdName; + + private String cmdSchemaName; + + private OnapCommandInfo info = new OnapCommandInfo(); + + private Set<OnapCommandParameter> cmdParameters = new HashSet<>(); + + private OnapCommandResult cmdResult = new OnapCommandResult(); + + protected boolean isInitialzied = false; + + public String getSchemaVersion() { + return OnapCommandConstants.OPEN_CLI_SCHEMA_VERSION_VALUE_1_0; + } + + public String getDescription() { + return this.cmdDescription; + } + + public void setDescription(String description) { + this.cmdDescription = description; + } + + public String getName() { + return this.cmdName; + } + + public void setName(String name) { + this.cmdName = name; + } + + public OnapCommandInfo getInfo() { + return info; + } + + public void setInfo(OnapCommandInfo info) { + this.info = info; + } + + public void setParameters(Set<OnapCommandParameter> parameters) { + this.cmdParameters = parameters; + } + + public Set<OnapCommandParameter> getParameters() { + return this.cmdParameters; + } + + public Map<String, OnapCommandParameter> getParametersMap() { + return OnapCommandUtils.getInputMap(this.getParameters()); + } + + public OnapCommandResult getResult() { + return this.cmdResult; + } + + public void setResult(OnapCommandResult result) { + this.cmdResult = result; + } + + public String getSchemaName() { + return cmdSchemaName; + } + + protected void setSchemaName(String schemaName) { + this.cmdSchemaName = schemaName; + } + + /** + * Initialize this command from command schema and assumes schema is already validated. + * + * @throws OnapCommandException + * + * @return List of error strings + */ + public List<String> initializeSchema(String schema) throws OnapCommandException { + return this.initializeSchema(schema, false); + } + + public List<String> initializeSchema(String schema, boolean validate) throws OnapCommandException { + this.setSchemaName(schema); + + List<String> errors = OnapCommandSchemaLoader.loadSchema(this, schema, true, validate); + errors.addAll(this.initializeProfileSchema()); + this.isInitialzied = true; + + return errors; + } + /** + * Any additional profile based such as http schema could be initialized. + */ + protected List<String> initializeProfileSchema() throws OnapCommandException { + return new ArrayList<>(); + } + + /* + * Validate input parameters. This can be overridden in derived commands + */ + protected void validate() throws OnapCommandException { + for (OnapCommandParameter param : this.getParameters()) { + if (param.isInclude()) { + param.validate(); + } + } + } + + /** + * Oclip command execute with given parameters on service. Before calling this method, its mandatory to set all + * parameters value. + * + * @throws OnapCommandException + * : General Command Exception + */ + public OnapCommandResult execute() throws OnapCommandException { + if (!this.isInitialzied) { + throw new OnapCommandNotInitialized(this.getClass().getName()); + } + + Map<String, OnapCommandParameter> paramMap = this.getParametersMap(); + + // -h or --help is always higher precedence !, user can set this value to get help message + if (OnapCommandConstants.BOOLEAN_TRUE.equals(paramMap.get(OnapCommandConstants.DEFAULT_PARAMETER_HELP).getValue())) { + OnapCommandResult result = new OnapCommandResult(); + result.setType(OnapCommandResultType.TEXT); + result.setOutput(this.printHelp()); + return result; + } + + // -v or --version is next higher precedence !, user can set this value to get help message + if (OnapCommandConstants.BOOLEAN_TRUE.equals(paramMap.get(OnapCommandConstants.DEFAULT_PARAMETER_VERSION).getValue())) { + OnapCommandResult result = new OnapCommandResult(); + result.setType(OnapCommandResultType.TEXT); + result.setOutput(this.printVersion()); + return result; + } + + // validate + this.validate(); + + // -f or --format + this.cmdResult.setType( + OnapCommandResultType.get(paramMap.get(OnapCommandConstants.DEFAULT_PARAMETER_OUTPUT_FORMAT).getValue().toString())); + if (OnapCommandConstants.BOOLEAN_TRUE.equals(paramMap.get(OnapCommandConstants.DEFAULT_PARAMETER_OUTPUT_ATTR_LONG).getValue())) { + this.cmdResult.setScope(OnapCommandResultAttributeScope.LONG); + } + // --no-title + if (OnapCommandConstants.BOOLEAN_TRUE.equals(paramMap.get(OnapCommandConstants.DEFAULT_PARAMETER_OUTPUT_NO_TITLE).getValue())) { + this.cmdResult.setIncludeTitle(false); + } + + // --debug + if (OnapCommandConstants.BOOLEAN_TRUE.equals(paramMap.get(OnapCommandConstants.DEFAULT_PARAMETER_DEBUG).getValue())) { + this.cmdResult.setDebug(true); + } + + //pre-process result attributes for spl entries and input parameters + for (OnapCommandResultAttribute attr: this.cmdResult.getRecords()) { + if (!attr.getDefaultValue().isEmpty()) { + attr.setDefaultValue(OnapCommandUtils.replaceLineForSpecialValues(attr.getDefaultValue())); + attr.setDefaultValue(OnapCommandUtils.replaceLineFromInputParameters( + attr.getDefaultValue(), this.getParametersMap())); + } + } + + this.run(); + + return this.cmdResult; + } + + /* + * Each command implements run method to executing the command. + * + */ + protected abstract void run() throws OnapCommandException; + + /** + * Returns the service service version it supports. + * + * @return version + */ + public String printVersion() { + return this.getInfo().getService(); + } + + /** + * Provides help message for this command. + * + * @return help message + * @throws OnapCommandHelpFailed + * Failed to execute Help command. + */ + public String printHelp() throws OnapCommandHelpFailed { + return OnapCommandHelperUtils.help(this); + } + + // (mrkanag) Add toString for all command, parameter, result, etc objects in JSON format +} diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/CommandType.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommandType.java index baaf7e12..e874a14e 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/CommandType.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapCommandType.java @@ -23,7 +23,7 @@ import org.onap.cli.fw.error.OnapCommandInvalidParameterType; * Command type supported by Oclip CLI. * */ -public enum CommandType { +public enum OnapCommandType { AUTH, CATALOG, @@ -38,7 +38,7 @@ public enum CommandType { * @throws OnapCommandInvalidParameterType * exception */ - public static CommandType get(String name) throws OnapCommandInvalidCommandType { + public static OnapCommandType get(String name) throws OnapCommandInvalidCommandType { if (AUTH.name().equalsIgnoreCase(name)) { return AUTH; } else if (CATALOG.name().equalsIgnoreCase(name)) { diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapHttpCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapHttpCommand.java deleted file mode 100644 index 892f367a..00000000 --- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapHttpCommand.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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.cmd; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.onap.cli.fw.OnapCommand; -import org.onap.cli.fw.OnapCommandSchema; -import org.onap.cli.fw.ad.OnapAuthClient; -import org.onap.cli.fw.ad.OnapService; -import org.onap.cli.fw.conf.Constants; -import org.onap.cli.fw.conf.OnapCommandConfg; -import org.onap.cli.fw.error.OnapCommandException; -import org.onap.cli.fw.error.OnapCommandExecutionFailed; -import org.onap.cli.fw.error.OnapCommandFailedMocoGenerate; -import org.onap.cli.fw.http.HttpInput; -import org.onap.cli.fw.http.HttpResult; -import org.onap.cli.fw.output.OnapCommandResultAttribute; -import org.onap.cli.fw.utils.OnapCommandSchemaLoaderUtils; -import org.onap.cli.fw.utils.OnapCommandUtils; -import org.onap.cli.http.mock.MockJsonGenerator; -import org.onap.cli.http.mock.MockRequest; -import org.onap.cli.http.mock.MockResponse; - -/** - * Oclip http Command. - * - */ -@OnapCommandSchema(type = Constants.HTTP_SCHEMA_PROFILE) -public class OnapHttpCommand extends OnapCommand { - - private HttpInput input = new HttpInput(); - - private List<Integer> successStatusCodes = new ArrayList<>(); - - private Map<String, String> resultMap = new HashMap<>(); - - protected OnapAuthClient authClient; - - private OnapService oclipService = new OnapService(); - - public void setInput(HttpInput input) { - this.input = input; - } - - @Override - public String getSchemaVersion() { - return Constants.OPEN_CLI_SCHEMA_VERSION_VALUE_1_0; - } - - public void setSuccessStatusCodes(List<Integer> successStatusCodes) { - this.successStatusCodes = successStatusCodes; - } - - public void setResultMap(Map<String, String> resultMap) { - this.resultMap = resultMap; - } - - public HttpInput getInput() { - return input; - } - - public List<Integer> getSuccessStatusCodes() { - return successStatusCodes; - } - - public Map<String, String> getResultMap() { - return resultMap; - } - - /* - * Oclip service, this command uses to execute it. - */ - public OnapService getService() { - return this.oclipService; - } - - public void setService(OnapService service) { - this.oclipService = service; - } - - @Override - protected List<String> initializeProfileSchema() throws OnapCommandException { - return OnapCommandSchemaLoaderUtils.loadHttpSchema(this, this.getSchemaName(), true, false); - } - - @Override - protected void validate() throws OnapCommandException { - if (! this.isAuthRequired()) { - if (this.getParametersMap().containsKey(Constants.DEAFULT_PARAMETER_USERNAME)) { - this.getParametersMap().get(Constants.DEAFULT_PARAMETER_USERNAME).setOptional(true); - } - if (this.getParametersMap().containsKey(Constants.DEAFULT_PARAMETER_PASSWORD)) { - this.getParametersMap().get(Constants.DEAFULT_PARAMETER_PASSWORD).setOptional(true); - } - } - - super.validate(); - } - - private boolean isAuthRequired() { - return !this.getService().isNoAuth() - && "false".equals(this.getParametersMap().get(Constants.DEFAULT_PARAMETER_NO_AUTH).getValue()) - && this.getInfo().getCommandType().equals(CommandType.CMD); - } - - @Override - protected void run() throws OnapCommandException { - try { - // For auth/catalog type commands, login and logout logic is not required - boolean isAuthRequired = this.isAuthRequired(); - - this.authClient = new OnapAuthClient( - this, - this.getResult().isDebug()); - - if (isAuthRequired) { - this.authClient.login(); - } - - this.processRequest(); - - if (isAuthRequired) { - this.authClient.logout(); - } - - if (this.getResult().isDebug() && authClient != null) { - this.getResult().setDebugInfo(this.authClient.getDebugInfo()); - } - } catch (OnapCommandException e) { - if (this.getResult().isDebug() && authClient != null) { - this.getResult().setDebugInfo(this.authClient.getDebugInfo()); - } - throw e; - } - } - - protected void processRequest() throws OnapCommandException { - - HttpInput httpInput = OnapCommandUtils.populateParameters(this.getParametersMap(), this.getInput()); - httpInput.setUri(this.authClient.getServiceUrl() + httpInput.getUri()); - - HttpResult output = this.authClient.run(httpInput); - - this.getResult().setOutput(output); - if (!this.getSuccessStatusCodes().contains(output.getStatus())) { - throw new OnapCommandExecutionFailed(this.getName(), output.getBody(), output.getStatus()); - } - - Map<String, ArrayList<String>> results = OnapCommandUtils.populateOutputs(this.getResultMap(), output); - results = OnapCommandUtils.populateOutputsFromInputParameters(results, this.getParametersMap()); - - for (OnapCommandResultAttribute attr : this.getResult().getRecords()) { - attr.setValues(results.get(attr.getName())); - } - generateJsonMock(httpInput, output, this.getSchemaName()); - } - - private void generateJsonMock(HttpInput httpInput, HttpResult httpResult, String schemaName) - throws OnapCommandFailedMocoGenerate { - - if (OnapCommandConfg.isSampleGenerateEnabled()) { - try { - MockRequest mockRequest = new MockRequest(); - mockRequest.setMethod(httpInput.getMethod()); - mockRequest.setUri(httpInput.getUri()); - mockRequest.setHeaders(httpInput.getReqHeaders()); - mockRequest.setJson(httpInput.getBody()); - - MockResponse mockResponse = new MockResponse(); - mockResponse.setStatus(httpResult.getStatus()); - mockResponse.setJson(httpResult.getBody()); - - MockJsonGenerator.generateMocking(mockRequest, mockResponse, OnapCommandConfg.getSampleGenerateTargetFolder() - + "/" + schemaName.replace(".yaml", "") + "-moco.json"); - } catch (IOException error) { - throw new OnapCommandFailedMocoGenerate(schemaName, error); - } - } - } -} 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 40d8eee5..2458a141 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 @@ -18,11 +18,10 @@ package org.onap.cli.fw.cmd; import java.util.List; -import org.onap.cli.fw.OnapCommand; -import org.onap.cli.fw.OnapCommandSchema; import org.onap.cli.fw.error.OnapCommandException; +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cli.fw.schema.OnapCommandSchemaInfo; import org.onap.cli.fw.utils.OnapCommandDiscoveryUtils; -import org.onap.cli.fw.utils.SchemaInfo; /** * Refresh external schema. @@ -34,13 +33,13 @@ public class OnapSchemaRefreshCommand extends OnapCommand { @Override protected void run() throws OnapCommandException { - List<SchemaInfo> schemas = OnapCommandDiscoveryUtils.discoverOrLoadSchemas(true); + List<OnapCommandSchemaInfo> schemas = OnapCommandDiscoveryUtils.discoverOrLoadSchemas(true); int i = 0; - for (SchemaInfo schema : schemas) { + for (OnapCommandSchemaInfo schema : schemas) { if (schema.isIgnore()) { continue; } - + i++; this.getResult().getRecordsMap().get("sr.no").getValues().add(String.valueOf(i)); this.getResult().getRecordsMap().get("command").getValues().add(schema.getCmdName()); 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 ff3f1c98..8448276b 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 @@ -20,14 +20,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.onap.cli.fw.OnapCommand; -import org.onap.cli.fw.OnapCommandRegistrar; -import org.onap.cli.fw.OnapCommandSchema; -import org.onap.cli.fw.conf.Constants; +import org.onap.cli.fw.conf.OnapCommandConstants; import org.onap.cli.fw.error.OnapCommandException; import org.onap.cli.fw.input.OnapCommandParameter; +import org.onap.cli.fw.registrar.OnapCommandRegistrar; +import org.onap.cli.fw.schema.OnapCommandSchema; +import org.onap.cli.fw.schema.OnapCommandSchemaLoader; import org.onap.cli.fw.utils.OnapCommandDiscoveryUtils; -import org.onap.cli.fw.utils.OnapCommandSchemaLoaderUtils; /** * Validate schema command. @@ -52,10 +51,10 @@ public class OnapSchemaValidateCommand extends OnapCommand { String ocsVersion = String.valueOf(versionParam.getValue()); String type = OnapCommandDiscoveryUtils.identitySchemaProfileType( - OnapCommandSchemaLoaderUtils.validateSchemaVersion(location, ocsVersion)); + OnapCommandSchemaLoader.validateSchemaVersion(location, ocsVersion)); OnapCommand cmd = null; - if (type.equals(Constants.BASIC_SCHEMA_PROFILE)) { + if (type.equals(OnapCommandConstants.BASIC_SCHEMA_PROFILE)) { cmd = new OnapCommand() { @Override protected void run() throws OnapCommandException { |