From 7259212791972fc10e41210487ff0f780ab024a6 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Fri, 6 Oct 2017 23:26:20 +0530 Subject: Onap to Oclip text migration Issue-Id: CLI-66 Change-Id: I58e98952c61902e34585e9defabc36d1233a99a4 Signed-off-by: Kanagaraj Manickam k00365106 --- .../org/onap/cli/fw/OnapCommandRegistrarTest.java | 4 +- .../cli/fw/cmd/OnapSchemaRefreshCommandTest.java | 12 +-- .../onap/cli/fw/error/OnapCommandErrorTest.java | 85 ++++++++++------------ .../cli/fw/input/OnapCommandParameterTest.java | 6 +- .../OnapCommandResultAttributeScopeTest.java | 2 +- .../org/onap/cli/fw/schema/ValidateSchemaTest.java | 4 +- .../onap/cli/fw/utils/OnapCommandUtilsTest.java | 4 +- 7 files changed, 53 insertions(+), 64 deletions(-) (limited to 'framework/src/test/java') 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 03744345..8a69ae61 100644 --- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java +++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java @@ -75,7 +75,7 @@ public class OnapCommandRegistrarTest { } @Test - public void onapCommandNotFoundTest() throws OnapCommandException { + public void oclipCommandNotFoundTest() throws OnapCommandException { try { registerar = OnapCommandRegistrar.getRegistrar(); registerar.get("Test1"); @@ -88,7 +88,7 @@ public class OnapCommandRegistrarTest { } @Test - public void onapCommandRegistrationFailedTest() throws OnapCommandException { + public void oclipCommandRegistrationFailedTest() throws OnapCommandException { @OnapCommandSchema(schema = "sample-test-schema.yaml") class Test extends OnapCommand { diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java index b9345f77..7aedd42d 100644 --- a/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java +++ b/framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommandTest.java @@ -32,14 +32,14 @@ public class OnapSchemaRefreshCommandTest { cmd.initializeSchema("schema-refresh.yaml"); cmd.execute(); - List onapCommandResultAttribute = cmd.getResult() + List oclipCommandResultAttribute = cmd.getResult() .getRecords(); - String s1Number = onapCommandResultAttribute.get(0).getValues().get(0); - String cmdName = onapCommandResultAttribute.get(1).getValues().get(0); - String cmdVer = onapCommandResultAttribute.get(2).getValues().get(0); - String cmdFile = onapCommandResultAttribute.get(3).getValues().get(0); - String version = onapCommandResultAttribute.get(4).getValues().get(0); + String s1Number = oclipCommandResultAttribute.get(0).getValues().get(0); + String cmdName = oclipCommandResultAttribute.get(1).getValues().get(0); + String cmdVer = oclipCommandResultAttribute.get(2).getValues().get(0); + String cmdFile = oclipCommandResultAttribute.get(3).getValues().get(0); + String version = oclipCommandResultAttribute.get(4).getValues().get(0); assertTrue(s1Number.equalsIgnoreCase("1")); } 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 f23fb0b1..45560c4a 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 @@ -23,7 +23,7 @@ import org.junit.Test; public class OnapCommandErrorTest { @Test - public void onapCommandDiscoveryFailedTest() { + public void oclipCommandDiscoveryFailedTest() { OnapCommandDiscoveryFailed failed = new OnapCommandDiscoveryFailed("name"); assertEquals("0x1001::Failed auto discover schema files from name under class path, ", failed.getMessage()); failed = new OnapCommandDiscoveryFailed("directory", "name"); @@ -32,45 +32,45 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandInvalidParameterValueTest() { + public void oclipCommandInvalidParameterValueTest() { OnapCommandInvalidParameterValue failed = new OnapCommandInvalidParameterValue("name"); assertEquals("0x7002::Parameter name value is invalid, ", failed.getMessage()); } @Test - public void onapCommandResultMapProcessingFailedTest() { + public void oclipCommandResultMapProcessingFailedTest() { OnapCommandResultMapProcessingFailed failed = new OnapCommandResultMapProcessingFailed("name", new Exception("failed")); assertEquals("0x3002::Failed to parse the result format of command name, failed", failed.getMessage()); } @Test - public void onapCommandHttpHeaderNotFoundTest() { + public void oclipCommandHttpHeaderNotFoundTest() { OnapCommandHttpHeaderNotFound failed = new OnapCommandHttpHeaderNotFound("name"); assertEquals("0x3003::Http header name is not returned from the service", failed.getMessage()); } @Test - public void onapCommandClientInitialzationFailedTest() { + public void oclipCommandClientInitialzationFailedTest() { OnapCommandClientInitialzationFailed failed = new OnapCommandClientInitialzationFailed("Test", new Exception("Test Command Failed")); assertEquals("0x5001::API client for the command Test is failed, Test Command Failed", failed.getMessage()); } @Test - public void onapCommandExceptionTest1() { + public void oclipCommandExceptionTest1() { OnapCommandException failed = new OnapCommandException("1", "Test Command Failed"); assertEquals("1::Test Command Failed", failed.getMessage()); } @Test - public void onapCommandExceptionTest2() { + public void oclipCommandExceptionTest2() { OnapCommandException failed = new OnapCommandException("1", "Test Command Failed", 201); assertEquals("201::1::Test Command Failed", failed.getMessage()); } @Test - public void onapCommandExecutionFailedTest1() { + public void oclipCommandExecutionFailedTest1() { OnapCommandExecutionFailed failed = new OnapCommandExecutionFailed("Test", "Test Command Failed", 201); assertEquals("201::0x6001::Command Test failed to execute, Test Command Failed", failed.getMessage()); failed = new OnapCommandExecutionFailed("Test", new Exception("Test Command Failed"), 201); @@ -78,13 +78,13 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandExecutionFailedTest2() { + public void oclipCommandExecutionFailedTest2() { OnapCommandExecutionFailed failed = new OnapCommandExecutionFailed("Test Command Failed"); assertEquals("0x6001::Test Command Failed", failed.getMessage()); } @Test - public void onapCommandExecutionFailedTest3() { + public void oclipCommandExecutionFailedTest3() { OnapCommandExecutionFailed failed = new OnapCommandExecutionFailed("Test", "Test Command Failed"); assertEquals("0x6001::Command Test failed to execute, Test Command Failed", failed.getMessage()); @@ -93,21 +93,21 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandExecutorInfoMissingTest() { + public void oclipCommandExecutorInfoMissingTest() { OnapCommandExecutorInfoMissing failed = new OnapCommandExecutorInfoMissing("Test"); assertEquals("0x6002::Command Test excutor info is missing from schema", failed.getMessage()); } @Test - public void onapCommandHelpFailedTest() { + public void oclipCommandHelpFailedTest() { OnapCommandHelpFailed failed = new OnapCommandHelpFailed(new Exception("Failed")); assertEquals("0x9001::Command failed to print help message, Failed", failed.getMessage()); } @Test - public void onapCommandHttpFailureTest1() { + public void oclipCommandHttpFailureTest1() { OnapCommandHttpFailure failed = new OnapCommandHttpFailure("Failed"); assertEquals("0x3001::Failed", failed.getMessage()); @@ -116,28 +116,28 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandHttpFailureTest2() { + public void oclipCommandHttpFailureTest2() { OnapCommandHttpFailure failed = new OnapCommandHttpFailure("Failed", 203); assertEquals("203::0x3001::Failed", failed.getMessage()); } @Test - public void onapCommandInvalidParameterTypeTest() { + public void oclipCommandInvalidParameterTypeTest() { OnapCommandInvalidParameterType failed = new OnapCommandInvalidParameterType("Failed"); assertEquals("0x7001::Parameter type Failed is invalid", failed.getMessage()); } @Test - public void onapCommandInvalidPrintDirectionTest() { + public void oclipCommandInvalidPrintDirectionTest() { OnapCommandInvalidPrintDirection failed = new OnapCommandInvalidPrintDirection("Direction"); assertEquals("0x8003::Print direction Direction is invalid", failed.getMessage()); } @Test - public void onapCommandInvalidRegistrationTest() { + public void oclipCommandInvalidRegistrationTest() { OnapCommandInvalidRegistration failed = new OnapCommandInvalidRegistration(OnapCommandErrorTest.class); assertEquals("0x2001::Invalid commad class org.onap.cli.fw.error.OnapCommandErrorTest registration, " @@ -145,42 +145,42 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandInvalidResultAttributeScopeTest() { + public void oclipCommandInvalidResultAttributeScopeTest() { OnapCommandInvalidResultAttributeScope failed = new OnapCommandInvalidResultAttributeScope("Attribute"); assertEquals("0x8002::Result atrribute Attribute is invalid", failed.getMessage()); } @Test - public void onapCommandInvalidSchemaTest() { + public void oclipCommandInvalidSchemaTest() { OnapCommandInvalidSchema failed = new OnapCommandInvalidSchema("Schema", "Failed"); assertEquals("0xb001::Invalid command schema Schema, Failed", failed.getMessage()); } @Test - public void onapCommandInvalidSchemaVersionTest() { + public void oclipCommandInvalidSchemaVersionTest() { OnapCommandInvalidSchemaVersion failed = new OnapCommandInvalidSchemaVersion("1.0"); assertEquals("0xb003::Command schema open_cli_schema_version 1.0 is invalid or missing", failed.getMessage()); } @Test - public void onapCommandLoginFailedTest1() { + public void oclipCommandLoginFailedTest1() { OnapCommandLoginFailed failed = new OnapCommandLoginFailed(new Exception("Failed")); assertEquals("0x4001::Login failed, Failed", failed.getMessage()); } @Test - public void onapCommandLoginFailedTest2() { + public void oclipCommandLoginFailedTest2() { OnapCommandLoginFailed failed = new OnapCommandLoginFailed("Failed", 201); assertEquals("201::0x4001::Login failed, Failed", failed.getMessage()); } @Test - public void onapCommandLogoutFailedTest() { + public void oclipCommandLogoutFailedTest() { OnapCommandLogoutFailed failed = new OnapCommandLogoutFailed(new Exception("Failed")); assertEquals("0x4002::Logout failed, Failed", failed.getMessage()); @@ -189,42 +189,42 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandNotFoundTest() { + public void oclipCommandNotFoundTest() { OnapCommandNotFound failed = new OnapCommandNotFound("Test", "1.0"); assertEquals("0x6003::Command Test is not available for product version 1.0", failed.getMessage()); } @Test - public void onapCommandNotInitializedTest() { + public void oclipCommandNotInitializedTest() { OnapCommandNotInitialized failed = new OnapCommandNotInitialized("Test"); assertEquals("0x6004::Command Test is not initialized", failed.getMessage()); } @Test - public void onapCommandOutputPrintingFailedTest() { + public void oclipCommandOutputPrintingFailedTest() { OnapCommandOutputPrintingFailed failed = new OnapCommandOutputPrintingFailed(new Exception("error")); assertEquals("0x8006::Command is failed to print the result, error", failed.getMessage()); } @Test - public void onapCommandParameterMissingTest() { + public void oclipCommandParameterMissingTest() { OnapCommandParameterMissing failed = new OnapCommandParameterMissing("paramName"); assertEquals("0x7003::Parameter paramName is mandatory", failed.getMessage()); } @Test - public void onapCommandParameterNameConflictTest() { + public void oclipCommandParameterNameConflictTest() { OnapCommandParameterNameConflict failed = new OnapCommandParameterNameConflict("paramName"); assertEquals("0x7004::Parameter name paramName is in conflict", failed.getMessage()); } @Test - public void onapCommandParameterOptionConflictTest() { + public void oclipCommandParameterOptionConflictTest() { OnapCommandParameterOptionConflict failed = new OnapCommandParameterOptionConflict("option"); assertEquals("0x7006::Parameter option option is in conflict, only one option is allowed with given name", @@ -232,14 +232,14 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandRegistrationFailedTest() { + public void oclipCommandRegistrationFailedTest() { OnapCommandRegistrationFailed failed = new OnapCommandRegistrationFailed("Test", "error"); assertEquals("0x2002::Failed to register the command Test, error", failed.getMessage()); } @Test - public void onapCommandResultInitialzationFailedTest() { + public void oclipCommandResultInitialzationFailedTest() { OnapCommandResultInitialzationFailed failed = new OnapCommandResultInitialzationFailed("Test", new Exception("error")); @@ -247,32 +247,21 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandSchemaNotFoundTest() { + public void oclipCommandSchemaNotFoundTest() { OnapCommandSchemaNotFound failed = new OnapCommandSchemaNotFound("Test"); assertEquals("0xb002::Command schema is missing for command Test", failed.getMessage()); } @Test - public void onapCommandSampleInvalidTest() { - OnapCommandInvalidSample failed = new OnapCommandInvalidSample("Test", "error"); - - assertEquals("0xf001::Invalid command sample Test, error", failed.getMessage()); - - failed = new OnapCommandInvalidSample("Test", new Exception("error")); - - assertEquals("0xf001::Invalid command sample Test, error", failed.getMessage()); - } - - @Test - public void onapCommandServiceNotFoundTest() { + public void oclipCommandServiceNotFoundTest() { OnapCommandServiceNotFound failed = new OnapCommandServiceNotFound("Service"); assertEquals("0xd001::Service Service is not found in MSB", failed.getMessage()); } @Test - public void onapCommandOutputFormatNotsupportedTest() { + public void oclipCommandOutputFormatNotsupportedTest() { OnapCommandOutputFormatNotsupported failed = new OnapCommandOutputFormatNotsupported("Format"); assertEquals("0x8005::Command does not support the output format Format", failed.getMessage()); @@ -280,7 +269,7 @@ public class OnapCommandErrorTest { @Test - public void onapProfilePersistTest() { + public void oclipProfilePersistTest() { OnapCommandPersistProfileFailed failed = new OnapCommandPersistProfileFailed("error"); assertEquals("0xc002::Failed to persist profile details, error", failed.getMessage()); @@ -292,7 +281,7 @@ public class OnapCommandErrorTest { @Test - public void onapProfileLoadTest() { + public void oclipProfileLoadTest() { OnapCommandLoadProfileFailed failed = new OnapCommandLoadProfileFailed("error"); assertEquals("0xc001::Failed to load profile details, error", failed.getMessage()); @@ -303,7 +292,7 @@ public class OnapCommandErrorTest { } @Test - public void onapCommandTypeInvalidTest() { + public void oclipCommandTypeInvalidTest() { OnapCommandInvalidCommandType failed = new OnapCommandInvalidCommandType("test"); assertEquals("0x3003::Command type test is invalid", failed.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 6137b9dc..f2e9f0b3 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 @@ -91,7 +91,7 @@ public class OnapCommandParameterTest { } @Test(expected = OnapCommandInvalidParameterValue.class) - public void onapCommandInvalidParameterValueArrayExeceptionTest() throws OnapCommandInvalidParameterValue { + public void oclipCommandInvalidParameterValueArrayExeceptionTest() throws OnapCommandInvalidParameterValue { OnapCommandParameter param = new OnapCommandParameter(); param.setName("name"); param.setParameterType(ParameterType.ARRAY); @@ -101,7 +101,7 @@ public class OnapCommandParameterTest { } @Test(expected = OnapCommandInvalidParameterValue.class) - public void onapCommandInvalidParameterValueMapExeceptionTest() throws OnapCommandInvalidParameterValue { + public void oclipCommandInvalidParameterValueMapExeceptionTest() throws OnapCommandInvalidParameterValue { OnapCommandParameter param = new OnapCommandParameter(); param.setName("name"); param.setParameterType(ParameterType.MAP); @@ -110,7 +110,7 @@ public class OnapCommandParameterTest { } @Test(expected = OnapCommandInvalidParameterValue.class) - public void onapCommandInvalidParameterValueBinaryExeceptionTest() throws OnapCommandException { + public void oclipCommandInvalidParameterValueBinaryExeceptionTest() throws OnapCommandException { OnapCommandParameter param = new OnapCommandParameter(); param.setName("name"); param.setParameterType(ParameterType.BINARY); diff --git a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java index d74f83a3..76d139a0 100644 --- a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java +++ b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultAttributeScopeTest.java @@ -25,7 +25,7 @@ import java.util.Collections; public class OnapCommandResultAttributeScopeTest { @Test - public void onapCommandResultAttributeTest() { + public void oclipCommandResultAttributeTest() { OnapCommandResultAttribute att = new OnapCommandResultAttribute(); att.setDescription("description"); att.setName("name"); diff --git a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java index 62a61d86..654b20cd 100644 --- a/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java +++ b/framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java @@ -117,8 +117,8 @@ public class ValidateSchemaTest { }; List errorList4 = OnapCommandUtils.loadSchema(cmd2, "schema-validate-invalid.yaml", true, true); - OnapHttpCommand onapHttpCommand = new OnapHttpCommand(); - errorList4.addAll(OnapCommandUtils.loadHttpSchema(onapHttpCommand, + OnapHttpCommand oclipHttpCommand = new OnapHttpCommand(); + errorList4.addAll(OnapCommandUtils.loadHttpSchema(oclipHttpCommand, "schema-validate-invalid.yaml", true, true)); assertTrue(errorList4.size() > 0); 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 db94a555..43883ce6 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 @@ -69,12 +69,12 @@ import mockit.MockUp; public class OnapCommandUtilsTest { @Test(expected = OnapCommandInvalidSchema.class) - public void onapCommandUtilsInputStreamNullTest() throws OnapCommandException { + public void oclipCommandUtilsInputStreamNullTest() throws OnapCommandException { OnapCommandUtils.validateSchemaVersion("sample-test1-schema-http1.yaml", "1.0"); } @Test - public void onapCommandUtilsInputStreamNotNullTest() throws OnapCommandException { + public void oclipCommandUtilsInputStreamNotNullTest() throws OnapCommandException { Map map = OnapCommandUtils.validateSchemaVersion("sample-test1-schema-http.yaml", "1.0"); assertTrue(map != null); } -- cgit 1.2.3-korg