diff options
Diffstat (limited to 'framework/src/test/java/org/onap')
8 files changed, 55 insertions, 55 deletions
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("{}"); |