diff options
Diffstat (limited to 'framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java')
-rw-r--r-- | framework/src/test/java/org/onap/cli/fw/schema/ValidateSchemaTest.java | 39 |
1 files changed, 10 insertions, 29 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 a900fe6d..8153b6db 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,11 +21,9 @@ import static org.junit.Assert.assertTrue; import java.util.List; import org.junit.Test; -import org.onap.cli.fw.OnapCommand; -import org.onap.cli.fw.cmd.OnapHttpCommand; +import org.onap.cli.fw.cmd.OnapCommand; import org.onap.cli.fw.error.OnapCommandException; import org.onap.cli.fw.error.OnapCommandInvalidSchema; -import org.onap.cli.fw.utils.OnapCommandSchemaLoaderUtils; public class ValidateSchemaTest { @@ -36,7 +34,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoaderUtils.loadSchema(cmd, "fdsfds.yaml", true, true); + OnapCommandSchemaLoader.loadSchema(cmd, "fdsfds.yaml", true, true); } @Test(expected = OnapCommandInvalidSchema.class) @@ -45,7 +43,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoaderUtils.loadSchema(cmd, "fdsfds", true, true); + OnapCommandSchemaLoader.loadSchema(cmd, "fdsfds", true, true); } @Test(expected = OnapCommandInvalidSchema.class) @@ -54,7 +52,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoaderUtils.loadSchema(cmd, + OnapCommandSchemaLoader.loadSchema(cmd, ValidateSchemaTest.class.getClassLoader().getResource("open-cli.properties").getFile(), true, true); } @@ -65,7 +63,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoaderUtils.loadSchema(cmd, "schema-invalid-file-null.yaml", true, true); + OnapCommandSchemaLoader.loadSchema(cmd, "schema-invalid-file-null.yaml", true, true); } @Test @@ -74,7 +72,7 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoaderUtils.loadSchema(cmd, "schema-validate-pass.yaml", true, true); + OnapCommandSchemaLoader.loadSchema(cmd, "schema-validate-pass.yaml", true, true); } @@ -84,49 +82,32 @@ public class ValidateSchemaTest { @Override protected void run() throws OnapCommandException {} }; - OnapCommandSchemaLoaderUtils.loadSchema(cmd, "schema-invalid-file.yaml", true, true); + OnapCommandSchemaLoader.loadSchema(cmd, "schema-invalid-file.yaml", true, true); } @Test public void validateTest() throws OnapCommandException { - OnapCommand cmd1 = new OnapCommand() { - @Override - protected void run() throws OnapCommandException {} - }; - 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 = OnapCommandSchemaLoaderUtils.loadSchema(cmd2, "schema-validate-basic.yaml", true, true); + List<String> errorList2 = OnapCommandSchemaLoader.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 = OnapCommandSchemaLoaderUtils.loadSchema(cmd2, "schema-validate-invalidschematype.yaml", true, true); + List<String> errorList3 = OnapCommandSchemaLoader.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 = OnapCommandSchemaLoaderUtils.loadSchema(cmd2, "schema-validate-invalid.yaml", true, true); - - OnapHttpCommand oclipHttpCommand = new OnapHttpCommand(); - errorList4.addAll(OnapCommandSchemaLoaderUtils.loadHttpSchema(oclipHttpCommand, - "schema-validate-invalid.yaml", true, true)); - assertTrue(errorList4.size() > 0); OnapCommand cmd5 = new OnapCommand() { @Override protected void run() throws OnapCommandException {} }; - List<String> errorList5 = OnapCommandSchemaLoaderUtils.loadSchema(cmd5, "schema-validate-pass.yaml", true, true); + List<String> errorList5 = OnapCommandSchemaLoader.loadSchema(cmd5, "schema-validate-pass.yaml", true, true); assertTrue(errorList5.size() == 0); } |