summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java70
-rw-r--r--src/test/resources/ves4_invalid.json (renamed from src/test/resources/VES_invalid.txt)0
-rw-r--r--src/test/resources/ves4_valid.json (renamed from src/test/resources/VES_valid.txt)0
-rw-r--r--src/test/resources/ves7_batch_valid.json67
-rw-r--r--src/test/resources/ves7_invalid.json34
-rw-r--r--src/test/resources/ves7_valid.json34
6 files changed, 183 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))));
+ }
+}
diff --git a/src/test/resources/VES_invalid.txt b/src/test/resources/ves4_invalid.json
index 67d638ed..67d638ed 100644
--- a/src/test/resources/VES_invalid.txt
+++ b/src/test/resources/ves4_invalid.json
diff --git a/src/test/resources/VES_valid.txt b/src/test/resources/ves4_valid.json
index 907aaf38..907aaf38 100644
--- a/src/test/resources/VES_valid.txt
+++ b/src/test/resources/ves4_valid.json
diff --git a/src/test/resources/ves7_batch_valid.json b/src/test/resources/ves7_batch_valid.json
new file mode 100644
index 00000000..1db81eed
--- /dev/null
+++ b/src/test/resources/ves7_batch_valid.json
@@ -0,0 +1,67 @@
+
+{
+ "eventList": [
+ {
+ "commonEventHeader": {
+ "version": "4.0.1",
+ "vesEventListenerVersion": "7.0.1",
+ "domain": "fault",
+ "eventName": "Fault_Vscf:Acs-Ericcson_PilotNumberPoolExhaustion",
+ "eventId": "fault0000250",
+ "sequence": 1,
+ "priority": "High",
+ "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234",
+ "reportingEntityName": "ibcx0001vm002oam0011234",
+ "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014",
+ "sourceName": "scfx0001vm002cap001",
+ "nfVendorName": "Ericsson",
+ "nfNamingCode": "scfx",
+ "nfcNamingCode": "ssc",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "timeZoneOffset": "UTC-05:30"
+ },
+ "faultFields": {
+ "faultFieldsVersion": "4.0",
+ "alarmCondition": "PilotNumberPoolExhaustion",
+ "eventSourceType": "other",
+ "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
+ "eventSeverity": "CRITICAL",
+ "vfStatus": "Active",
+ "alarmAdditionalInformation": {
+ "PilotNumberPoolSize": "1000"
+ }
+ }
+ },
+ {
+ "commonEventHeader": {
+ "version": "4.0.1",
+ "vesEventListenerVersion": "7.0.1",
+ "domain": "fault",
+ "eventName": " Fault_Vscf:Acs-Ericcson_RecordingServerUnreachable",
+ "eventId": "fault0000251",
+ "sequence": 0,
+ "priority": "High",
+ "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234",
+ "reportingEntityName": "ibcx0001vm002oam0011234",
+ "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014",
+ "sourceName": "scfx0001vm002cap001",
+ "nfVendorName": "Ericsson",
+ "nfNamingCode": "scfx",
+ "nfcNamingCode": "ssc",
+ "startEpochMicrosec": 1413378172000010,
+ "lastEpochMicrosec": 1413378172000010,
+ "timeZoneOffset": "UTC-05:30"
+ },
+ "faultFields": {
+ "faultFieldsVersion": "4.0",
+ "alarmCondition": "RecordingServerUnreachable",
+ "eventSourceType": "other",
+ "specificProblem": "Recording server unreachable",
+ "eventSeverity": "CRITICAL",
+ "vfStatus": "Active"
+ }
+ }
+ ]
+}
+
diff --git a/src/test/resources/ves7_invalid.json b/src/test/resources/ves7_invalid.json
new file mode 100644
index 00000000..74c0a92f
--- /dev/null
+++ b/src/test/resources/ves7_invalid.json
@@ -0,0 +1,34 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "version": "4.0.1",
+ "vesEventListenerVersion": "30.0.1",
+ "domain": "fault",
+ "eventName": "Fault_Vscf:Acs-Ericcson_PilotNumberPoolExhaustion",
+ "eventId": "fault0000245",
+ "sequence": 1,
+ "priority": "High",
+ "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234",
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014",
+ "sourceName": "scfx0001vm002cap001",
+ "nfVendorName": "Ericsson",
+ "nfNamingCode": "scfx",
+ "nfcNamingCode": "ssc",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "timeZoneOffset": "UTC-05:30"
+ },
+ "faultFields": {
+ "faultFieldsVersion": "4.0",
+ "alarmCondition": "PilotNumberPoolExhaustion",
+ "eventSourceType": "other",
+ "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
+ "eventSeverity": "CRITICAL",
+ "vfStatus": "Active",
+ "alarmAdditionalInformation": {
+ "PilotNumberPoolSize": "1000"
+ }
+ }
+ }
+}
diff --git a/src/test/resources/ves7_valid.json b/src/test/resources/ves7_valid.json
new file mode 100644
index 00000000..19116b15
--- /dev/null
+++ b/src/test/resources/ves7_valid.json
@@ -0,0 +1,34 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "version": "4.0.1",
+ "vesEventListenerVersion": "7.0.1",
+ "domain": "fault",
+ "eventName": "Fault_Vscf:Acs-Ericcson_PilotNumberPoolExhaustion",
+ "eventId": "fault0000245",
+ "sequence": 1,
+ "priority": "High",
+ "reportingEntityId": "cc305d54-75b4-431b-adb2-eb6b9e541234",
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014",
+ "sourceName": "scfx0001vm002cap001",
+ "nfVendorName": "Ericsson",
+ "nfNamingCode": "scfx",
+ "nfcNamingCode": "ssc",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "timeZoneOffset": "UTC-05:30"
+ },
+ "faultFields": {
+ "faultFieldsVersion": "4.0",
+ "alarmCondition": "PilotNumberPoolExhaustion",
+ "eventSourceType": "other",
+ "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
+ "eventSeverity": "CRITICAL",
+ "vfStatus": "Active",
+ "alarmAdditionalInformation": {
+ "PilotNumberPoolSize": "1000"
+ }
+ }
+ }
+}