diff options
author | Vijay VK <vv770d@att.com> | 2018-08-07 00:44:41 +0100 |
---|---|---|
committer | VENKATESH KUMAR <vv770d@att.com> | 2018-08-08 11:05:15 -0400 |
commit | 5deddeb4892243627ad342a41d4dcef0f7280a29 (patch) | |
tree | 02e43a15b100ec02bffb8ff6f3b822e8b013ca24 /src/test | |
parent | 7752c2d818e6d19e4d805c2fd6760b4a13d601bc (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')
-rw-r--r-- | src/test/java/org/onap/dcae/vestest/TestJsonSchemaValidation.java | 70 | ||||
-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.json | 67 | ||||
-rw-r--r-- | src/test/resources/ves7_invalid.json | 34 | ||||
-rw-r--r-- | src/test/resources/ves7_valid.json | 34 |
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" + } + } + } +} |