From 5deddeb4892243627ad342a41d4dcef0f7280a29 Mon Sep 17 00:00:00 2001 From: Vijay VK Date: Tue, 7 Aug 2018 00:44:41 +0100 Subject: 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 Issue-ID: DCAEGEN2-600 --- .../dcae/vestest/TestJsonSchemaValidation.java | 70 +++++++++++++++------- 1 file changed, 48 insertions(+), 22 deletions(-) (limited to 'src/test/java') 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)))); + } +} -- cgit 1.2.3-korg