aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java70
1 files changed, 48 insertions, 22 deletions
diff --git a/src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java b/src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java
index c39fb013..9146cdac 100644
--- a/src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java
+++ b/src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java
@@ -32,26 +32,52 @@ import org.onap.dcae.SchemaValidator;
public class TestJsonSchemaValidation {
- @Test
- public void shouldValidEventPassSchema_27_2() throws IOException {
- String result = SchemaValidator.validateAgainstSchema(
- readJSONFromFile("src/test/resources/VES_valid.txt").toString(),
- readJSONFromFile("etc/CommonEventFormat_27.2.json").toString());
- assertEquals(result, "true");
- }
-
-
- @Test
- public void shouldInvalidEventDoesNotPassSchema_27_2() throws IOException {
- String result = SchemaValidator.validateAgainstSchema(
- readJSONFromFile("src/test/resources/VES_invalid.txt").toString(),
- readJSONFromFile("etc/CommonEventFormat_27.2.json").toString());
- assertEquals(result, "false");
- }
-
-
- private static JsonObject readJSONFromFile(String path) throws IOException {
- return (JsonObject) new JsonParser().parse(new String(readAllBytes(Paths.get(path))));
- }
-}
+ @Test
+ public void shouldValidEventPassSchema_27_2() throws IOException {
+ String result =
+ SchemaValidator.validateAgainstSchema(
+ readJSONFromFile("src/test/resources/ves4_valid.json").toString(),
+ readJSONFromFile("etc/CommonEventFormat_27.2.json").toString());
+ assertEquals(result, "true");
+ }
+
+ @Test
+ public void shouldInvalidEventDoesNotPassSchema_27_2() throws IOException {
+ String result =
+ SchemaValidator.validateAgainstSchema(
+ readJSONFromFile("src/test/resources/ves4_invalid.json").toString(),
+ readJSONFromFile("etc/CommonEventFormat_27.2.json").toString());
+ assertEquals(result, "false");
+ }
+
+ @Test
+ public void shouldValidEventPassSchema_30_0_1() throws IOException {
+ String result =
+ SchemaValidator.validateAgainstSchema(
+ readJSONFromFile("src/test/resources/ves7_valid.json").toString(),
+ readJSONFromFile("etc/CommonEventFormat_30.0.1.json").toString());
+ assertEquals(result, "true");
+ }
+ @Test
+ public void shouldValidEventBatchPassSchema_30_0_1() throws IOException {
+ String result =
+ SchemaValidator.validateAgainstSchema(
+ readJSONFromFile("src/test/resources/ves7_batch_valid.json").toString(),
+ readJSONFromFile("etc/CommonEventFormat_30.0.1.json").toString());
+ assertEquals(result, "true");
+ }
+
+ @Test
+ public void shouldInvalidEventDoesNotPassSchema_30_0_1() throws IOException {
+ String result =
+ SchemaValidator.validateAgainstSchema(
+ readJSONFromFile("src/test/resources/ves7_invalid.json").toString(),
+ readJSONFromFile("etc/CommonEventFormat_30.0.1.json").toString());
+ assertEquals(result, "false");
+ }
+
+ private static JsonObject readJSONFromFile(String path) throws IOException {
+ return (JsonObject) new JsonParser().parse(new String(readAllBytes(Paths.get(path))));
+ }
+}