summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-09-30 06:02:50 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-09-30 14:00:24 +0530
commitc51d7e1fd1c4500cae7a692ff68b37001db78fdd (patch)
tree6567aa24b415d843aa910393387228013353c06e
parent53caabc55566788a6fa0b8017621227efd5b0c06 (diff)
Normalize the error code in exceptions
CLI-2 Change-Id: I9d205993c9ca8fbf58459352fa023a2bf80ca376 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java4
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java15
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutorInfoMissing.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpHeaderNotFound.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResultMap.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidDefaultParameter.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterType.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidPrintDirection.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidResultAttributeScope.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchemaVersion.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotInitialized.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputFormatNotsupported.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterMissing.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNameConflict.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNotFound.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterOptionConflict.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandProductVersionInvalid.java4
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultEmpty.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandServiceNotFound.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java82
-rw-r--r--framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java16
-rw-r--r--main/src/main/java/org/onap/cli/main/error/OnapCliArgumentValueMissing.java2
-rw-r--r--main/src/main/java/org/onap/cli/main/error/OnapCliInvalidArgument.java2
-rw-r--r--main/src/test/java/org/onap/cli/main/error/OnapCliArgumentTest.java6
49 files changed, 113 insertions, 100 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java
index d4fff5b7..5769aa02 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandClientInitialzationFailed.java
@@ -17,13 +17,13 @@
package org.onap.cli.fw.error;
/**
- * Command not registered in MSB.
+ * Command not registered in catalog.
*
*/
public class OnapCommandClientInitialzationFailed extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415000L;
- private static final String ERROR_CODE = "0x0021";
+ private static final String ERROR_CODE = "0x5001";
private static final String ERROR_MESSAGE1 = "API client for the command ";
private static final String ERROR_MESSAGE2 = " is failed";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java
index 87d1f4d6..7a9c27bd 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandDiscoveryFailed.java
@@ -20,7 +20,7 @@ public class OnapCommandDiscoveryFailed extends OnapCommandException {
private static final long serialVersionUID = 424464582747161435L;
- private static final String ERROR_CODE = "0x0010";
+ private static final String ERROR_CODE = "0x1001";
private static final String ERROR_MESSAGE1 = "Failed auto discover schema files from ";
private static final String ERROR_MESSAGE2 = " under class path, ";
private static final String ERROR_MESSAGE3 = "' under class path directory '";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java
index 905b17bc..8e99b9a1 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandException.java
@@ -21,7 +21,20 @@ import org.slf4j.LoggerFactory;
/**
* Base command exception.
- *
+discovery 0x100
+registration 0x200
+http 0x300
+login/logout 0x400
+swagger 0x500
+execution 0x600
+input 0x700
+output 0x800
+help 0x900
+default parameter 0xa00
+schema 0xb00
+profile 0xc00
+product/service 0xd00
+catalog 0xe00
*/
public class OnapCommandException extends Exception {
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java
index 2117cec7..1ab326a1 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutionFailed.java
@@ -23,7 +23,7 @@ package org.onap.cli.fw.error;
public class OnapCommandExecutionFailed extends OnapCommandException {
private static final long serialVersionUID = 488775545436993019L;
- private static final String ERROR_CODE = "0x0001";
+ private static final String ERROR_CODE = "0x6001";
private static final String ERROR_MESSAGE1 = "Command ";
private static final String ERROR_MESSAGE2 = " failed to execute";
private static final String ERROR_MESSAGE3 = "Failed to retrive service url";
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
index b4945dda..3de7438e 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutorInfoMissing.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandExecutorInfoMissing.java
@@ -25,6 +25,6 @@ public class OnapCommandExecutorInfoMissing extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415456L;
public OnapCommandExecutorInfoMissing(String cmd) {
- super("0x0023", "Command " + cmd + " excutor info is missing from schema");
+ super("0x6002", "Command " + cmd + " excutor info is missing from schema");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java
index a2efcca5..8cc24bd7 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHelpFailed.java
@@ -23,7 +23,7 @@ package org.onap.cli.fw.error;
public class OnapCommandHelpFailed extends OnapCommandException {
private static final long serialVersionUID = -1833571383961748518L;
- private static final String ERROR_CODE = "0x0002";
+ private static final String ERROR_CODE = "0x9001";
private static final String ERROR_MSG = "Command failed to print help message";
/**
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java
index 954e6e11..bec8dd0b 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpFailure.java
@@ -23,7 +23,7 @@ package org.onap.cli.fw.error;
public class OnapCommandHttpFailure extends OnapCommandException {
private static final long serialVersionUID = 488775545436993345L;
- private static final String ERROR_CODE = "0x0025";
+ private static final String ERROR_CODE = "0x3001";
public OnapCommandHttpFailure(String error, long httpStatus) {
super(ERROR_CODE, error, httpStatus);
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpHeaderNotFound.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpHeaderNotFound.java
index ba0006ec..58fcdfd9 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpHeaderNotFound.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpHeaderNotFound.java
@@ -25,6 +25,6 @@ public class OnapCommandHttpHeaderNotFound extends OnapCommandException {
private static final long serialVersionUID = 6676137916079057963L;
public OnapCommandHttpHeaderNotFound(String name) {
- super("0x0027", "Http header " + name + " is not returned from the service");
+ super("0x3003", "Http header " + name + " is not returned from the service");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java
index 0cf2ac01..3e98d07d 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResponseBody.java
@@ -24,7 +24,7 @@ public class OnapCommandHttpInvalidResponseBody extends OnapCommandException {
private static final long serialVersionUID = 6676137916079057963L;
- private static final String ERROR_CODE = "0x0028";
+ private static final String ERROR_CODE = "0x3004";
private static final String ERR_MSG = "Http response body does not have json entry ";
public OnapCommandHttpInvalidResponseBody(String name, String error) {
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResultMap.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResultMap.java
index 491f18cb..9303c6b2 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResultMap.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandHttpInvalidResultMap.java
@@ -27,6 +27,6 @@ public class OnapCommandHttpInvalidResultMap extends OnapCommandException {
private static final long serialVersionUID = 6676137916023457963L;
public OnapCommandHttpInvalidResultMap(List<String> invalidParams) {
- super("0x0028", "Invalide result map parameters : " + invalidParams.toString());
+ super("0x3005", "Invalide result map parameters : " + invalidParams.toString());
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidDefaultParameter.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidDefaultParameter.java
index 7dc4374e..dcbb5064 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidDefaultParameter.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidDefaultParameter.java
@@ -30,6 +30,6 @@ public class OnapCommandInvalidDefaultParameter extends OnapCommandException {
* @param invalidParamsList message
*/
public OnapCommandInvalidDefaultParameter(List<String> invalidParamsList) {
- super("0x0024", "Invalid default_parameter: " + invalidParamsList.toString());
+ super("0xa001", "Invalid default_parameter: " + invalidParamsList.toString());
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterType.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterType.java
index 066e2699..e2ea3e40 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterType.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterType.java
@@ -25,7 +25,7 @@ public class OnapCommandInvalidParameterType extends OnapCommandException {
private static final long serialVersionUID = 2821256032317061066L;
public OnapCommandInvalidParameterType(String paramName) {
- super("0x0003", "Parameter type " + paramName + " is invalid");
+ super("0x7001", "Parameter type " + paramName + " is invalid");
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java
index 49d41ffc..e21d3842 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidParameterValue.java
@@ -29,7 +29,7 @@ public class OnapCommandInvalidParameterValue extends OnapCommandException {
}
public OnapCommandInvalidParameterValue(String paramName, Throwable throwable) {
- super("0x0028", "Parameter " + paramName + " value is invalid", throwable);
+ super("0x7002", "Parameter " + paramName + " value is invalid", throwable);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidPrintDirection.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidPrintDirection.java
index 960bfa40..cf14e9fc 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidPrintDirection.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidPrintDirection.java
@@ -25,7 +25,7 @@ public class OnapCommandInvalidPrintDirection extends OnapCommandException {
private static final long serialVersionUID = -6008135162231523072L;
public OnapCommandInvalidPrintDirection(String direction) {
- super("0x0004", "Print direction " + direction + " is invalid");
+ super("0x8003", "Print direction " + direction + " is invalid");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java
index c403a4ad..db4c8e6a 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidRegistration.java
@@ -27,7 +27,7 @@ public class OnapCommandInvalidRegistration extends OnapCommandException {
private static final long serialVersionUID = 7722163282274482532L;
public OnapCommandInvalidRegistration(Class cls) {
- super("0x0005", "Invalid commad class " + cls.getCanonicalName() + " registration, it should be derived from "
+ super("0x2001", "Invalid commad class " + cls.getCanonicalName() + " registration, it should be derived from "
+ OnapCommand.class.getCanonicalName());
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidResultAttributeScope.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidResultAttributeScope.java
index d4a3a5ee..8a484557 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidResultAttributeScope.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidResultAttributeScope.java
@@ -25,7 +25,7 @@ public class OnapCommandInvalidResultAttributeScope extends OnapCommandException
private static final long serialVersionUID = 117926166492101573L;
public OnapCommandInvalidResultAttributeScope(String attr) {
- super("0x0006", "Result atrribute " + attr + " is invalid");
+ super("0x8002", "Result atrribute " + attr + " is invalid");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java
index ae705577..de73ef2e 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchema.java
@@ -24,7 +24,7 @@ public class OnapCommandInvalidSchema extends OnapCommandException {
private static final long serialVersionUID = -3387652326582792833L;
- private static final String ERROR_CODE = "0x0007";
+ private static final String ERROR_CODE = "0xb001";
private static final String ERROR_MSG = "Invalid command schema ";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchemaVersion.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchemaVersion.java
index e330283f..d5996108 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchemaVersion.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandInvalidSchemaVersion.java
@@ -25,7 +25,7 @@ public class OnapCommandInvalidSchemaVersion extends OnapCommandException {
private static final long serialVersionUID = 4459731110721370387L;
public OnapCommandInvalidSchemaVersion(String schemaVersion) {
- super("0x0008", "Command schema open_cli_schema_version " + schemaVersion + " is invalid or missing");
+ super("0xb003", "Command schema open_cli_schema_version " + schemaVersion + " is invalid or missing");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java
index 5398cdd5..029da5b4 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoadProfileFailed.java
@@ -24,7 +24,7 @@ public class OnapCommandLoadProfileFailed extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415123L;
- private static final String ERROR_CODE = "0x1301";
+ private static final String ERROR_CODE = "0xc001";
private static final String ERROR_MSG = "Failed to load profile details";
/**
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java
index 01c5a600..e9c82259 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLoginFailed.java
@@ -24,7 +24,7 @@ public class OnapCommandLoginFailed extends OnapCommandException {
private static final long serialVersionUID = 5518154493762956959L;
- private static final String ERROR_CODE = "0x0009";
+ private static final String ERROR_CODE = "0x4001";
private static final String ERROR_MESSAGE1 = "Login failed";
public OnapCommandLoginFailed(String error) {
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java
index 430b65c4..df879021 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandLogoutFailed.java
@@ -23,7 +23,7 @@ package org.onap.cli.fw.error;
public class OnapCommandLogoutFailed extends OnapCommandException {
private static final long serialVersionUID = 1150649507734289032L;
- private static final String ERROR_CODE = "0x0010";
+ private static final String ERROR_CODE = "0x4002";
private static final String ERROR_MESSAGE1 = "Logout failed";
public OnapCommandLogoutFailed(String error) {
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java
index 4a070fb3..a01e47f3 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java
@@ -25,7 +25,7 @@ public class OnapCommandNotFound extends OnapCommandException {
private static final long serialVersionUID = 6676137916079057963L;
public OnapCommandNotFound(String cmdName, String version) {
- super("0x0011", "Command " + cmdName + " is not available for product version " + version +
+ super("0x6003", "Command " + cmdName + " is not available for product version " + version +
". so please check command name or product version set in env variable CLI_PRODUCT_VERSION or cli.product.version in onap.properties");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotInitialized.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotInitialized.java
index 8c3f6c22..23a1fb4d 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotInitialized.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotInitialized.java
@@ -25,6 +25,6 @@ public class OnapCommandNotInitialized extends OnapCommandException {
private static final long serialVersionUID = -2828462844645573902L;
public OnapCommandNotInitialized(String cmdName) {
- super("0x0012", "Command " + cmdName + " is not initialized");
+ super("0x6004", "Command " + cmdName + " is not initialized");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputFormatNotsupported.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputFormatNotsupported.java
index e54171ef..99a764b3 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputFormatNotsupported.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputFormatNotsupported.java
@@ -25,6 +25,6 @@ public class OnapCommandOutputFormatNotsupported extends OnapCommandException {
private static final long serialVersionUID = 2429471829315901896L;
public OnapCommandOutputFormatNotsupported(String format) {
- super("0x0013", "Command does not support the output format " + format);
+ super("0x8005", "Command does not support the output format " + format);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java
index b875e00f..03e128de 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandOutputPrintingFailed.java
@@ -24,7 +24,7 @@ public class OnapCommandOutputPrintingFailed extends OnapCommandException {
private static final long serialVersionUID = -1957064141442406239L;
- private static final String ERROR_CODE = "0x0014";
+ private static final String ERROR_CODE = "0x8006";
private static final String ERROR_MSG = "Command is failed to print the result";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterMissing.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterMissing.java
index 54e0a0de..ed2dae5b 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterMissing.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterMissing.java
@@ -25,7 +25,7 @@ public class OnapCommandParameterMissing extends OnapCommandException {
private static final long serialVersionUID = 2821256032317061066L;
public OnapCommandParameterMissing(String paramName) {
- super("0x0015", "Parameter " + paramName + " is mandatory");
+ super("0x7003", "Parameter " + paramName + " is mandatory");
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNameConflict.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNameConflict.java
index d5dc185c..1f036355 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNameConflict.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNameConflict.java
@@ -25,7 +25,7 @@ public class OnapCommandParameterNameConflict extends OnapCommandException {
private static final long serialVersionUID = -993203017969910920L;
public OnapCommandParameterNameConflict(String name) {
- super("0x0016", "Parameter name " + name + " is in conflict");
+ super("0x7004", "Parameter name " + name + " is in conflict");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNotFound.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNotFound.java
index ea3eb3a8..40f67f9a 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNotFound.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterNotFound.java
@@ -25,6 +25,6 @@ public class OnapCommandParameterNotFound extends OnapCommandException {
private static final long serialVersionUID = 6676137916079057963L;
public OnapCommandParameterNotFound(String paramName) {
- super("0x0026", "Command input parameter " + paramName + " is not valid");
+ super("0x7005", "Command input parameter " + paramName + " is not valid");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterOptionConflict.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterOptionConflict.java
index 91decf99..1ee0a8c3 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterOptionConflict.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandParameterOptionConflict.java
@@ -25,7 +25,7 @@ public class OnapCommandParameterOptionConflict extends OnapCommandException {
private static final long serialVersionUID = -3107017890769007297L;
public OnapCommandParameterOptionConflict(String name) {
- super("0x0017", "Parameter option " + name + " is in conflict, only one option is allowed with given name");
+ super("0x7006", "Parameter option " + name + " is in conflict, only one option is allowed with given name");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java
index ce8ea62f..f58c8901 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandPersistProfileFailed.java
@@ -24,7 +24,7 @@ public class OnapCommandPersistProfileFailed extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415123L;
- private static final String ERROR_CODE = "0x1302";
+ private static final String ERROR_CODE = "0xc002";
private static final String ERROR_MSG = "Failed to persist profile details";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandProductVersionInvalid.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandProductVersionInvalid.java
index 7ec69e6b..2f970b5f 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandProductVersionInvalid.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandProductVersionInvalid.java
@@ -18,7 +18,7 @@ package org.onap.cli.fw.error;
import java.util.Set;
-/**
+/*
* ONAP command product version is invalid
*
*/
@@ -27,6 +27,6 @@ public class OnapCommandProductVersionInvalid extends OnapCommandException {
private static final long serialVersionUID = 5513297861129088463L;
public OnapCommandProductVersionInvalid(String invalidVersion, Set<String> validVersions) {
- super("0x0031", "Given product version " + invalidVersion + " is invalid. Please use one of " + validVersions);
+ super("0xd002", "Given product version " + invalidVersion + " is invalid. Please use one of " + validVersions);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java
index 1a13a293..a353c4c6 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationFailed.java
@@ -24,7 +24,7 @@ public class OnapCommandRegistrationFailed extends OnapCommandException {
private static final long serialVersionUID = 5513297861129088460L;
- private static final String ERROR_CODE = "0x0018";
+ private static final String ERROR_CODE = "0x2002";
private static final String ERROR_MSG = "Failed to register the command ";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java
index 2bad5a4c..6155d274 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java
@@ -25,6 +25,6 @@ public class OnapCommandRegistrationVersionMissing extends OnapCommandException
private static final long serialVersionUID = 5513297861129088463L;
public OnapCommandRegistrationVersionMissing(String cmdName) {
- super("0x0031", "Command " + cmdName + " version is missing");
+ super("0x2003", "Command " + cmdName + " version is missing");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultEmpty.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultEmpty.java
index 5d7e4fd3..53394759 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultEmpty.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultEmpty.java
@@ -28,6 +28,6 @@ public class OnapCommandResultEmpty extends OnapCommandWarning {
* Command result empty.
*/
public OnapCommandResultEmpty() {
- super("0x1001", "Command result is empty");
+ super("0x8003", "Command result is empty");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java
index c32bda88..73131e29 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultInitialzationFailed.java
@@ -24,7 +24,7 @@ public class OnapCommandResultInitialzationFailed extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415123L;
- private static final String ERROR_CODE = "0x0022";
+ private static final String ERROR_CODE = "0x8004";
private static final String ERROR_MSG = "Failed to parse the result format of command ";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java
index 238e9092..45f44dce 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandResultMapProcessingFailed.java
@@ -23,7 +23,7 @@ package org.onap.cli.fw.error;
public class OnapCommandResultMapProcessingFailed extends OnapCommandException {
private static final long serialVersionUID = 488775545436113019L;
- private static final String ERROR_CODE = "0x0028";
+ private static final String ERROR_CODE = "0x3002";
private static final String ERROR_MSG = "Failed to parse the result format of command ";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java
index 42514366..8a0ab5a9 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandSchemaNotFound.java
@@ -24,7 +24,7 @@ public class OnapCommandSchemaNotFound extends OnapCommandException {
private static final long serialVersionUID = -3919580583845280200L;
- private static final String ERROR_CODE = "0x0019";
+ private static final String ERROR_CODE = "0xb002";
private static final String ERROR_MSG = "Command schema is missing for command ";
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandServiceNotFound.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandServiceNotFound.java
index fbbaafbd..9cc0e45f 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandServiceNotFound.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandServiceNotFound.java
@@ -25,6 +25,6 @@ public class OnapCommandServiceNotFound extends OnapCommandException {
private static final long serialVersionUID = 8580121615330415065L;
public OnapCommandServiceNotFound(String service) {
- super("0x0020", "Service " + service + " is not found in MSB");
+ super("0xd001", "Service " + service + " is not found in MSB");
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
index 6ba7f11e..b2c15086 100644
--- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
@@ -108,7 +108,7 @@ public class OnapCommandRegistrarTest {
registerar.get("Test2");
fail("This should have thrown an exception");
} catch (OnapCommandRegistrationFailed e) {
- assertEquals("0x0018", e.getErrorCode());
+ assertEquals("0x2002", e.getErrorCode());
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java b/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
index d031cc77..e56eac03 100644
--- a/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
@@ -25,36 +25,36 @@ public class OnapCommandErrorTest {
@Test
public void onapCommandDiscoveryFailedTest() {
OnapCommandDiscoveryFailed failed = new OnapCommandDiscoveryFailed("name");
- assertEquals("0x0010::Failed auto discover schema files from name under class path, ", failed.getMessage());
+ assertEquals("0x1001::Failed auto discover schema files from name under class path, ", failed.getMessage());
failed = new OnapCommandDiscoveryFailed("directory", "name");
- assertEquals("0x0010::Failed auto generate json file 'name' under class path directory 'directory'",
+ assertEquals("0x1001::Failed auto generate json file 'name' under class path directory 'directory'",
failed.getMessage());
}
@Test
public void onapCommandInvalidParameterValueTest() {
OnapCommandInvalidParameterValue failed = new OnapCommandInvalidParameterValue("name");
- assertEquals("0x0028::Parameter name value is invalid, ", failed.getMessage());
+ assertEquals("0x7002::Parameter name value is invalid, ", failed.getMessage());
}
@Test
public void onapCommandResultMapProcessingFailedTest() {
OnapCommandResultMapProcessingFailed failed = new OnapCommandResultMapProcessingFailed("name",
new Exception("failed"));
- assertEquals("0x0028::Failed to parse the result format of command name, failed", failed.getMessage());
+ assertEquals("0x3002::Failed to parse the result format of command name, failed", failed.getMessage());
}
@Test
public void onapCommandHttpHeaderNotFoundTest() {
OnapCommandHttpHeaderNotFound failed = new OnapCommandHttpHeaderNotFound("name");
- assertEquals("0x0027::Http header name is not returned from the service", failed.getMessage());
+ assertEquals("0x3003::Http header name is not returned from the service", failed.getMessage());
}
@Test
public void onapCommandClientInitialzationFailedTest() {
OnapCommandClientInitialzationFailed failed = new OnapCommandClientInitialzationFailed("Test",
new Exception("Test Command Failed"));
- assertEquals("0x0021::API client for the command Test is failed, Test Command Failed", failed.getMessage());
+ assertEquals("0x5001::API client for the command Test is failed, Test Command Failed", failed.getMessage());
}
@Test
@@ -72,75 +72,75 @@ public class OnapCommandErrorTest {
@Test
public void onapCommandExecutionFailedTest1() {
OnapCommandExecutionFailed failed = new OnapCommandExecutionFailed("Test", "Test Command Failed", 201);
- assertEquals("201::0x0001::Command Test failed to execute, Test Command Failed", failed.getMessage());
+ assertEquals("201::0x6001::Command Test failed to execute, Test Command Failed", failed.getMessage());
failed = new OnapCommandExecutionFailed("Test", new Exception("Test Command Failed"), 201);
- assertEquals("201::0x0001::Command Test failed to execute, Test Command Failed", failed.getMessage());
+ assertEquals("201::0x6001::Command Test failed to execute, Test Command Failed", failed.getMessage());
}
@Test
public void onapCommandExecutionFailedTest2() {
OnapCommandExecutionFailed failed = new OnapCommandExecutionFailed("Test Command Failed");
- assertEquals("0x0001::Test Command Failed", failed.getMessage());
+ assertEquals("0x6001::Test Command Failed", failed.getMessage());
}
@Test
public void onapCommandExecutionFailedTest3() {
OnapCommandExecutionFailed failed = new OnapCommandExecutionFailed("Test", "Test Command Failed");
- assertEquals("0x0001::Command Test failed to execute, Test Command Failed", failed.getMessage());
+ assertEquals("0x6001::Command Test failed to execute, Test Command Failed", failed.getMessage());
failed = new OnapCommandExecutionFailed("Test", new Exception("Test Command Failed"));
- assertEquals("0x0001::Command Test failed to execute, Test Command Failed", failed.getMessage());
+ assertEquals("0x6001::Command Test failed to execute, Test Command Failed", failed.getMessage());
}
@Test
public void onapCommandExecutorInfoMissingTest() {
OnapCommandExecutorInfoMissing failed = new OnapCommandExecutorInfoMissing("Test");
- assertEquals("0x0023::Command Test excutor info is missing from schema", failed.getMessage());
+ assertEquals("0x6002::Command Test excutor info is missing from schema", failed.getMessage());
}
@Test
public void onapCommandHelpFailedTest() {
OnapCommandHelpFailed failed = new OnapCommandHelpFailed(new Exception("Failed"));
- assertEquals("0x0002::Command failed to print help message, Failed", failed.getMessage());
+ assertEquals("0x9001::Command failed to print help message, Failed", failed.getMessage());
}
@Test
public void onapCommandHttpFailureTest1() {
OnapCommandHttpFailure failed = new OnapCommandHttpFailure("Failed");
- assertEquals("0x0025::Failed", failed.getMessage());
+ assertEquals("0x3001::Failed", failed.getMessage());
failed = new OnapCommandHttpFailure(new Exception("failed"), 201);
- assertEquals("201::0x0025::failed", failed.getMessage());
+ assertEquals("201::0x3001::failed", failed.getMessage());
}
@Test
public void onapCommandHttpFailureTest2() {
OnapCommandHttpFailure failed = new OnapCommandHttpFailure("Failed", 203);
- assertEquals("203::0x0025::Failed", failed.getMessage());
+ assertEquals("203::0x3001::Failed", failed.getMessage());
}
@Test
public void onapCommandInvalidParameterTypeTest() {
OnapCommandInvalidParameterType failed = new OnapCommandInvalidParameterType("Failed");
- assertEquals("0x0003::Parameter type Failed is invalid", failed.getMessage());
+ assertEquals("0x7001::Parameter type Failed is invalid", failed.getMessage());
}
@Test
public void onapCommandInvalidPrintDirectionTest() {
OnapCommandInvalidPrintDirection failed = new OnapCommandInvalidPrintDirection("Direction");
- assertEquals("0x0004::Print direction Direction is invalid", failed.getMessage());
+ assertEquals("0x8003::Print direction Direction is invalid", failed.getMessage());
}
@Test
public void onapCommandInvalidRegistrationTest() {
OnapCommandInvalidRegistration failed = new OnapCommandInvalidRegistration(OnapCommandErrorTest.class);
- assertEquals("0x0005::Invalid commad class org.onap.cli.fw.error.OnapCommandErrorTest registration, "
+ assertEquals("0x2001::Invalid commad class org.onap.cli.fw.error.OnapCommandErrorTest registration, "
+ "it should be derived from org.onap.cli.fw.OnapCommand", failed.getMessage());
}
@@ -148,51 +148,51 @@ public class OnapCommandErrorTest {
public void onapCommandInvalidResultAttributeScopeTest() {
OnapCommandInvalidResultAttributeScope failed = new OnapCommandInvalidResultAttributeScope("Attribute");
- assertEquals("0x0006::Result atrribute Attribute is invalid", failed.getMessage());
+ assertEquals("0x8002::Result atrribute Attribute is invalid", failed.getMessage());
}
@Test
public void onapCommandInvalidSchemaTest() {
OnapCommandInvalidSchema failed = new OnapCommandInvalidSchema("Schema", "Failed");
- assertEquals("0x0007::Invalid command schema Schema, Failed", failed.getMessage());
+ assertEquals("0xb001::Invalid command schema Schema, Failed", failed.getMessage());
}
@Test
public void onapCommandInvalidSchemaVersionTest() {
OnapCommandInvalidSchemaVersion failed = new OnapCommandInvalidSchemaVersion("1.0");
- assertEquals("0x0008::Command schema open_cli_schema_version 1.0 is invalid or missing", failed.getMessage());
+ assertEquals("0xb003::Command schema open_cli_schema_version 1.0 is invalid or missing", failed.getMessage());
}
@Test
public void onapCommandLoginFailedTest1() {
OnapCommandLoginFailed failed = new OnapCommandLoginFailed(new Exception("Failed"));
- assertEquals("0x0009::Login failed, Failed", failed.getMessage());
+ assertEquals("0x4001::Login failed, Failed", failed.getMessage());
}
@Test
public void onapCommandLoginFailedTest2() {
OnapCommandLoginFailed failed = new OnapCommandLoginFailed("Failed", 201);
- assertEquals("201::0x0009::Login failed, Failed", failed.getMessage());
+ assertEquals("201::0x4001::Login failed, Failed", failed.getMessage());
}
@Test
public void onapCommandLogoutFailedTest() {
OnapCommandLogoutFailed failed = new OnapCommandLogoutFailed(new Exception("Failed"));
- assertEquals("0x0010::Logout failed, Failed", failed.getMessage());
+ assertEquals("0x4002::Logout failed, Failed", failed.getMessage());
failed = new OnapCommandLogoutFailed(200);
- assertEquals("200::0x0010::Logout failed", failed.getMessage());
+ assertEquals("200::0x4002::Logout failed", failed.getMessage());
}
@Test
public void onapCommandNotFoundTest() {
OnapCommandNotFound failed = new OnapCommandNotFound("Test", "1.0");
- assertEquals("0x0011::Command Test is not available for product version 1.0."
+ assertEquals("0x6003::Command Test is not available for product version 1.0."
+ " so please check command name or product version set in env variable CLI_PRODUCT_VERSION or"
+ " cli.product.version in onap.properties", failed.getMessage());
}
@@ -201,35 +201,35 @@ public class OnapCommandErrorTest {
public void onapCommandNotInitializedTest() {
OnapCommandNotInitialized failed = new OnapCommandNotInitialized("Test");
- assertEquals("0x0012::Command Test is not initialized", failed.getMessage());
+ assertEquals("0x6004::Command Test is not initialized", failed.getMessage());
}
@Test
public void onapCommandOutputPrintingFailedTest() {
OnapCommandOutputPrintingFailed failed = new OnapCommandOutputPrintingFailed(new Exception("error"));
- assertEquals("0x0014::Command is failed to print the result, error", failed.getMessage());
+ assertEquals("0x8006::Command is failed to print the result, error", failed.getMessage());
}
@Test
public void onapCommandParameterMissingTest() {
OnapCommandParameterMissing failed = new OnapCommandParameterMissing("paramName");
- assertEquals("0x0015::Parameter paramName is mandatory", failed.getMessage());
+ assertEquals("0x7003::Parameter paramName is mandatory", failed.getMessage());
}
@Test
public void onapCommandParameterNameConflictTest() {
OnapCommandParameterNameConflict failed = new OnapCommandParameterNameConflict("paramName");
- assertEquals("0x0016::Parameter name paramName is in conflict", failed.getMessage());
+ assertEquals("0x7004::Parameter name paramName is in conflict", failed.getMessage());
}
@Test
public void onapCommandParameterOptionConflictTest() {
OnapCommandParameterOptionConflict failed = new OnapCommandParameterOptionConflict("option");
- assertEquals("0x0017::Parameter option option is in conflict, only one option is allowed with given name",
+ assertEquals("0x7006::Parameter option option is in conflict, only one option is allowed with given name",
failed.getMessage());
}
@@ -237,7 +237,7 @@ public class OnapCommandErrorTest {
public void onapCommandRegistrationFailedTest() {
OnapCommandRegistrationFailed failed = new OnapCommandRegistrationFailed("Test", "error");
- assertEquals("0x0018::Failed to register the command Test, error", failed.getMessage());
+ assertEquals("0x2002::Failed to register the command Test, error", failed.getMessage());
}
@Test
@@ -245,28 +245,28 @@ public class OnapCommandErrorTest {
OnapCommandResultInitialzationFailed failed = new OnapCommandResultInitialzationFailed("Test",
new Exception("error"));
- assertEquals("0x0022::Failed to parse the result format of command Test, error", failed.getMessage());
+ assertEquals("0x8004::Failed to parse the result format of command Test, error", failed.getMessage());
}
@Test
public void onapCommandSchemaNotFoundTest() {
OnapCommandSchemaNotFound failed = new OnapCommandSchemaNotFound("Test");
- assertEquals("0x0019::Command schema is missing for command Test", failed.getMessage());
+ assertEquals("0xb002::Command schema is missing for command Test", failed.getMessage());
}
@Test
public void onapCommandServiceNotFoundTest() {
OnapCommandServiceNotFound failed = new OnapCommandServiceNotFound("Service");
- assertEquals("0x0020::Service Service is not found in MSB", failed.getMessage());
+ assertEquals("0xd001::Service Service is not found in MSB", failed.getMessage());
}
@Test
public void onapCommandOutputFormatNotsupportedTest() {
OnapCommandOutputFormatNotsupported failed = new OnapCommandOutputFormatNotsupported("Format");
- assertEquals("0x0013::Command does not support the output format Format", failed.getMessage());
+ assertEquals("0x8005::Command does not support the output format Format", failed.getMessage());
}
@@ -274,11 +274,11 @@ public class OnapCommandErrorTest {
public void onapProfilePersistTest() {
OnapCommandPersistProfileFailed failed = new OnapCommandPersistProfileFailed("error");
- assertEquals("0x1302::Failed to persist profile details, error", failed.getMessage());
+ assertEquals("0xc002::Failed to persist profile details, error", failed.getMessage());
failed = new OnapCommandPersistProfileFailed(new Exception("error"));
- assertEquals("0x1302::Failed to persist profile details, error", failed.getMessage());
+ assertEquals("0xc002::Failed to persist profile details, error", failed.getMessage());
}
@@ -286,10 +286,10 @@ public class OnapCommandErrorTest {
public void onapProfileLoadTest() {
OnapCommandLoadProfileFailed failed = new OnapCommandLoadProfileFailed("error");
- assertEquals("0x1301::Failed to load profile details, error", failed.getMessage());
+ assertEquals("0xc001::Failed to load profile details, error", failed.getMessage());
failed = new OnapCommandLoadProfileFailed(new Exception("error"));
- assertEquals("0x1301::Failed to load profile details, error", failed.getMessage());
+ assertEquals("0xc001::Failed to load profile details, error", failed.getMessage());
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java b/framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
index f623d9e2..46b73a43 100644
--- a/framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/http/OnapHttpConnectionTest.java
@@ -184,7 +184,7 @@ public class OnapHttpConnectionTest {
OnapHttpConnection con = new OnapHttpConnection(true, false);
con.get(inp);
} catch (OnapCommandHttpFailure e) {
- assertEquals("0x0025::IO Exception", e.getMessage());
+ assertEquals("0x3001::IO Exception", e.getMessage());
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java b/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
index 604411ed..e11bfed8 100644
--- a/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/input/OnapCommandParameterTest.java
@@ -86,7 +86,7 @@ public class OnapCommandParameterTest {
try {
param.validate();
} catch (OnapCommandException e) {
- assertTrue("0x0015::Parameter null is mandatory".equals(e.getMessage()));
+ assertTrue("0x7003::Parameter null is mandatory".equals(e.getMessage()));
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java b/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
index 0c481405..877f08f5 100644
--- a/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/input/ParameterTypeTest.java
@@ -44,7 +44,7 @@ public class ParameterTypeTest {
try {
ParameterType.get("name");
} catch (OnapCommandInvalidParameterType e) {
- assertTrue("0x0003::Parameter type name is invalid".equals(e.getMessage()));
+ assertTrue("0x7001::Parameter type name is invalid".equals(e.getMessage()));
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java
index 6d2612f9..f2c22b21 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeTest.java
@@ -36,7 +36,7 @@ public class OnapCommandResultAttributeTest {
try {
OnapCommandResultAttributeScope.get("name");
} catch (OnapCommandInvalidResultAttributeScope e) {
- assertTrue("0x0006::Result atrribute name is invalid".equals(e.getMessage()));
+ assertTrue("0x8002::Result atrribute name is invalid".equals(e.getMessage()));
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java b/framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java
index 0aa82979..d1ad7950 100644
--- a/framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/output/PrintDirectionTest.java
@@ -36,7 +36,7 @@ public class PrintDirectionTest {
try {
PrintDirection.get("name");
} catch (OnapCommandInvalidPrintDirection e) {
- assertTrue("0x0004::Print direction name is invalid".equals(e.getMessage()));
+ assertTrue("0x8003::Print direction name is invalid".equals(e.getMessage()));
}
}
diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
index adc088a5..b4285e16 100644
--- a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
@@ -109,7 +109,7 @@ public class OnapCommandUtilsTest {
} catch (OnapCommandInvalidSchema e) {
fail("Test should not have thrown this exception : " + e.getMessage());
} catch (OnapCommandSchemaNotFound e) {
- assertEquals("0x0019::Command schema sample-test-schema1.yaml is not found", e.getMessage());
+ assertEquals("0xb002::Command schema sample-test-schema1.yaml is not found", e.getMessage());
}
}
@@ -121,7 +121,7 @@ public class OnapCommandUtilsTest {
} catch (OnapCommandInvalidSchemaVersion e) {
fail("Test should not have thrown this exception : " + e.getMessage());
} catch (OnapCommandInvalidSchema e) {
- assertTrue(e.getMessage().contains("0x0007::Command schema sample-test-invalid-schema.yaml is invalid"));
+ assertTrue(e.getMessage().contains("0xb001::Command schema sample-test-invalid-schema.yaml is invalid"));
} catch (OnapCommandSchemaNotFound e) {
fail("Test should not have thrown this exception : " + e.getMessage());
}
@@ -133,7 +133,7 @@ public class OnapCommandUtilsTest {
try {
map = OnapCommandUtils.validateSchemaVersion("sample-test-schema.yaml", "1.1");
} catch (OnapCommandInvalidSchemaVersion e) {
- assertEquals("0x0008::Command schema open_cli_schema_version 1.0 is invalid or missing", e.getMessage());
+ assertEquals("0xb003::Command schema open_cli_schema_version 1.0 is invalid or missing", e.getMessage());
} catch (OnapCommandInvalidSchema e) {
fail("Test should not have thrown this exception : " + e.getMessage());
} catch (OnapCommandSchemaNotFound e) {
@@ -198,7 +198,7 @@ public class OnapCommandUtilsTest {
try {
OnapCommandUtils.loadSchema(cmd, "sample-test-schema.yaml");
} catch (OnapCommandInvalidSchema e) {
- assertEquals("0x0007", e.getErrorCode());
+ assertEquals("0xb001", e.getErrorCode());
}
}
@@ -210,7 +210,7 @@ public class OnapCommandUtilsTest {
OnapCommandExecutor exe = cmd.getExecutor();
assertTrue(exe != null);
} catch (OnapCommandInvalidSchema e) {
- assertTrue(e.getMessage().contains("0x0007::Command schema sample-test-schema.yaml is invalid"));
+ assertTrue(e.getMessage().contains("0xb001::Command schema sample-test-schema.yaml is invalid"));
}
}
@@ -224,7 +224,7 @@ public class OnapCommandUtilsTest {
| OnapCommandInvalidParameterType | OnapCommandInvalidPrintDirection
| OnapCommandInvalidResultAttributeScope | OnapCommandSchemaNotFound | OnapCommandInvalidSchema
| OnapCommandInvalidSchemaVersion e) {
- assertTrue(e.getMessage().contains("0x0007::Command schema sample-test-schema.yaml is invalid"));
+ assertTrue(e.getMessage().contains("0xb001::Command schema sample-test-schema.yaml is invalid"));
}
}
@@ -343,7 +343,7 @@ public class OnapCommandUtilsTest {
try {
input2 = OnapCommandUtils.populateParameters(params, input);
} catch (OnapCommandParameterNotFound e) {
- assertEquals("0x0026::Command input parameter body is not valid", e.getMessage());
+ assertEquals("0x7005::Command input parameter body is not valid", e.getMessage());
}
}
@@ -371,7 +371,7 @@ public class OnapCommandUtilsTest {
input1 = OnapCommandUtils.populateOutputs(params, output);
} catch (OnapCommandHttpInvalidResponseBody e) {
assertEquals(
- "0x0028::Http response body does not have json entry {$.serviceName, Missing property in path $['{$']",
+ "0x3004::Http response body does not have json entry {$.serviceName, Missing property in path $['{$']",
e.getMessage());
}
output.setBody("{}");
diff --git a/main/src/main/java/org/onap/cli/main/error/OnapCliArgumentValueMissing.java b/main/src/main/java/org/onap/cli/main/error/OnapCliArgumentValueMissing.java
index f8f86e46..f1dd1ef7 100644
--- a/main/src/main/java/org/onap/cli/main/error/OnapCliArgumentValueMissing.java
+++ b/main/src/main/java/org/onap/cli/main/error/OnapCliArgumentValueMissing.java
@@ -27,6 +27,6 @@ public class OnapCliArgumentValueMissing extends OnapCommandException {
private static final long serialVersionUID = -6362824415803063442L;
public OnapCliArgumentValueMissing(String arg) {
- super("0x1001", "Value for argument " + arg + " is missing");
+ super("0x7001", "Value for argument " + arg + " is missing");
}
}
diff --git a/main/src/main/java/org/onap/cli/main/error/OnapCliInvalidArgument.java b/main/src/main/java/org/onap/cli/main/error/OnapCliInvalidArgument.java
index 32d8ef6f..e9f3adc5 100644
--- a/main/src/main/java/org/onap/cli/main/error/OnapCliInvalidArgument.java
+++ b/main/src/main/java/org/onap/cli/main/error/OnapCliInvalidArgument.java
@@ -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 = "0x1000";
+ private static final String ERROR_CODE = "0x7000";
private static final String ERROR_MESSAGE1 = "Invalid argument ";
public OnapCliInvalidArgument(String arg) {
diff --git a/main/src/test/java/org/onap/cli/main/error/OnapCliArgumentTest.java b/main/src/test/java/org/onap/cli/main/error/OnapCliArgumentTest.java
index 3916c630..fcb919b9 100644
--- a/main/src/test/java/org/onap/cli/main/error/OnapCliArgumentTest.java
+++ b/main/src/test/java/org/onap/cli/main/error/OnapCliArgumentTest.java
@@ -25,15 +25,15 @@ public class OnapCliArgumentTest {
@Test
public void onapCliArgumentValueMissingTest() {
OnapCliArgumentValueMissing failed = new OnapCliArgumentValueMissing("Argument value missing");
- assertEquals("0x1001::Value for argument Argument value missing is missing", failed.getMessage());
+ assertEquals("0x7001::Value for argument Argument value missing is missing", failed.getMessage());
}
@Test
public void onapCliInvalidArgumentTest() {
OnapCliInvalidArgument failed = new OnapCliInvalidArgument("Invalid Argument");
- assertEquals("0x1000::Invalid argument Invalid Argument", failed.getMessage());
+ assertEquals("0x7000::Invalid argument Invalid Argument", failed.getMessage());
failed = new OnapCliInvalidArgument("Invalid Argument", new Exception(""));
- assertEquals("0x1000::Invalid argument Invalid Argument , ", failed.getMessage());
+ assertEquals("0x7000::Invalid argument Invalid Argument , ", failed.getMessage());
}
}