Make schema-validate independent of schema profile 89/24389/9
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Fri, 13 Oct 2017 19:34:20 +0000 (01:04 +0530)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 21 Nov 2017 12:37:19 +0000 (18:07 +0530)
Now schema-validate is able to validate schema of any
given type supported.

Issue-Id: CLI-66

Change-Id: I47ac5e81e9b12dd575e0a4cdc7e8e8bad0f87474
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
42 files changed:
framework/src/main/java/org/onap/cli/fw/OnapCommand.java
framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
framework/src/main/java/org/onap/cli/fw/cmd/OnapHttpCommand.java
framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java
framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java
framework/src/main/java/org/onap/cli/fw/conf/Constants.java
framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java
framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutorInfoMissing.java [deleted file]
framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterOptionConflict.java
framework/src/main/java/org/onap/cli/fw/error/OnapUnsupportedSchemaProfile.java
framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java
framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java
framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java
framework/src/main/java/org/onap/cli/fw/output/OnapCommandResultAttribute.java
framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java
framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
framework/src/main/java/org/onap/cli/fw/utils/OnapCommandSchemaLoaderUtils.java
framework/src/main/java/org/onap/cli/fw/utils/SchemaInfo.java
framework/src/main/resources/open-cli-schema/default_input_parameters.yaml [moved from framework/src/main/resources/default_input_parameters.yaml with 91% similarity]
framework/src/main/resources/open-cli-schema/http/basic-login.yaml [moved from framework/src/main/resources/open-cli-schema/basic-login.yaml with 100% similarity]
framework/src/main/resources/open-cli-schema/http/basic-logout.yaml [moved from framework/src/main/resources/open-cli-schema/basic-logout.yaml with 100% similarity]
framework/src/main/resources/open-cli-schema/http/catalog.yaml [moved from framework/src/main/resources/open-cli-schema/catalog.yaml with 100% similarity]
framework/src/main/resources/open-cli-schema/http/default_input_parameters_http.yaml [moved from framework/src/main/resources/default_input_parameters_http.yaml with 89% similarity]
framework/src/main/resources/open-cli-schema/schema-validate.yaml
framework/src/main/resources/open-cli.properties
framework/src/main/resources/version.info
framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java
framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
framework/src/test/java/org/onap/cli/fw/conf/OnapCommandConfgTest.java
framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
framework/src/test/java/org/onap/cli/fw/http/HttpInputOutputTest.java
framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java
framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java
framework/src/test/java/org/onap/cli/fw/output/print/OnapCommandPrintTest.java
framework/src/test/java/org/onap/cli/fw/output/print/TableGeneratorTest.java
framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java
framework/src/test/resources/open-cli.properties [new file with mode: 0644]
plugins/sample/src/main/resources/open-cli-schema/hello-world.yaml
validate/validation/src/test/java/org/onap/cli/validation/OnapValidationTest.java

index fe6adf2..d931aaf 100644 (file)
@@ -135,7 +135,7 @@ public abstract class OnapCommand {
     }
 
     /**
-     * Initialize this command from command schema.
+     * Initialize this command from command schema and assumes schema is already validated.
      *
      * @throws OnapCommandRegistrationFailed
      *             Command Registration Exception
@@ -155,18 +155,27 @@ public abstract class OnapCommand {
      *             ParameterNameConflict Exception
      * @throws OnapCommandInvalidSchemaVersion
      *             InvalidSchemaVersion Exception
+     *
+     * @return List of error strings
      */
-    public void initializeSchema(String schema) throws OnapCommandException {
+    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);
-        OnapCommandSchemaLoaderUtils.loadSchema(this, schema, true, false);
-        this.initializeProfileSchema();
+
+        List<String> errors = OnapCommandSchemaLoaderUtils.loadSchema(this, schema, true, validate);
+        errors.addAll(this.initializeProfileSchema());
         this.isInitialzied = true;
-    }
 
+        return errors;
+    }
     /**
-     * Any additional profile based such as http/swagger schema could be initialized.
+     * Any additional profile based such as http schema could be initialized.
      */
