Add schema type for plugins like http 83/24383/7
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Fri, 13 Oct 2017 07:39:41 +0000 (13:09 +0530)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Mon, 20 Nov 2017 08:37:58 +0000 (14:07 +0530)
Issue-Id: CLI-66

Change-Id: I3756ccce8682644822850fd2621d9356bad74dc8
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
17 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/OnapCommandSchema.java
framework/src/main/java/org/onap/cli/fw/cmd/OnapHttpCommand.java
framework/src/main/java/org/onap/cli/fw/conf/Constants.java
framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
framework/src/main/java/org/onap/cli/fw/utils/SchemaInfo.java
framework/src/main/resources/META-INF/services/org.onap.cli.fw.OnapCommand
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/ad/OnapAuthClientCommandBasedTest.java
framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
main/src/main/java/org/onap/cli/main/OnapCli.java
main/src/main/java/org/onap/cli/main/error/OnapCliArgumentValueMissing.java
main/src/main/java/org/onap/cli/main/error/OnapCliInvalidArgument.java
main/src/test/java/org/onap/cli/main/error/OnapCliArgumentTest.java

index 89c6220..87c1ba7 100644 (file)
@@ -19,12 +19,8 @@ package org.onap.cli.fw;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 
-import org.onap.cli.fw.ad.OnapService;
-import org.onap.cli.fw.cmd.CommandType;
 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.OnapCommandHelpFailed;
 import org.onap.cli.fw.error.OnapCommandInvalidParameterType;
@@ -33,7 +29,6 @@ import org.onap.cli.fw.error.OnapCommandInvalidResultAttributeScope;
 import org.onap.cli.fw.error.OnapCommandInvalidSchema;
 import org.onap.cli.fw.error.OnapCommandInvalidSchemaVersion;
 import org.onap.cli.fw.error.OnapCommandNotInitialized;
-import org.onap.cli.fw.error.OnapCommandParameterMissing;
 import org.onap.cli.fw.error.OnapCommandParameterNameConflict;
 import org.onap.cli.fw.error.OnapCommandParameterOptionConflict;
 import org.onap.cli.fw.error.OnapCommandRegistrationFailed;
