diff options
Diffstat (limited to 'framework/src/test/java')
-rw-r--r-- | framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java | 26 | ||||
-rw-r--r-- | framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java | 40 |
2 files changed, 33 insertions, 33 deletions
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 87612e62..22c36c3d 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 @@ -21,7 +21,7 @@ import org.onap.cli.fw.OnapCommand; import org.onap.cli.fw.cmd.OnapHttpCommand; import org.onap.cli.fw.error.OnapCommandException; import org.onap.cli.fw.error.OnapCommandInvalidSchema; -import org.onap.cli.fw.utils.OnapCommandSchemaLoader; +import org.onap.cli.fw.utils.OnapCommandSchemaLoaderUtils; import java.util.List; @@ -36,7 +36,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoader.loadSchema(cmd, "fdsfds.yaml", true, true); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "fdsfds.yaml", true, true); } @Test(expected = OnapCommandInvalidSchema.class) @@ -45,7 +45,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoader.loadSchema(cmd, "fdsfds", true, true); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "fdsfds", true, true); } @Test(expected = OnapCommandInvalidSchema.class) @@ -54,7 +54,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoader.loadSchema(cmd, + OnapCommandSchemaLoaderUtils.loadSchema(cmd, ValidateSchemaTest.class.getClassLoader().getResource("open-cli.properties").getFile(), true, true); } @@ -65,7 +65,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoader.loadSchema(cmd, "schema-invalid-file-null.yaml", true, true); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "schema-invalid-file-null.yaml", true, true); } @Test @@ -74,7 +74,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoader.loadSchema(cmd, "schema-validate-pass.yaml", true, true); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "schema-validate-pass.yaml", true, true); } @@ -84,7 +84,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoader.loadSchema(cmd, "schema-invalid-file.yaml", true, true); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "schema-invalid-file.yaml", true, true); } @Test @@ -94,31 +94,31 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - List<String> errorList1 = OnapCommandSchemaLoader.loadSchema(cmd1, "schema-validate-http.yaml", true, true); + List<String> errorList1 = OnapCommandSchemaLoaderUtils.loadSchema(cmd1, "schema-validate-http.yaml", true, true); assertTrue(errorList1.size() > 0); OnapCommand cmd2 = new OnapCommand() { @Override protected void run() throws OnapCommandException {} }; - List<String> errorList2 = OnapCommandSchemaLoader.loadSchema(cmd2, "schema-validate-basic.yaml", true, true); + List<String> errorList2 = OnapCommandSchemaLoaderUtils.loadSchema(cmd2, "schema-validate-basic.yaml", true, true); assertTrue(errorList2.size() > 0); OnapCommand cmd3 = new OnapCommand() { @Override protected void run() throws OnapCommandException {} }; - List<String> errorList3 = OnapCommandSchemaLoader.loadSchema(cmd2, "schema-validate-invalidschematype.yaml", true, true); + List<String> errorList3 = OnapCommandSchemaLoaderUtils.loadSchema(cmd2, "schema-validate-invalidschematype.yaml", true, true); assertTrue(errorList3.size() > 0); OnapCommand cmd4 = new OnapCommand() { @Override protected void run() throws OnapCommandException {} }; - List<String> errorList4 = OnapCommandSchemaLoader.loadSchema(cmd2, "schema-validate-invalid.yaml", true, true); + List<String> errorList4 = OnapCommandSchemaLoaderUtils.loadSchema(cmd2, "schema-validate-invalid.yaml", true, true); OnapHttpCommand oclipHttpCommand = new OnapHttpCommand(); - errorList4.addAll(OnapCommandSchemaLoader.loadHttpSchema(oclipHttpCommand, + errorList4.addAll(OnapCommandSchemaLoaderUtils.loadHttpSchema(oclipHttpCommand, "schema-validate-invalid.yaml", true, true)); assertTrue(errorList4.size() > 0); @@ -126,7 +126,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - List<String> errorList5 = OnapCommandSchemaLoader.loadSchema(cmd5, "schema-validate-pass.yaml", true, true); + List<String> errorList5 = OnapCommandSchemaLoaderUtils.loadSchema(cmd5, "schema-validate-pass.yaml", true, true); assertTrue(errorList5.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 fd0373bd..8cac03bf 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 @@ -68,12 +68,12 @@ public class OnapCommandUtilsTest { @Test(expected = OnapCommandInvalidSchema.class) public void oclipCommandUtilsInputStreamNullTest() throws OnapCommandException { - OnapCommandSchemaLoader.validateSchemaVersion("sample-test1-schema-http1.yaml", "1.0"); + OnapCommandSchemaLoaderUtils.validateSchemaVersion("sample-test1-schema-http1.yaml", "1.0"); } @Test public void oclipCommandUtilsInputStreamNotNullTest() throws OnapCommandException { - Map<String, ?> map = OnapCommandSchemaLoader.validateSchemaVersion("sample-test1-schema-http.yaml", "1.0"); + Map<String, ?> map = OnapCommandSchemaLoaderUtils.validateSchemaVersion("sample-test1-schema-http.yaml", "1.0"); assertTrue(map != null); } @@ -91,7 +91,7 @@ public class OnapCommandUtilsTest { @Test public void schemaFileNotFoundTest() throws OnapCommandException { - Map<String, ?> map = OnapCommandSchemaLoader.validateSchemaVersion("sample-test-schema.yaml", "1.0"); + Map<String, ?> map = OnapCommandSchemaLoaderUtils.validateSchemaVersion("sample-test-schema.yaml", "1.0"); assertTrue(map.size() > 0); } @@ -100,7 +100,7 @@ public class OnapCommandUtilsTest { public void invalidSchemaFileTest() throws OnapCommandException { Map<String, ?> map = null; try { - map = OnapCommandSchemaLoader.validateSchemaVersion("sample-test-schema1.yaml", "1.0"); + map = OnapCommandSchemaLoaderUtils.validateSchemaVersion("sample-test-schema1.yaml", "1.0"); } catch (OnapCommandInvalidSchemaVersion e) { fail("Test should not have thrown this exception : " + e.getMessage()); } catch (OnapCommandInvalidSchema e) { @@ -114,7 +114,7 @@ public class OnapCommandUtilsTest { public void validateWrongSchemaVersionTest() throws OnapCommandException { Map<String, ?> map = null; try { - map = OnapCommandSchemaLoader.validateSchemaVersion("sample-test-invalid-schema.yaml", "1.0"); + map = OnapCommandSchemaLoaderUtils.validateSchemaVersion("sample-test-invalid-schema.yaml", "1.0"); } catch (OnapCommandInvalidSchemaVersion e) { fail("Test should not have thrown this exception : " + e.getMessage()); } catch (OnapCommandInvalidSchema e) { @@ -128,7 +128,7 @@ public class OnapCommandUtilsTest { public void validateSchemaVersionTest() throws OnapCommandException { Map<String, ?> map = null; try { - map = OnapCommandSchemaLoader.validateSchemaVersion("sample-test-schema.yaml", "1.1"); + map = OnapCommandSchemaLoaderUtils.validateSchemaVersion("sample-test-schema.yaml", "1.1"); } catch (OnapCommandInvalidSchemaVersion e) { assertEquals("0xb003::Command schema open_cli_schema_version 1.0 is invalid or missing", e.getMessage()); } catch (OnapCommandInvalidSchema e) { @@ -141,32 +141,32 @@ public class OnapCommandUtilsTest { @Test public void loadOnapCommandSchemaWithOutDefaultTest() throws OnapCommandException { OnapCommand cmd = new OnapCommandSample(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-schema.yaml", false, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-schema.yaml", false, false); assertTrue("sample-test".equals(cmd.getName()) && cmd.getParameters().size() == 9); } @Test(expected = OnapCommandParameterNameConflict.class) public void loadOnapCommandSchemaWithDuplicateNameTest() throws OnapCommandException { OnapCommand cmd = new OnapCommandSample(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-invalid-schema-duplicate-name.yaml", false, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-invalid-schema-duplicate-name.yaml", false, false); } @Test(expected = OnapCommandParameterOptionConflict.class) public void loadOnapCommandSchemaWithDuplicateShortOptionTest() throws OnapCommandException { OnapCommand cmd = new OnapCommandSample(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-invalid-schema-duplicate-shortoption.yaml", false, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-invalid-schema-duplicate-shortoption.yaml", false, false); } @Test(expected = OnapCommandParameterOptionConflict.class) public void loadOnapCommandSchemaWithDuplicateLongOptionTest() throws OnapCommandException { OnapCommand cmd = new OnapCommandSample(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-invalid-schema-duplicate-longoption.yaml", false, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-invalid-schema-duplicate-longoption.yaml", false, false); } @Test public void loadOnapCommandSchemaWithDefaultTest() throws OnapCommandException { OnapCommand cmd = new OnapCommandSample(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-schema.yaml", true, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-schema.yaml", true, false); assertTrue("sample-test".equals(cmd.getName()) && cmd.getParameters().size() > 9); for (OnapCommandParameter com : cmd.getParameters()) { @@ -180,7 +180,7 @@ public class OnapCommandUtilsTest { @Test public void loadOnapCommandSchemaAuthRequiredTest() throws OnapCommandException { OnapCommand cmd = new OnapCommandSample(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-schema-auth-required.yaml", true, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-schema-auth-required.yaml", true, false); assertTrue("sample-test".equals(cmd.getName())); Map<String, OnapCommandParameter> map = OnapCommandUtils.getInputMap(cmd.getParameters()); @@ -192,7 +192,7 @@ public class OnapCommandUtilsTest { OnapHttpCommand cmd = new OnapHttpCommandSample(); cmd.setName("sample-test-http"); try { - OnapCommandSchemaLoader.loadHttpSchema(cmd, "sample-test-schema.yaml", true, false); + OnapCommandSchemaLoaderUtils.loadHttpSchema(cmd, "sample-test-schema.yaml", true, false); } catch (OnapCommandParameterNameConflict | OnapCommandParameterOptionConflict | OnapCommandInvalidParameterType | OnapCommandInvalidPrintDirection | OnapCommandInvalidResultAttributeScope | OnapCommandSchemaNotFound | OnapCommandInvalidSchema @@ -206,7 +206,7 @@ public class OnapCommandUtilsTest { OnapHttpCommand cmd = new OnapHttpCommandSample(); cmd.setName("sample-create-http"); try { - OnapCommandSchemaLoader.loadHttpSchema(cmd, "sample-test-schema-http.yaml", true, true); + OnapCommandSchemaLoaderUtils.loadHttpSchema(cmd, "sample-test-schema-http.yaml", true, true); assertTrue(cmd.getSuccessStatusCodes().size() == 2); } catch (OnapCommandParameterNameConflict | OnapCommandParameterOptionConflict | OnapCommandInvalidParameterType | OnapCommandInvalidPrintDirection @@ -219,9 +219,9 @@ public class OnapCommandUtilsTest { @Test public void helpCommandTest() throws IOException, OnapCommandException { OnapCommand cmd = new OnapCommandSample(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-schema.yaml", true, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-schema.yaml", true, false); - String actualResult = OnapCommandUtils.help(cmd); + String actualResult = OnapCommandHelperUtils.help(cmd); String expectedHelp = FileUtil.loadResource("sample-cmd-test-help.txt"); @@ -230,7 +230,7 @@ public class OnapCommandUtilsTest { @Test public void findOnapCommandsTest() { - List<Class<OnapCommand>> cmds = OnapCommandUtils.discoverCommandPlugins(); + List<Class<OnapCommand>> cmds = OnapCommandDiscoveryUtils.discoverCommandPlugins(); assertTrue(cmds.size() == 7); } @@ -362,9 +362,9 @@ public class OnapCommandUtilsTest { mockPrintMethodException(); OnapCommand cmd = new OnapCommandSample(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-schema.yaml", true, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-schema.yaml", true, false); - OnapCommandUtils.help(cmd); + OnapCommandHelperUtils.help(cmd); } @@ -372,7 +372,7 @@ public class OnapCommandUtilsTest { @Test public void test() throws OnapCommandException { OnapCommandSampleInfo cmd = new OnapCommandSampleInfo(); - OnapCommandSchemaLoader.loadSchema(cmd, "sample-test-info.yaml", true, false); + OnapCommandSchemaLoaderUtils.loadSchema(cmd, "sample-test-info.yaml", true, false); OnapCommandInfo info = cmd.getInfo(); assert info != null; } |