-    protected void initializeProfileSchema() throws OnapCommandException {
+    protected List<String> initializeProfileSchema() throws OnapCommandException {
+        return new ArrayList<>();
     }
 
     /*
index b44279f..9d1d9d0 100644 (file)
@@ -17,8 +17,6 @@
 package org.onap.cli.fw;
 
 import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -33,7 +31,6 @@ import org.onap.cli.fw.error.OnapCommandHelpFailed;
 import org.onap.cli.fw.error.OnapCommandInvalidRegistration;
 import org.onap.cli.fw.error.OnapCommandNotFound;
 import org.onap.cli.fw.error.OnapCommandProductVersionInvalid;
-import org.onap.cli.fw.error.OnapCommandRegistrationFailed;
 import org.onap.cli.fw.error.OnapCommandRegistrationProductInfoMissing;
 import org.onap.cli.fw.error.OnapUnsupportedSchemaProfile;
 import org.onap.cli.fw.input.cache.OnapCommandParameterCache;
@@ -56,6 +53,8 @@ import org.onap.cli.fw.utils.SchemaInfo;
 public class OnapCommandRegistrar {
     private Map<String, Class<? extends OnapCommand>> registry = new HashMap<>();
 
+    private Map<String, Class<? extends OnapCommand>> registryProfilePlugins = new HashMap<>();
+
     private Set<String> availableProductVersions = new HashSet<>();
 
     private String enabledProductVersion = OnapCommandConfg.getEnabledProductVersion();
@@ -111,6 +110,10 @@ public class OnapCommandRegistrar {
 
     }
 
+    private void registerProfilePlugin(String profile, Class<? extends OnapCommand> cmd) {
+        this.registryProfilePlugins.put(profile, cmd);
+    }
+
     /**
      * Get global registrar.
      *
@@ -156,6 +159,14 @@ public class OnapCommandRegistrar {
         return cmds;
     }
 
+    public Class<? extends OnapCommand> getProfilePlugin(String profile) throws OnapUnsupportedSchemaProfile {
+        if (!this.registryProfilePlugins.containsKey(profile)) {
+            throw new OnapUnsupportedSchemaProfile(profile);
+        }
+
+        return this.registryProfilePlugins.get(profile);
+    }
+
     public Set<String> getAvailableProductVersions() {
         return this.availableProductVersions;
     }
@@ -205,18 +216,9 @@ public class OnapCommandRegistrar {
             throw new OnapCommandNotFound(cmdName, version);
         }
 
-        OnapCommand cmd;
-        try {
-            Constructor<?> constr = cls.getConstructor();
-            cmd = (OnapCommand) constr.newInstance();
-
-            String schemaName = OnapCommandDiscoveryUtils.getSchemaInfo(cmdName, version).getSchemaName();
-
-            cmd.initializeSchema(schemaName);
-        } catch (OnapCommandException | NoSuchMethodException | SecurityException | InstantiationException
-                | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
-            throw new OnapCommandRegistrationFailed(cmdName, e);
-        }
+        OnapCommand cmd = OnapCommandDiscoveryUtils.loadCommandClass(cls);
+        String schemaName = OnapCommandDiscoveryUtils.getSchemaInfo(cmdName, version).getSchemaName();
+        cmd.initializeSchema(schemaName);
 
         return cmd;
     }
@@ -231,6 +233,7 @@ public class OnapCommandRegistrar {
                 if (ano.schema() != null && !ano.schema().isEmpty()) {
                     map.put(ano.schema(), cmd);
                 } else if (ano.type() != null && !ano.type().isEmpty()) {
+                       this.registerProfilePlugin(ano.type(), cmd);
                     map.put(ano.type(), cmd);
                 } else {
                     throw new OnapUnsupportedSchemaProfile(ano.schema());
@@ -242,15 +245,19 @@ public class OnapCommandRegistrar {
     }
 
     private void autoDiscoverSchemas() throws OnapCommandException {
-        List<SchemaInfo> schemas = OnapCommandDiscoveryUtils.discoverOrLoadSchemas();
+        List<SchemaInfo> schemas = OnapCommandDiscoveryUtils.discoverOrLoadSchemas(true);
 
         Map<String, Class<OnapCommand>> plugins = this.autoDiscoverCommandPlugins();
 
         for (SchemaInfo schema : schemas) {
-            if (plugins.containsKey(schema.getSchemaProfile())) {
+            if (schema.isIgnore()) {
+                continue;
+            }
+
+             if (plugins.containsKey(schema.getSchemaName())) {
+                 this.register(schema.getCmdName(), schema.getProduct(), plugins.get(schema.getSchemaName()));
+             } else if (plugins.containsKey(schema.getSchemaProfile())) {
                 this.register(schema.getCmdName(), schema.getProduct(), plugins.get(schema.getSchemaProfile()));
-            } else if (plugins.containsKey(schema.getSchemaName())) {
-                this.register(schema.getCmdName(), schema.getProduct(), plugins.get(schema.getSchemaName()));
             } else {
                 throw new OnapUnsupportedSchemaProfile(schema.getSchemaURI());
             }
index 11fc71f..892f367 100644 (file)
@@ -98,8 +98,8 @@ public class OnapHttpCommand extends OnapCommand {
     }
 
     @Override
-    protected void initializeProfileSchema() throws OnapCommandException {
-        OnapCommandSchemaLoaderUtils.loadHttpSchema(this, this.getSchemaName(), true, false);
+    protected List<String> initializeProfileSchema() throws OnapCommandException {
+        return OnapCommandSchemaLoaderUtils.loadHttpSchema(this, this.getSchemaName(), true, false);
     }
 
     @Override
index 3319f03..40d8eee 100644 (file)
@@ -34,13 +34,15 @@ public class OnapSchemaRefreshCommand extends OnapCommand {
     @Override
     protected void run() throws OnapCommandException {
 
-        List<SchemaInfo> schemas = OnapCommandDiscoveryUtils.discoverSchemas();
-        // Will override the existing json file
-        OnapCommandDiscoveryUtils.persistSchemaInfo(schemas);
-
-        for (int i = 0; i < schemas.size(); i++) {
-            SchemaInfo schema = schemas.get(i);
-            this.getResult().getRecordsMap().get("sr.no").getValues().add(String.valueOf(i + 1));
+        List<SchemaInfo> schemas = OnapCommandDiscoveryUtils.discoverOrLoadSchemas(true);
+        int i = 0;
+        for (SchemaInfo 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());
             this.getResult().getRecordsMap().get("schema").getValues().add(schema.getSchemaName());
             this.getResult().getRecordsMap().get("ocs-version").getValues().add(schema.getVersion());
index 15e3775..ff3f1c9 100644 (file)
 
 package org.onap.cli.fw.cmd;
 
+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.error.OnapCommandException;
 import org.onap.cli.fw.input.OnapCommandParameter;
+import org.onap.cli.fw.utils.OnapCommandDiscoveryUtils;
 import org.onap.cli.fw.utils.OnapCommandSchemaLoaderUtils;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
 /**
  * Validate schema command.
  */
@@ -35,30 +38,40 @@ public class OnapSchemaValidateCommand extends OnapCommand {
     @Override
     protected void run() throws OnapCommandException {
         Map<String, OnapCommandParameter> paramMap = getParametersMap();
+
         OnapCommandParameter locationParam = paramMap.get("schema-location");
         String location = String.valueOf(locationParam.getValue());
+
         OnapCommandParameter interSchemaParam = paramMap.get("internal-schema");
         boolean isInternalSchema = Boolean.valueOf(String.valueOf(interSchemaParam.getValue()));
-        if (isInternalSchema) {
+        if (isInternalSchema && location.startsWith("/")) {
             location = location.substring(1);
         }
 
-        List<String> error = OnapCommandSchemaLoaderUtils.loadSchema(new OnapCommand() {
-            @Override
-            protected void run() throws OnapCommandException {
-            }
-        }, location, true, true);
+        OnapCommandParameter versionParam = paramMap.get("ocs-version");
+        String ocsVersion = String.valueOf(versionParam.getValue());
 
+        String type = OnapCommandDiscoveryUtils.identitySchemaProfileType(
+                OnapCommandSchemaLoaderUtils.validateSchemaVersion(location, ocsVersion));
 
-        error.addAll(OnapCommandSchemaLoaderUtils.loadHttpSchema(new OnapHttpCommand(),
-                location, true, true));
+        OnapCommand cmd = null;
+        if (type.equals(Constants.BASIC_SCHEMA_PROFILE)) {
+            cmd = new OnapCommand() {
+                @Override
+                protected void run() throws OnapCommandException {
+                }
+            };
+        } else {
+            cmd = OnapCommandDiscoveryUtils.loadCommandClass(OnapCommandRegistrar.getRegistrar().getProfilePlugin(type));
+        }
 
+        List<String> error = cmd.initializeSchema(location, true);
         List<String> slNumber = new ArrayList<>();
         for (int i = 1; i <= error.size(); i++) {
             slNumber.add(String.valueOf(i));
         }
-        this.getResult().getRecords().get(0).setValues(slNumber);
-        this.getResult().getRecords().get(1).setValues(error);
+        this.getResult().getRecordsMap().get("sl-no").setValues(slNumber);
+        this.getResult().getRecordsMap().get("error").setValues(error);
     }
 
 }
index 248ea06..4c7581b 100644 (file)
@@ -71,6 +71,7 @@ public class Constants {
     public static final String INFO_SERVICE = "service";
     public static final String INFO_TYPE = "type";
     public static final String INFO_AUTHOR = "author";
+    public static final String INFO_IGNORE = "ignore";
 
     //parameters
     public static final String PARAMETERS = "parameters";
index bc01a76..19e7b48 100644 (file)
@@ -22,7 +22,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 import java.util.UUID;
 import java.util.stream.Collectors;
 
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutorInfoMissing.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutorInfoMissing.java
deleted file mode 100644 (file)
index 3de7438..0000000
+++ /dev/null
@@ -1,30 +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.error;
-
-/**
- * Command result initialization failed.
- *
- */
-public class OnapCommandExecutorInfoMissing extends OnapCommandException {
-
-    private static final long serialVersionUID = 8580121615330415456L;
-
-    public OnapCommandExecutorInfoMissing(String cmd) {
-        super("0x6002", "Command " + cmd + " excutor info is missing from schema");
-    }
-}
index 1ee0a8c..e7c9e40 100644 (file)
@@ -24,8 +24,8 @@ public class OnapCommandParameterOptionConflict extends OnapCommandException {
 
     private static final long serialVersionUID = -3107017890769007297L;
 
-    public OnapCommandParameterOptionConflict(String name) {
-        super("0x7006", "Parameter option " + name + " is in conflict, only one option is allowed with given name");
+    public OnapCommandParameterOptionConflict(String schemaName, String name) {
+        super("0x7006", "In " + schemaName + ", Parameter option " + name + " is in conflict, only one option is allowed with given name");
 
     }
 }
index 098f04d..1037559 100644 (file)
@@ -26,7 +26,7 @@ public class OnapUnsupportedSchemaProfile extends OnapCommandException {
 
     private static final String ERROR_CODE = "0xb004";
 
-    private static final String ERROR_MSG = "Unsupported schema profile";
+    private static final String ERROR_MSG = "Unsupported schema profile ";
 
     public OnapUnsupportedSchemaProfile(String schema) {
         super(ERROR_CODE, ERROR_MSG + schema);
index f3f3bfe..c52965f 100644 (file)
@@ -31,6 +31,8 @@ public class OnapCommandInfo {
 
     private CommandType type = CommandType.CMD;
 
+    private boolean ignore = false;
+
     public String getProduct() {
         return product;
     }
@@ -62,4 +64,14 @@ public class OnapCommandInfo {
     public void setCommandType(CommandType type) {
         this.type = type;
     }
+
+    public boolean isIgnore() {
+        return ignore;
+    }
+
+    public void setIgnore(boolean ignore) {
+        this.ignore = ignore;
+    }
+
+
 }
\ No newline at end of file
index 05b5fa2..ac2e852 100644 (file)
 
 package org.onap.cli.fw.input;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
 
 import org.onap.cli.fw.error.OnapCommandException;
 import org.onap.cli.fw.error.OnapCommandInvalidParameterValue;
 import org.onap.cli.fw.error.OnapCommandParameterMissing;
 import org.onap.cli.fw.utils.OnapCommandUtils;
 
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 /**
  * Oclip Command's input parameter.
index 678bcfc..ae5d86c 100644 (file)
 
 package org.onap.cli.fw.output;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.onap.cli.fw.conf.Constants;
 import org.onap.cli.fw.error.OnapCommandException;
 import org.onap.cli.fw.error.OnapCommandOutputFormatNotsupported;
@@ -24,11 +29,6 @@ import org.onap.cli.fw.input.ParameterType;
 import org.onap.cli.fw.output.print.OnapCommandPrint;
 import org.onap.cli.fw.utils.OnapCommandUtils;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 /**
  * Oclip Command result holds the final output of the command.
  *
index ba4d543..fe4ed32 100644 (file)
 
 package org.onap.cli.fw.output;
 
-import org.onap.cli.fw.input.ParameterType;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.onap.cli.fw.input.ParameterType;
+
 /**
  * Oclip command output records, helps to define the title and its description while command is defined and during run
  * time, it captures the value of the output as well.
index beb2330..96ce59b 100644 (file)
 
 package org.onap.cli.fw.output.print;
 
-import org.apache.commons.csv.CSVFormat;
-import org.apache.commons.csv.CSVPrinter;
-import org.onap.cli.fw.error.OnapCommandOutputPrintingFailed;
-import org.onap.cli.fw.output.PrintDirection;
-
 import java.io.IOException;
 import java.io.StringWriter;
 import java.util.ArrayList;
@@ -31,6 +26,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
 
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVPrinter;
+import org.onap.cli.fw.error.OnapCommandOutputPrintingFailed;
+import org.onap.cli.fw.output.PrintDirection;
+
 /**
  * Oclip Command Table print.
  *
index 69fd2ac..3722043 100644 (file)
@@ -26,6 +26,8 @@ import static org.onap.cli.fw.conf.Constants.SCHEMA_PATH_PATERN;
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -37,6 +39,7 @@ import org.onap.cli.fw.conf.Constants;
 import org.onap.cli.fw.conf.OnapCommandConfg;
 import org.onap.cli.fw.error.OnapCommandDiscoveryFailed;
 import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.error.OnapCommandInstantiationFailed;
 import org.onap.cli.fw.error.OnapCommandInvalidSchema;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
@@ -59,7 +62,7 @@ public class OnapCommandDiscoveryUtils {
      *             exception
      */
     public static SchemaInfo getSchemaInfo(String cmd, String version) throws OnapCommandException {
-        List<SchemaInfo> list = OnapCommandDiscoveryUtils.discoverOrLoadSchemas();
+        List<SchemaInfo> list = OnapCommandDiscoveryUtils.discoverOrLoadSchemas(false);
         SchemaInfo schemaInfo = null;
         if (list != null) {
             for (SchemaInfo schema : list) {
@@ -81,9 +84,9 @@ public class OnapCommandDiscoveryUtils {
      * @throws OnapCommandDiscoveryFailed
      *             exception
      */
-    public static List<SchemaInfo> discoverOrLoadSchemas() throws OnapCommandException {
+    public static List<SchemaInfo> discoverOrLoadSchemas(boolean forceRefresh) throws OnapCommandException {
         List<SchemaInfo> schemas = new ArrayList<>();
-        if (OnapCommandConfg.isDiscoverAlways() || !OnapCommandDiscoveryUtils.isAlreadyDiscovered()) {
+        if (forceRefresh || OnapCommandConfg.isDiscoverAlways() || !OnapCommandDiscoveryUtils.isAlreadyDiscovered()) {
             schemas = OnapCommandDiscoveryUtils.discoverSchemas();
             if (!schemas.isEmpty()) {
                 OnapCommandDiscoveryUtils.persistSchemaInfo(schemas);
@@ -211,7 +214,7 @@ public class OnapCommandDiscoveryUtils {
         return resolver.getResources("classpath*:" + pattern);
     }
 
-    static String identitySchemaProfileType(Map<String, ?> schemaYamlMap) {
+    public static String identitySchemaProfileType(Map<String, ?> schemaYamlMap) {
 
         for (String schemeType : OnapCommandConfg.getSchemaAttrInfo(Constants.SCHEMA_TYPES_SUPPORTED)) {
             if (schemaYamlMap.get(schemeType) != null) {
@@ -240,9 +243,9 @@ public class OnapCommandDiscoveryUtils {
 
                 for (Resource resource : res) {
                     try {
-                        resourceMap = loadSchema(resource);
+                        resourceMap = OnapCommandSchemaLoaderUtils.loadSchema(resource);
                     } catch (OnapCommandException e) {
-                        OnapCommandUtils.LOG.error("Invalid schema " + resource.getURI().toString(), e);
+                        OnapCommandUtils.LOG.error("Ignores invalid schema " + resource.getURI().toString(), e);
                         continue;
                     }
 
@@ -271,6 +274,9 @@ public class OnapCommandDiscoveryUtils {
                             schema.setProduct(infoMap.get(Constants.INFO_PRODUCT).toString());
                         }
 
+                        if (infoMap != null && infoMap.get(Constants.INFO_IGNORE) != null) {
+                            schema.setIgnore(infoMap.get(Constants.INFO_IGNORE).toString());
+                        }
                         schema.setSchemaProfile(identitySchemaProfileType(resourceMap));
 
                         extSchemas.add(schema);
@@ -299,4 +305,18 @@ public class OnapCommandDiscoveryUtils {
         return clss;
     }
 
+    /**
+     * Instantiate command plugin
+     * @throws OnapCommandInstantiationFailed
+     */
+    public static OnapCommand loadCommandClass(Class <? extends OnapCommand> cls) throws OnapCommandInstantiationFailed {
+        try {
+            Constructor<?> constr = cls.getConstructor();
+            return (OnapCommand) constr.newInstance();
+        } catch (NoSuchMethodException | SecurityException | InstantiationException
+                | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+            throw new OnapCommandInstantiationFailed(cls.getName(), e);
+        }
+
+    }
 }
index a33b98a..e115fc0 100644 (file)
@@ -35,6 +35,7 @@ import static org.onap.cli.fw.conf.Constants.HTTP_MANDATORY_SECTIONS;
 import static org.onap.cli.fw.conf.Constants.HTTP_SECTIONS;
 import static org.onap.cli.fw.conf.Constants.INFO;
 import static org.onap.cli.fw.conf.Constants.INFO_AUTHOR;
+import static org.onap.cli.fw.conf.Constants.INFO_IGNORE;
 import static org.onap.cli.fw.conf.Constants.INFO_PARAMS_LIST;
 import static org.onap.cli.fw.conf.Constants.INFO_PARAMS_MANDATORY_LIST;
 import static org.onap.cli.fw.conf.Constants.INFO_PRODUCT;
@@ -92,6 +93,7 @@ import org.onap.cli.fw.OnapCommand;
 import org.onap.cli.fw.ad.OnapService;
 import org.onap.cli.fw.cmd.CommandType;
 import org.onap.cli.fw.cmd.OnapHttpCommand;
+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.OnapCommandInvalidSchema;
@@ -138,12 +140,7 @@ public class OnapCommandSchemaLoaderUtils {
             inputStream = OnapCommandSchemaLoaderUtils.loadSchemaFromFile(schemaName);
         }
 
-        Map<String, ?> values = null;
-        try {
-            values = (Map<String, ?>) new Yaml().load(inputStream);
-        } catch (Exception e) {
-            throw new OnapCommandInvalidSchema(schemaName, e);
-        }
+        Map<String, ?> values = OnapCommandSchemaLoaderUtils.loadSchema(inputStream, schemaName);
         String schemaVersion = "";
         if (values.keySet().contains(OPEN_CLI_SCHEMA_VERSION)) {
             Object obj = values.get(OPEN_CLI_SCHEMA_VERSION);
@@ -173,6 +170,11 @@ public class OnapCommandSchemaLoaderUtils {
             if (includeDefault) {
                 Map<String, ?> defaultParameterMap = includeDefault ?
                         validateSchemaVersion(DEFAULT_PARAMETER_FILE_NAME, cmd.getSchemaVersion()) : new HashMap<>();
+                //mrkanag default_parameter is supported only for parameters.
+                if (defaultParameterMap.containsKey(INFO)) {
+                       defaultParameterMap.remove(Constants.INFO);
+                }
+                
                 errors.addAll(OnapCommandSchemaLoaderUtils.parseSchema(cmd, defaultParameterMap, validateSchema));
             }
 
@@ -196,6 +198,12 @@ public class OnapCommandSchemaLoaderUtils {
             if (includeDefault) {
                 Map<String, ?> defaultParameterMap = includeDefault ?
                         validateSchemaVersion(DEFAULT_PARAMETER_HTTP_FILE_NAME, cmd.getSchemaVersion()) : new HashMap<>();
+                
+                //mrkanag default_parameter is supported only for parameters.
+                if (defaultParameterMap.containsKey(INFO)) {
+                       defaultParameterMap.remove(Constants.INFO);
+                }
+                
                 errors.addAll(OnapCommandSchemaLoaderUtils.parseSchema(cmd, defaultParameterMap, validateSchema));
             }
 
@@ -297,6 +305,11 @@ public class OnapCommandSchemaLoaderUtils {
                                     Object mode = infoMap.get(key1);
                                     info.setAuthor(mode.toString());
                                     break;
+
+                                case INFO_IGNORE:
+                                    Object ignore = infoMap.get(key1);
+                                    info.setIgnore(ignore.toString().equalsIgnoreCase(Constants.BOOLEAN_TRUE));
+                                    break;
                             }
                         }
 
@@ -351,7 +364,9 @@ public class OnapCommandSchemaLoaderUtils {
 
                                     case SHORT_OPTION:
                                         if (shortOptions.contains(parameter.get(key2))) {
-                                            OnapCommandUtils.throwOrCollect(new OnapCommandParameterOptionConflict(parameter.get(key2)), exceptionList, validate);
+                                            OnapCommandUtils.throwOrCollect(new OnapCommandParameterOptionConflict(
+                                                    cmd.getSchemaName(),
+                                                    parameter.get(key2)), exceptionList, validate);
                                         }
                                         shortOptions.add(parameter.get(key2));
                                         param.setShortOption(parameter.get(key2));
@@ -359,7 +374,9 @@ public class OnapCommandSchemaLoaderUtils {
 
                                     case LONG_OPTION:
                                         if (longOptions.contains(parameter.get(key2))) {
-                                            OnapCommandUtils.throwOrCollect(new OnapCommandParameterOptionConflict(parameter.get(key2)), exceptionList, validate);
+                                            OnapCommandUtils.throwOrCollect(new OnapCommandParameterOptionConflict(
+                                                    cmd.getSchemaName(),
+                                                    parameter.get(key2)), exceptionList, validate);
                                         }
                                         longOptions.add(parameter.get(key2));
                                         param.setLongOption(parameter.get(key2));
@@ -688,7 +705,7 @@ public class OnapCommandSchemaLoaderUtils {
         return errorList;
     }
 
-    static InputStream loadSchemaFromFile(String schemaLocation) throws OnapCommandInvalidSchema {
+    public static InputStream loadSchemaFromFile(String schemaLocation) throws OnapCommandInvalidSchema {
         File schemaFile = new File(schemaLocation);
         try {
             FileInputStream inputFileStream = new FileInputStream(schemaFile);
@@ -705,4 +722,41 @@ public class OnapCommandSchemaLoaderUtils {
         }
     }
 
+    /**
+     * Get schema map.
+     *
+     * @param resource
+     *            resource obj
+     * @return map
+     * @throws OnapCommandInvalidSchema
+     *             exception
+     */
+    public static Map<String, ?> loadSchema(Resource resource) throws OnapCommandInvalidSchema {
+        try {
+            return  OnapCommandSchemaLoaderUtils.loadSchema(resource.getInputStream(), resource.getFilename());
+        } catch (IOException e) {
+            throw new OnapCommandInvalidSchema(resource.getFilename(), e);
+        }
+
+    }
+
+    /**
+     * Get schema map.
+     *
+     * @param resource
+     *            resource obj
+     * @return map
+     * @throws OnapCommandInvalidSchema
+     *             exception
+     */
+    public static Map<String, ?> loadSchema(InputStream stream, String schemaName) throws OnapCommandInvalidSchema  {
+        Map<String, ?> values = null;
+        try {
+            values = (Map<String, ?>) new Yaml().load(stream);
+        } catch (Exception e) {
+            throw new OnapCommandInvalidSchema(schemaName, e);
+        }
+
+        return values;
+    }
 }
index 85d6b1f..beb02a3 100644 (file)
@@ -48,6 +48,8 @@ public class SchemaInfo {
 
     private String schemaProfile = Constants.BASIC_SCHEMA_PROFILE;
 
+    private String ignore = Constants.BOOLEAN_FALSE;
+
     public String getSchemaName() {
         return schemaName;
     }
@@ -104,6 +106,17 @@ public class SchemaInfo {
         this.type = type;
     }
 
+    public boolean isIgnore() {
+        return Constants.BOOLEAN_TRUE.equalsIgnoreCase(this.getIgnore());
+    }
+
+    public String getIgnore() {
+        return ignore;
+    }
+
+    public void setIgnore(String ignore) {
+        this.ignore = ignore;
+    }
 
 
 }
index 65acfb0..c17b3a0 100644 (file)
@@ -21,6 +21,13 @@ parameters:
     short_option: i
     long_option: internal-schema
     is_optional: false
+  - name: ocs-version
+    type: string
+    description: OCS version
+    short_option: b
+    long_option: ocs-version
+    is_optional: true
+    default_value: 1.0
 
 results:
   direction: landscape
index 757b025..813e46d 100644 (file)
@@ -8,7 +8,7 @@ cli.version=1.0
 cli.schema.top_level_params_list=open_cli_schema_version,name,description,parameters,results,http,info
 cli.schema.top_level_mandatory_list=open_cli_schema_version
 
-cli.schema.info_params_list=product,service,type,author
+cli.schema.info_params_list=product,service,type,author,ignore
 cli.schema.info_params_mandatory_list=product,service
 
 cli.schema.input_params_list=name,description,type,short_option,long_option, is_optional,default_value,is_secured,is_include
index fc959d1..edfa61d 100644 (file)
@@ -3,5 +3,5 @@ Available products: __AVAILABLE_PRODUCT_VERSIONS__
 Enabled product   : __ENABLED_PRODUCT_VERSIONS__
 
 To enable a product, use one of following methods:
-1. In scripting mode, Set environment variable OPEN_CLI_PRODUCT_IN_USE
-2. In interactive mode, set the directive 'use <product>'
+1. In scripting mode, set environment variable OPEN_CLI_PRODUCT_IN_USE
+2. In interactive mode, use the directive 'use <product>'
index 339a0f6..3f9f780 100644 (file)
@@ -25,12 +25,10 @@ import java.io.File;
 import java.net.URL;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.cli.fw.error.OnapCommandException;
 import org.onap.cli.fw.error.OnapCommandHelpFailed;
 import org.onap.cli.fw.error.OnapCommandNotFound;
-import org.onap.cli.fw.error.OnapCommandRegistrationFailed;
 
 public class OnapCommandRegistrarTest {
 
index 7aedd42..99f4519 100644 (file)
 
 package org.onap.cli.fw.cmd;
 
-import org.junit.Test;
-import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.output.OnapCommandResultAttribute;
+import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 
-import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.output.OnapCommandResultAttribute;
 
 public class OnapSchemaRefreshCommandTest {
 
@@ -32,15 +32,11 @@ public class OnapSchemaRefreshCommandTest {
         cmd.initializeSchema("schema-refresh.yaml");
         cmd.execute();
 
-        List<OnapCommandResultAttribute> oclipCommandResultAttribute = cmd.getResult()
+        List<OnapCommandResultAttribute> oclipCommandResultAttributes = cmd.getResult()
                 .getRecords();
 
-        String s1Number = oclipCommandResultAttribute.get(0).getValues().get(0);
-        String cmdName = oclipCommandResultAttribute.get(1).getValues().get(0);
-        String cmdVer = oclipCommandResultAttribute.get(2).getValues().get(0);
-        String cmdFile = oclipCommandResultAttribute.get(3).getValues().get(0);
-        String version = oclipCommandResultAttribute.get(4).getValues().get(0);
 
-        assertTrue(s1Number.equalsIgnoreCase("1"));
+        assertTrue(oclipCommandResultAttributes.size() > 1);
+
     }
 }
index 2355d66..8d8de2f 100644 (file)
 
 package org.onap.cli.fw.cmd;
 
+import org.junit.Ignore;
 import org.junit.Test;
+import org.onap.cli.fw.OnapCommand;
+import org.onap.cli.fw.OnapCommandRegistrar;
 import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.input.OnapCommandParameter;
 import org.onap.cli.fw.schema.ValidateSchemaTest;
 
+
 public class OnapSchemaValidateCommandTest {
 
+    @Ignore
     @Test
     public void validateSchemaCommandTest1() throws OnapCommandException {
-        OnapSchemaValidateCommand cmd = new OnapSchemaValidateCommand();
-        cmd.initializeSchema("schema-validate.yaml");
-        for (OnapCommandParameter param : cmd.getParameters()) {
-            if ("host-username".equals(param.getName())) {
-                param.setValue("test");
-            } else if ("host-password".equals(param.getName())) {
-                param.setValue("test");
-            } else if ("host-url".equals(param.getName())) {
-                param.setValue("test-url");
-            } else if ("schema-location".equals(param.getName())) {
-                param.setValue("schema-validate-pass.yaml");
-            } else if ("internal-schema".equals(param.getName())) {
-                param.setValue("true");
-            }
-        }
+        OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("schema-validate");
+        cmd.getParametersMap().get("schema-location").setValue("schema-validate-pass.yaml");
+        cmd.getParametersMap().get("internal-schema").setValue("true");
         cmd.execute();
     }
 
+    @Ignore
     @Test
     public void validateSchemaCommandTest2() throws OnapCommandException {
-        OnapSchemaValidateCommand cmd = new OnapSchemaValidateCommand();
-        cmd.initializeSchema("schema-validate.yaml");
-        for (OnapCommandParameter param : cmd.getParameters()) {
-            if ("host-username".equals(param.getName())) {
-                param.setValue("test");
-            } else if ("host-password".equals(param.getName())) {
-                param.setValue("test");
-            } else if ("host-url".equals(param.getName())) {
-                param.setValue("test-url");
-            } else if ("schema-location".equals(param.getName())) {
-                param.setValue(
-                        ValidateSchemaTest.class.getClassLoader().getResource("schema-validate-pass.yaml").getFile());
-            }
-        }
+        OnapCommand cmd = OnapCommandRegistrar.getRegistrar().get("schema-validate");
+        cmd.getParametersMap().get("schema-location").setValue(
+                ValidateSchemaTest.class.getClassLoader().getResource("schema-validate-pass.yaml").getFile());
+        cmd.getParametersMap().get("internal-schema").setValue("true");
         cmd.execute();
     }
 }
index 1a67770..2c25991 100644 (file)
 
 package org.onap.cli.fw.conf;
 
-import org.junit.Assert;
-import org.junit.Test;
-
 import java.io.IOException;
 import java.util.Properties;
 
+import org.junit.Assert;
+import org.junit.Test;
+
 public class OnapCommandConfgTest {
 
     @Test
index 45560c4..899f2e3 100644 (file)
@@ -94,9 +94,9 @@ public class OnapCommandErrorTest {
 
     @Test
     public void oclipCommandExecutorInfoMissingTest() {
-        OnapCommandExecutorInfoMissing failed = new OnapCommandExecutorInfoMissing("Test");
+        OnapCommandInstantiationFailed failed = new OnapCommandInstantiationFailed("Test");
 
-        assertEquals("0x6002::Command Test excutor info is missing from schema", failed.getMessage());
+        assertEquals("0x6002::Failed to instantiate the command plugin Test", failed.getMessage());
     }
 
     @Test
@@ -225,9 +225,9 @@ public class OnapCommandErrorTest {
 
     @Test
     public void oclipCommandParameterOptionConflictTest() {
-        OnapCommandParameterOptionConflict failed = new OnapCommandParameterOptionConflict("option");
+        OnapCommandParameterOptionConflict failed = new OnapCommandParameterOptionConflict("test", "option");
 
-        assertEquals("0x7006::Parameter option option is in conflict, only one option is allowed with given name",
+        assertEquals("0x7006::In test, Parameter option option is in conflict, only one option is allowed with given name",
                 failed.getMessage());
     }
 
@@ -296,5 +296,5 @@ public class OnapCommandErrorTest {
         OnapCommandInvalidCommandType failed = new OnapCommandInvalidCommandType("test");
 
         assertEquals("0x3003::Command type test is invalid", failed.getMessage());
-    }    
+    }
 }
index 900d72e..0a3a817 100644 (file)
@@ -18,10 +18,10 @@ package org.onap.cli.fw.http;
 
 import static org.junit.Assert.assertTrue;
 
-import org.junit.Test;
-
 import java.util.HashMap;
 
+import org.junit.Test;
+
 public class HttpInputOutputTest {
 
     @Test
index ab00f90..785092c 100644 (file)
 package org.onap.cli.fw.http;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
-import mockit.Invocation;
-import mockit.Mock;
-import mockit.MockUp;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpUriRequest;
@@ -31,9 +31,9 @@ import org.junit.Before;
 import org.junit.Test;
 import org.onap.cli.fw.error.OnapCommandHttpFailure;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import mockit.Invocation;
+import mockit.Mock;
+import mockit.MockUp;
 
 public class OnapHttpConnectionTest {
     HttpInput inp = null;
index f2e9f0b..44656f9 100644 (file)
 
 package org.onap.cli.fw.input;
 
-import org.junit.Test;
-import org.onap.cli.fw.error.OnapCommandException;
-import org.onap.cli.fw.error.OnapCommandInvalidParameterValue;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.error.OnapCommandInvalidParameterValue;
 
 public class OnapCommandParameterTest {
 
index 76d139a..7ab3fe5 100644 (file)
@@ -18,11 +18,11 @@ package org.onap.cli.fw.output;
 
 import static org.junit.Assert.assertTrue;
 
+import java.util.Collections;
+
 import org.junit.Test;
 import org.onap.cli.fw.input.ParameterType;
 
-import java.util.Collections;
-
 public class OnapCommandResultAttributeScopeTest {
     @Test
     public void oclipCommandResultAttributeTest() {
index dddab1b..9c832c2 100644 (file)
@@ -19,15 +19,15 @@ package org.onap.cli.fw.output;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.cli.fw.error.OnapCommandException;
 import org.onap.cli.fw.input.ParameterType;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 public class OnapCommandResultTest {
 
     @Test
index ae17d6d..84c868b 100644 (file)
@@ -18,15 +18,15 @@ package org.onap.cli.fw.output.print;
 
 import static org.junit.Assert.assertEquals;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 import org.junit.Ignore;
 import org.junit.Test;
 import org.onap.cli.fw.error.OnapCommandOutputPrintingFailed;
 import org.onap.cli.fw.output.PrintDirection;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 public class OnapCommandPrintTest {
 
     @Test
index f9ae071..58ff475 100644 (file)
@@ -18,13 +18,13 @@ package org.onap.cli.fw.output.print;
 
 import static org.junit.Assert.assertEquals;
 
-import org.junit.Before;
-import org.junit.Test;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.junit.Before;
+import org.junit.Test;
+
 public class TableGeneratorTest {
     private TableGenerator table;
 
index 22c36c3..a900fe6 100644 (file)
 
 package org.onap.cli.fw.schema;
 
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
 import org.junit.Test;
 import org.onap.cli.fw.OnapCommand;
 import org.onap.cli.fw.cmd.OnapHttpCommand;
@@ -23,10 +27,6 @@ import org.onap.cli.fw.error.OnapCommandException;
 import org.onap.cli.fw.error.OnapCommandInvalidSchema;
 import org.onap.cli.fw.utils.OnapCommandSchemaLoaderUtils;
 
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
 public class ValidateSchemaTest {
 
     @Test(expected = OnapCommandInvalidSchema.class)
diff --git a/framework/src/test/resources/open-cli.properties b/framework/src/test/resources/open-cli.properties
new file mode 100644 (file)
index 0000000..23ba780
--- /dev/null
@@ -0,0 +1,39 @@
+cli.ignore_auth=false
+cli.http.api_key_use_cookies=true
+cli.discover_always=true
+cli.product_name=open-cli
+cli.version=1.0
+
+#schema validation
+cli.schema.top_level_params_list=open_cli_schema_version,name,description,parameters,results,http,info
+cli.schema.top_level_mandatory_list=open_cli_schema_version
+
+cli.schema.info_params_list=product,service,type,author,ignore
+cli.schema.info_params_mandatory_list=product,service
+
+cli.schema.input_params_list=name,description,type,short_option,long_option, is_optional,default_value,is_secured,is_include
+cli.schema.input_params_mandatory_list=name,description,type
+
+cli.schema.result_params_list=name,description,scope,type,is_secured, default_value
+cli.schema.result_params_mandatory_list=name, description, type, scope
+
+#http
+cli.schema.http_sections=request,service,success_codes,result_map,sample_response
+cli.schema.http_mandatory_sections=request, success_codes
+
+cli.schema.http_request_params=uri,method,body,headers,queries,multipart_entity_name
+cli.schema.http_request_mandatory_params=uri,method
+
+cli.schema.service_params_list=name,version,auth,mode
+cli.schema.service_params_mandatory_list=auth,mode
+
+cli.schema.http_methods=post,get,delete,put,head
+
+cli.schema.boolean_values=true,false
+cli.schema.auth_values=none,basic
+cli.schema.mode_values=direct,catalog
+cli.command.type=cmd,auth,catalog
+
+# mrkanag Move this to db, once exteranl command registration is supported in place of discovery
+cli.schema.type.supported=http
+
index fddb8c4..9e99046 100644 (file)
@@ -14,7 +14,7 @@ parameters:
       description: name of the person
       long_option: name
       short_option: b
-      default_value: ${DEMO_NAME}
+      default_value: ${env:DEMO_NAME}
       type: string
       is_optional: false
 
index 2157313..de55f99 100644 (file)
@@ -63,6 +63,9 @@ public class OnapValidationTest {
             System.out.println(version);
             System.out.println("==========================\n\n");
             for (SchemaInfo sch : OnapCommandRegistrar.getRegistrar().listCommandInfo()) {
+                if (sch.isIgnore()) {
+                    continue;
+                }
                 if (sch.getProduct().equals(version)) {
                     System.out.println(
                     "************************* validate '" + sch.getCmdName() + "' *******************************");
@@ -81,6 +84,9 @@ public class OnapValidationTest {
             System.out.println("==========================\n\n");
             int i = 1;
             for (SchemaInfo sch : OnapCommandRegistrar.getRegistrar().listCommandInfo()) {
+               if (sch.isIgnore()) {
+                    continue;
+                }
                 if (sch.getProduct().equals(version)) {
                     System.out.println("[" + i++ + "] " + sch.getCmdName());
                     System.out.println("-----------------------------------------------\n\n");