summaryrefslogtreecommitdiffstats
path: root/cps-events
diff options
context:
space:
mode:
authorBruno Sakoto <bruno.sakoto@bell.ca>2021-08-20 18:59:14 -0400
committerBruno Sakoto <bruno.sakoto@bell.ca>2021-08-24 12:17:42 -0400
commit8db6414556299a32343805942fc0233efd6dc6e6 (patch)
tree5745c93f0c2664d775f0822b9a944041f052a8df /cps-events
parent5aba6667d330835fa3661ffba0d88f88029da446 (diff)
Prepare for next event schema versionmr/584/123451/3
Issue-ID: CPS-584, CPS-459 Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca> Change-Id: Iaf605492783f8c06f40522a427ce63bd2d1b34d0
Diffstat (limited to 'cps-events')
-rw-r--r--cps-events/src/main/resources/schemas/cps-data-updated-event-schema.json11
-rw-r--r--cps-events/src/test/groovy/org/onap/cps/event/CpsDataUpdatedEventSpec.groovy11
-rw-r--r--cps-events/src/test/resources/bookstore-chapters.json6
3 files changed, 13 insertions, 15 deletions
diff --git a/cps-events/src/main/resources/schemas/cps-data-updated-event-schema.json b/cps-events/src/main/resources/schemas/cps-data-updated-event-schema.json
index de445ec722..c2fa5f2871 100644
--- a/cps-events/src/main/resources/schemas/cps-data-updated-event-schema.json
+++ b/cps-events/src/main/resources/schemas/cps-data-updated-event-schema.json
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
- "$id": "urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT",
+ "$id": "urn:cps:org.onap.cps:data-updated-event-schema:v1",
"$ref": "#/definitions/CpsDataUpdatedEvent",
@@ -12,10 +12,9 @@
"type": "object",
"properties": {
"schema": {
- "description": "The schema, including its version, that this event adheres to.",
+ "description": "The schema, including its version, that this event adheres to. Ex: 'urn:cps:org.onap.cps:data-updated-event-schema:v1'.",
"type": "string",
- "default": "urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT",
- "enum": ["urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT"]
+ "format": "uri"
},
"id": {
"description": "The unique id identifying the event for the specified source. Producer must ensure that source + id is unique for each distinct event.",
@@ -69,7 +68,7 @@
}
},
"required": [
- "timestamp",
+ "observedTimestamp",
"dataspaceName",
"schemaSetName",
"anchorName",
@@ -85,4 +84,4 @@
}
-} \ No newline at end of file
+}
diff --git a/cps-events/src/test/groovy/org/onap/cps/event/CpsDataUpdatedEventSpec.groovy b/cps-events/src/test/groovy/org/onap/cps/event/CpsDataUpdatedEventSpec.groovy
index f72eceed1c..545b183378 100644
--- a/cps-events/src/test/groovy/org/onap/cps/event/CpsDataUpdatedEventSpec.groovy
+++ b/cps-events/src/test/groovy/org/onap/cps/event/CpsDataUpdatedEventSpec.groovy
@@ -33,13 +33,13 @@ class CpsDataUpdatedEventSpec extends Specification {
def objectMapper = new ObjectMapper()
final DATASPACE_NAME = 'my-dataspace'
- final BOOKSTORE_SCHEMA_SET = 'bootstore-schemaset'
+ final BOOKSTORE_SCHEMA_SET = 'bookstore-schemaset'
final ANCHOR_NAME = 'chapters'
final EVENT_TIMESTAMP = '2020-12-01T00:00:00.000+0000'
final EVENT_ID = '77b8f114-4562-4069-8234-6d059ff742ac'
final EVENT_SOURCE = new URI('urn:cps:org.onap.cps')
final EVENT_TYPE = 'org.onap.cps.data-updated-event'
- final EVENT_SCHEMA = 'urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT'
+ final EVENT_SCHEMA = new URI('urn:cps:org.onap.cps:data-updated-event-schema:v1')
final DATA = [
'test:bookstore': [
@@ -67,7 +67,7 @@ class CpsDataUpdatedEventSpec extends Specification {
then: 'CpsDataUpdatedEvent POJO has the excepted values'
cpsDataUpdatedEvent.id == EVENT_ID
cpsDataUpdatedEvent.source == EVENT_SOURCE
- cpsDataUpdatedEvent.schema.value() == EVENT_SCHEMA
+ cpsDataUpdatedEvent.schema == EVENT_SCHEMA
cpsDataUpdatedEvent.type == EVENT_TYPE
def content = cpsDataUpdatedEvent.content
content.observedTimestamp == EVENT_TIMESTAMP
@@ -90,8 +90,7 @@ class CpsDataUpdatedEventSpec extends Specification {
and: 'CpsDataUpdatedEvent with the content'
def cpsDataUpdateEvent = new CpsDataUpdatedEvent()
cpsDataUpdateEvent
- .withSchema(
- CpsDataUpdatedEvent.Schema.fromValue(EVENT_SCHEMA))
+ .withSchema(EVENT_SCHEMA)
.withId(EVENT_ID)
.withSource(EVENT_SOURCE)
.withType(EVENT_TYPE)
@@ -111,4 +110,4 @@ class CpsDataUpdatedEventSpec extends Specification {
)
}
-} \ No newline at end of file
+}
diff --git a/cps-events/src/test/resources/bookstore-chapters.json b/cps-events/src/test/resources/bookstore-chapters.json
index de46b71841..753426a60a 100644
--- a/cps-events/src/test/resources/bookstore-chapters.json
+++ b/cps-events/src/test/resources/bookstore-chapters.json
@@ -1,12 +1,12 @@
{
- "schema": "urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT",
+ "schema": "urn:cps:org.onap.cps:data-updated-event-schema:v1",
"id": "77b8f114-4562-4069-8234-6d059ff742ac",
"source": "urn:cps:org.onap.cps",
"type": "org.onap.cps.data-updated-event",
"content": {
"observedTimestamp": "2020-12-01T00:00:00.000+0000",
"dataspaceName": "my-dataspace",
- "schemaSetName": "bootstore-schemaset",
+ "schemaSetName": "bookstore-schemaset",
"anchorName": "chapters",
"data": {
"test:bookstore":{
@@ -31,4 +31,4 @@
}
}
}
-} \ No newline at end of file
+}