aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java
diff options
context:
space:
mode:
authorVijay VK <vv770d@att.com>2018-08-07 00:44:41 +0100
committerVENKATESH KUMAR <vv770d@att.com>2018-08-08 11:05:15 -0400
commit5deddeb4892243627ad342a41d4dcef0f7280a29 (patch)
tree02e43a15b100ec02bffb8ff6f3b822e8b013ca24 /src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java
parent7752c2d818e6d19e4d805c2fd6760b4a13d601bc (diff)
VES 7.0.1 updates
Initial commit to include the support for below - VES 7.1 API - updated spec and data-format - Response code update per new spec - springfox for swagger doc - New topic defaults Todo - Swagger instrumention to include necessary annotation - Event Transformation 7.x to 5.x - VES7.x response header - AAF cert integration Change-Id: I9bc2223fa362b35ae8a7105acd651fe524a403c5 Signed-off-by: VENKATESH KUMAR <vv770d@att.com> Issue-ID: DCAEGEN2-600
Diffstat (limited to 'src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java')
-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))));
+ }
+}