@@ -198,7 +193,7 @@ public abstract class OnapCommand {
         Map<String, OnapCommandParameter> paramMap = this.getParametersMap();
 
         // -h or --help is always higher precedence !, user can set this value to get help message
-        if ("true".equals(paramMap.get(Constants.DEFAULT_PARAMETER_HELP).getValue())) {
+        if (Constants.BOOLEAN_TRUE.equals(paramMap.get(Constants.DEFAULT_PARAMETER_HELP).getValue())) {
             OnapCommandResult result = new OnapCommandResult();
             result.setType(ResultType.TEXT);
             result.setOutput(this.printHelp());
@@ -206,7 +201,7 @@ public abstract class OnapCommand {
         }
 
         // -v or --version is next higher precedence !, user can set this value to get help message
-        if ("true".equals(paramMap.get(Constants.DEFAULT_PARAMETER_VERSION).getValue())) {
+        if (Constants.BOOLEAN_TRUE.equals(paramMap.get(Constants.DEFAULT_PARAMETER_VERSION).getValue())) {
             OnapCommandResult result = new OnapCommandResult();
             result.setType(ResultType.TEXT);
             result.setOutput(this.printVersion());
@@ -219,16 +214,16 @@ public abstract class OnapCommand {
         // -f or --format
         this.cmdResult.setType(
                 ResultType.get(paramMap.get(Constants.DEFAULT_PARAMETER_OUTPUT_FORMAT).getValue().toString()));
-        if ("true".equals(paramMap.get(Constants.DEFAULT_PARAMETER_OUTPUT_ATTR_LONG).getValue())) {
+        if (Constants.BOOLEAN_TRUE.equals(paramMap.get(Constants.DEFAULT_PARAMETER_OUTPUT_ATTR_LONG).getValue())) {
             this.cmdResult.setScope(OnapCommandResultAttributeScope.LONG);
         }
         // --no-title
-        if ("true".equals(paramMap.get(Constants.DEFAULT_PARAMETER_OUTPUT_NO_TITLE).getValue())) {
+        if (Constants.BOOLEAN_TRUE.equals(paramMap.get(Constants.DEFAULT_PARAMETER_OUTPUT_NO_TITLE).getValue())) {
             this.cmdResult.setIncludeTitle(false);
         }
 
         // --debug
-        if ("true".equals(paramMap.get(Constants.DEFAULT_PARAMETER_DEBUG).getValue())) {
+        if (Constants.BOOLEAN_TRUE.equals(paramMap.get(Constants.DEFAULT_PARAMETER_DEBUG).getValue())) {
             this.cmdResult.setDebug(true);
         }
 
index 1d2c516..f42f68f 100644 (file)
@@ -19,7 +19,6 @@ package org.onap.cli.fw;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
-import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -27,7 +26,6 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.io.IOUtils;
-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;
@@ -101,7 +99,7 @@ public class OnapCommandRegistrar {
      *             Invalid registration exception
      * @throws OnapCommandRegistrationProductInfoMissing
      */
-    public void register(String name, String version, Class<? extends OnapCommand> cmd) throws OnapCommandInvalidRegistration, OnapCommandRegistrationProductInfoMissing {
+    private void register(String name, String version, Class<? extends OnapCommand> cmd) throws OnapCommandInvalidRegistration, OnapCommandRegistrationProductInfoMissing {
         if (version == null || version.isEmpty()) {
             throw new OnapCommandRegistrationProductInfoMissing(name);
         }
@@ -210,12 +208,7 @@ public class OnapCommandRegistrar {
             Constructor<?> constr = cls.getConstructor();
             cmd = (OnapCommand) constr.newInstance();
 
-            String schemaName;
-            if (cmd.getClass().equals(OnapHttpCommand.class)) { // NOSONAR
-                schemaName = OnapCommandUtils.getSchemaInfo(cmdName, version).getSchemaName();
-            } else {
-                schemaName = this.getSchemaFileName(cls);
-            }
+            String schemaName = OnapCommandUtils.getSchemaInfo(cmdName, version).getSchemaName();
 
             cmd.initializeSchema(schemaName);
         } catch (OnapCommandException | NoSuchMethodException | SecurityException | InstantiationException
@@ -233,7 +226,13 @@ public class OnapCommandRegistrar {
         for (Class<OnapCommand> cmd : cmds) {
             if (cmd.isAnnotationPresent(OnapCommandSchema.class)) {
                 OnapCommandSchema ano = cmd.getAnnotation(OnapCommandSchema.class);
-                map.put(ano.schema(), cmd);
+                if (ano.schema() != null && !ano.schema().isEmpty()) {
+                    map.put(ano.schema(), cmd);
+                } else if (ano.type() != null && !ano.type().isEmpty()) {
+                    map.put(ano.type(), cmd);
+                } else {
+                    throw new OnapUnsupportedSchemaProfile(ano.schema());
+                }
             }
         }
 
@@ -246,8 +245,8 @@ public class OnapCommandRegistrar {
         Map<String, Class<OnapCommand>> plugins = this.autoDiscoverCommandPlugins();
 
         for (SchemaInfo schema : schemas) {
-            if (schema.isHttp()) {
-                this.register(schema.getCmdName(), schema.getProduct(), OnapHttpCommand.class);
+            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 {
@@ -256,11 +255,6 @@ public class OnapCommandRegistrar {
         }
     }
 
-    private String getSchemaFileName(Class<? extends OnapCommand> cmd) {
-        OnapCommandSchema ano = (OnapCommandSchema) cmd.getAnnotation(OnapCommandSchema.class);
-        return ano.schema();
-    }
-
     /**
      * Helps to find the Oclip CLI version, could be used with --version or -v option.
      *
index 16b53ea..d5f7104 100644 (file)
@@ -26,7 +26,7 @@ import java.lang.annotation.RetentionPolicy;
  * default if the schema declaration is missing for a command abc-create, schema file name could be
  * abc-create-schema.yaml, corresponding command would like as below
  *
- * @OnapCommandSchema(name="abc-create", schema="onap-abc-create-schema.yaml") public class AbcCreate extends
+ * @OnapCommandSchema(type="http", schema="onap-abc-create-schema.yaml") public class AbcCreate extends
  *                                        OnapCommand { ... }
  */
 @Retention(RetentionPolicy.RUNTIME)
@@ -37,5 +37,10 @@ public @interface OnapCommandSchema {
      *
      * @return
      */
-    String schema();
+    String schema() default "";
+
+    /**
+     * Schema type
+     */
+    String type() default "";
 }
index 198affb..7ff38b6 100644 (file)
@@ -23,6 +23,7 @@ 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;
@@ -32,7 +33,6 @@ 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.input.OnapCommandParameter;
 import org.onap.cli.fw.output.OnapCommandResultAttribute;
 import org.onap.cli.fw.utils.OnapCommandUtils;
 import org.onap.cli.http.mock.MockJsonGenerator;
@@ -43,6 +43,7 @@ import org.onap.cli.http.mock.MockResponse;
  * Oclip Command.
  *
  */
+@OnapCommandSchema(type = Constants.HTTP_SCHEMA_PROFILE)
 public class OnapHttpCommand extends OnapCommand {
 
     private HttpInput input = new HttpInput();
index bd41644..248ea06 100644 (file)
@@ -28,26 +28,26 @@ public class Constants {
     public static final String OPEN_CLI_VERSION = "cli.version";
     public static final String HTTP_API_KEY_USE_COOKIES = "cli.http.api_key_use_cookies";
 
-    public static final String TOP_LEVEL_PARAMS_LIST ="cli.schema.top_level_params_list";
-    public static final String TOP_LEVEL_MANDATORY_LIST ="cli.schema.top_level_mandatory_list";
-    public static final String SERVICE_PARAMS_LIST ="cli.schema.service_params_list";
-    public static final String SERVICE_PARAMS_MANDATORY_LIST ="cli.schema.service_params_mandatory_list";
-    public static final String INFO_PARAMS_LIST ="cli.schema.info_params_list";
-    public static final String INFO_PARAMS_MANDATORY_LIST ="cli.schema.info_params_mandatory_list";
-    public static final String INPUT_PARAMS_LIST ="cli.schema.input_params_list";
-    public static final String INPUT_PARAMS_MANDATORY_LIST ="cli.schema.input_params_mandatory_list";
-    public static final String RESULT_PARAMS_LIST ="cli.schema.result_params_list";
-    public static final String RESULT_PARAMS_MANDATORY_LIST ="cli.schema.result_params_mandatory_list";
-    public static final String HTTP_SECTIONS ="cli.schema.http_sections";
-    public static final String HTTP_MANDATORY_SECTIONS ="cli.schema.http_mandatory_sections";
-    public static final String HTTP_REQUEST_PARAMS ="cli.schema.http_request_params";
-    public static final String HTTP_REQUEST_MANDATORY_PARAMS ="cli.schema.http_request_mandatory_params";
-    public static final String HTTP_METHODS ="cli.schema.http_methods";
-    public static final String BOOLEAN_VALUE ="cli.schema.boolean_values";
-    public static final String AUTH_VALUES="cli.schema.auth_values";
-    public static final String MODE_VALUES="cli.schema.mode_values";
-    public static final String COMMAND_TYPE_VALUES="cli.command.type";
-
+    public static final String TOP_LEVEL_PARAMS_LIST = "cli.schema.top_level_params_list";
+    public static final String TOP_LEVEL_MANDATORY_LIST = "cli.schema.top_level_mandatory_list";
+    public static final String SERVICE_PARAMS_LIST = "cli.schema.service_params_list";
+    public static final String SERVICE_PARAMS_MANDATORY_LIST = "cli.schema.service_params_mandatory_list";
+    public static final String INFO_PARAMS_LIST = "cli.schema.info_params_list";
+    public static final String INFO_PARAMS_MANDATORY_LIST = "cli.schema.info_params_mandatory_list";
+    public static final String INPUT_PARAMS_LIST = "cli.schema.input_params_list";
+    public static final String INPUT_PARAMS_MANDATORY_LIST = "cli.schema.input_params_mandatory_list";
+    public static final String RESULT_PARAMS_LIST = "cli.schema.result_params_list";
+    public static final String RESULT_PARAMS_MANDATORY_LIST = "cli.schema.result_params_mandatory_list";
+    public static final String HTTP_SECTIONS = "cli.schema.http_sections";
+    public static final String HTTP_MANDATORY_SECTIONS = "cli.schema.http_mandatory_sections";
+    public static final String HTTP_REQUEST_PARAMS = "cli.schema.http_request_params";
+    public static final String HTTP_REQUEST_MANDATORY_PARAMS = "cli.schema.http_request_mandatory_params";
+    public static final String HTTP_METHODS = "cli.schema.http_methods";
+    public static final String BOOLEAN_VALUE = "cli.schema.boolean_values";
+    public static final String AUTH_VALUES = "cli.schema.auth_values";
+    public static final String MODE_VALUES = "cli.schema.mode_values";
+    public static final String COMMAND_TYPE_VALUES = "cli.command.type";
+    public static final String SCHEMA_TYPES_SUPPORTED = "cli.schema.type.supported";
     //http connection
     public static final String SSLCONTEST_TLS = "TLSV1.2";
     public static final String APPLICATION_JSON = "application/json";
index ca70827..0f64ed3 100644 (file)
@@ -1658,8 +1658,11 @@ public class OnapCommandUtils {
     }
 
     private static String identitySchemaProfileType(Map<String, ?> schemaYamlMap) {
-        if (schemaYamlMap.get(Constants.HTTP) != null) {
-            return Constants.HTTP_SCHEMA_PROFILE;
+
+        for (String schemeType : OnapCommandConfg.getSchemaAttrInfo(Constants.SCHEMA_TYPES_SUPPORTED)) {
+            if (schemaYamlMap.get(schemeType) != null) {
+                return schemeType;
+            }
         }
 
         return Constants.BASIC_SCHEMA_PROFILE;
@@ -1852,16 +1855,16 @@ public class OnapCommandUtils {
      */
     public static SchemaInfo getSchemaInfo(String cmd, String version) throws OnapCommandException {
         List<SchemaInfo> list = discoverOrLoadSchemas();
-        SchemaInfo schemaStr = null;
+        SchemaInfo schemaInfo = null;
         if (list != null) {
             for (SchemaInfo schema : list) {
                 if (cmd.equals(schema.getCmdName()) && version.equals(schema.getProduct())) {
-                    schemaStr = schema;
+                    schemaInfo = schema;
                     break;
                 }
             }
         }
-        return schemaStr;
+        return schemaInfo;
     }
 
     /**
index 462fcce..85d6b1f 100644 (file)
@@ -19,35 +19,33 @@ package org.onap.cli.fw.utils;
 import org.onap.cli.fw.cmd.CommandType;
 import org.onap.cli.fw.conf.Constants;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
 /**
  * SchemaInfo is used in discovery caching.
  *
  */
 public class SchemaInfo {
 
-       /**
-        * Name of the schema file name
-        */
+    /**
+     * Name of the schema file name
+     */
     private String schemaName;
-    
+
     /**
      * Schema location in complete path
      */
     private String schemaURI;
-    
+
     private String cmdName;
-    
+
     private String product;
-    
+
     /**
      * OCS version
      */
     private String version;
-    
+
     private String type = CommandType.CMD.name();
-    
+
     private String schemaProfile = Constants.BASIC_SCHEMA_PROFILE;
 
     public String getSchemaName() {
@@ -98,11 +96,6 @@ public class SchemaInfo {
         this.schemaProfile = internal;
     }
 
-    @JsonIgnore
-    public boolean isHttp() {
-        return this.getSchemaProfile().equals(Constants.HTTP_SCHEMA_PROFILE);
-    }
-
     public String getType() {
         return type;
     }
index e29c2c2..1993bcb 100644 (file)
@@ -3,3 +3,4 @@ org.onap.cli.fw.cmd.OnapSchemaRefreshCommand
 org.onap.cli.fw.cmd.BasicAuthLoginCommand
 org.onap.cli.fw.cmd.BasicAuthLogoutCommand
 org.onap.cli.fw.cmd.CatalogCommand
+org.onap.cli.fw.cmd.OnapHttpCommand
\ No newline at end of file
index 84a4736..757b025 100644 (file)
@@ -34,7 +34,6 @@ cli.schema.auth_values=none,basic
 cli.schema.mode_values=direct,catalog
 cli.command.type=cmd,auth,catalog
 
-<<<<<<< 5301969fc26714a8494882027116282898278f32:framework/src/main/resources/onap.properties
 #product version
 cli.product.version=cli-1.0
 
@@ -42,5 +41,5 @@ cli.product.version=cli-1.0
 cli.sample.gen.enable=false
 cli.sample.gen.target=.
 
-=======
->>>>>>> Migrate onap-cli-schema into open-cli-schema:framework/src/main/resources/open-cli.properties
+# mrkanag Move this to db, once exteranl command registration is supported in place of discovery
+cli.schema.type.supported=http
index 34f4d96..fc959d1 100644 (file)
@@ -2,6 +2,6 @@ CLI version       : __VERSION__
 Available products: __AVAILABLE_PRODUCT_VERSIONS__
 Enabled product   : __ENABLED_PRODUCT_VERSIONS__
 
-To enable a product , use one of following methods:
+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>'
index 8a69ae6..339a0f6 100644 (file)
@@ -25,6 +25,7 @@ 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;
@@ -56,24 +57,6 @@ public class OnapCommandRegistrarTest {
         }
     }
 
-    @Test
-    public void registerTest() throws OnapCommandException {
-        OnapCommand test = new OnapCommandTest();
-        Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
-        registerar.register("Test", "open-cli", cmd);
-        OnapCommand cc = registerar.get("Test");
-        assertTrue(cmd == cc.getClass());
-
-    }
-
-    @Test
-    public void cmdTestSchema() throws OnapCommandException {
-        OnapCommand test = new OnapCommandTest();
-        Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
-        registerar.register("Test", "open-cli", cmd);
-        OnapCommand cc = registerar.get("Test");
-    }
-
     @Test
     public void oclipCommandNotFoundTest() throws OnapCommandException {
         try {
@@ -87,40 +70,6 @@ public class OnapCommandRegistrarTest {
         }
     }
 
-    @Test
-    public void oclipCommandRegistrationFailedTest() throws OnapCommandException {
-
-        @OnapCommandSchema(schema = "sample-test-schema.yaml")
-        class Test extends OnapCommand {
-
-            @Override
-            protected void run() throws OnapCommandException {
-
-            }
-
-        }
-
-        OnapCommand com = new Test();
-        Class<OnapCommand> cmd = (Class<OnapCommand>) com.getClass();
-        try {
-            registerar.register("Test2", "open-cli", cmd);
-            registerar.get("Test2");
-            fail("This should have thrown an exception");
-        } catch (OnapCommandRegistrationFailed e) {
-            assertEquals("0x2002", e.getErrorCode());
-        }
-    }
-
-    @Test(expected = OnapCommandHelpFailed.class)
-    public void helpTestException() throws OnapCommandException {
-        OnapCommand test = new OnapCommandTest1();
-        Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
-        registerar = new OnapCommandRegistrar();
-        registerar.register("test1", "open-cli", cmd);
-        String help = registerar.getHelp();
-        assertNotNull(help);
-    }
-
     @Test
     public void helpTest() throws OnapCommandException {
         String help = registerar.getHelp();
index a2a25bc..9c733c9 100644 (file)
@@ -18,6 +18,7 @@ package org.onap.cli.fw.ad;
 
 import static org.junit.Assert.fail;
 
+import org.junit.Before;
 import org.junit.Test;
 import org.onap.cli.fw.OnapCommand;
 import org.onap.cli.fw.OnapCommandRegistrar;
@@ -25,9 +26,15 @@ 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.OnapCommandProductVersionInvalid;
 
 public class OnapAuthClientCommandBasedTest {
 
+    @Before
+    public void setup() throws OnapCommandProductVersionInvalid, OnapCommandException {
+        OnapCommandRegistrar.getRegistrar().setEnabledProductVersion(OnapCommandConfg.getProductName());
+    }
+
     @Test
     public void internalCommandTest() {
         try {
@@ -37,7 +44,7 @@ public class OnapAuthClientCommandBasedTest {
             cmd.execute();
         } catch (OnapCommandException e) {
             fail("Internal command failed to run");
-            e.printStackTrace();
+            e.printStackTrace(System.out);
         }
     }
 
@@ -52,7 +59,7 @@ public class OnapAuthClientCommandBasedTest {
             cmd.execute();
         } catch (OnapCommandException e) {
             fail("External command Yes Auth Yes Catalog failed to run");
-            e.printStackTrace();
+            e.printStackTrace(System.out);
         }
     }
 
@@ -64,8 +71,8 @@ public class OnapAuthClientCommandBasedTest {
 
             cmd.execute();
         } catch (OnapCommandException e) {
-            fail("External command Yes Auth No Catalog failed to run");
-            e.printStackTrace();
+            fail("External command Yes Auth No Catalog failed to run " + e.getMessage());
+            e.printStackTrace(System.out);
         }
     }
 
@@ -80,7 +87,7 @@ public class OnapAuthClientCommandBasedTest {
             cmd.execute();
         } catch (OnapCommandException e) {
             fail("External command Yes Auth No Catalog failed to run");
-            e.printStackTrace();
+            e.printStackTrace(System.out);
         }
     }
 
@@ -93,7 +100,7 @@ public class OnapAuthClientCommandBasedTest {
             cmd.execute();
         } catch (OnapCommandException e) {
             fail("External command No Auth No Catalog failed to run");
-            e.printStackTrace();
+            e.printStackTrace(System.out);
         }
     }
 
index e874dc9..419c4ed 100644 (file)
@@ -255,7 +255,7 @@ public class OnapCommandUtilsTest {
     @Test
     public void findOnapCommandsTest() {
         List<Class<OnapCommand>> cmds = OnapCommandUtils.discoverCommandPlugins();
-        assertTrue(cmds.size() == 6);
+        assertTrue(cmds.size() == 7);
     }
 
     @Test
index 357ee5e..77de440 100644 (file)
@@ -98,7 +98,7 @@ public class OnapCli {
         try {
             if ((args.size() == 1) && (this.getLongOption(OnapCliConstants.PARAM_HELP_LOGN).equals(args.get(0))
                         || this.getShortOption(OnapCliConstants.PARAM_HELP_SHORT).equals(args.get(0)))) {
-                this.print(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("onap-readme.txt")));
+                this.print(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("oclip-readme.txt")));
                 String help = OnapCommandRegistrar.getRegistrar().getHelp();
                 this.print(help);
                 this.exitSuccessfully();
index f1dd1ef..15a9395 100644 (file)
@@ -27,6 +27,6 @@ public class OnapCliArgumentValueMissing extends OnapCommandException {
     private static final long serialVersionUID = -6362824415803063442L;
 
     public OnapCliArgumentValueMissing(String arg) {
-        super("0x7001", "Value for argument " + arg + " is missing");
+        super("0x7101", "Value for argument " + arg + " is missing");
     }
 }
index e9f3adc..10fbb75 100644 (file)
@@ -25,7 +25,7 @@ import org.onap.cli.fw.error.OnapCommandException;
 public class OnapCliInvalidArgument extends OnapCommandException {
 
     private static final long serialVersionUID = -1438492553530993246L;
-    private static final String ERROR_CODE = "0x7000";
+    private static final String ERROR_CODE = "0x7102";
     private static final String ERROR_MESSAGE1 = "Invalid argument ";
 
     public OnapCliInvalidArgument(String arg) {
index fcb919b..aebdbcf 100644 (file)
@@ -25,15 +25,15 @@ public class OnapCliArgumentTest {
     @Test
     public void onapCliArgumentValueMissingTest() {
         OnapCliArgumentValueMissing failed = new OnapCliArgumentValueMissing("Argument value missing");
-        assertEquals("0x7001::Value for argument Argument value missing is missing", failed.getMessage());
+        assertEquals("0x7101::Value for argument Argument value missing is missing", failed.getMessage());
     }
 
     @Test
     public void onapCliInvalidArgumentTest() {
         OnapCliInvalidArgument failed = new OnapCliInvalidArgument("Invalid Argument");
-        assertEquals("0x7000::Invalid argument Invalid Argument", failed.getMessage());
+        assertEquals("0x7102::Invalid argument Invalid Argument", failed.getMessage());
         failed = new OnapCliInvalidArgument("Invalid Argument", new Exception(""));
-        assertEquals("0x7000::Invalid argument Invalid Argument , ", failed.getMessage());
+        assertEquals("0x7102::Invalid argument Invalid Argument , ", failed.getMessage());
     }
 
 }