notification:\r
data-updated:\r
enabled: false\r
- topic: ${CPS_CHANGE_EVENT_TOPIC:cps.cfg-state-events}\r
+ topic: ${CPS_CHANGE_EVENT_TOPIC:cps.data-updated-events}\r
filters:\r
enabled-dataspaces: ${DATASPACE_FILTER_PATTERNS:""}\r
\r
{
"$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",
"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.",
}
},
"required": [
- "timestamp",
+ "observedTimestamp",
"dataspaceName",
"schemaSetName",
"anchorName",
}
-}
\ No newline at end of file
+}
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': [
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
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)
)
}
-}
\ No newline at end of file
+}
{
- "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":{
}
}
}
-}
\ No newline at end of file
+}
import org.onap.cps.api.CpsDataService;
import org.onap.cps.event.model.Content;
import org.onap.cps.event.model.CpsDataUpdatedEvent;
-import org.onap.cps.event.model.CpsDataUpdatedEvent.Schema;
import org.onap.cps.event.model.Data;
import org.onap.cps.spi.FetchDescendantsOption;
import org.onap.cps.spi.model.Anchor;
@Component
class CpsDataUpdatedEventFactory {
+ private static final URI EVENT_SCHEMA;
private static final URI EVENT_SOURCE;
private static final String EVENT_TYPE = "org.onap.cps.data-updated-event";
private static final DateTimeFormatter dateTimeFormatter =
static {
try {
+ EVENT_SCHEMA = new URI("urn:cps:org.onap.cps:data-updated-event-schema:v1");
EVENT_SOURCE = new URI("urn:cps:org.onap.cps");
} catch (final URISyntaxException e) {
// As it is fixed string, I don't expect to see this error
}
}
- private CpsDataService cpsDataService;
- private CpsAdminService cpsAdminService;
+ private final CpsDataService cpsDataService;
+ private final CpsAdminService cpsAdminService;
public CpsDataUpdatedEventFactory(final CpsDataService cpsDataService, final CpsAdminService cpsAdminService) {
this.cpsDataService = cpsDataService;
final var cpsDataUpdatedEvent = new CpsDataUpdatedEvent();
cpsDataUpdatedEvent.withContent(createContent(anchor, dataNode));
cpsDataUpdatedEvent.withId(UUID.randomUUID().toString());
- cpsDataUpdatedEvent.withSchema(Schema.URN_CPS_ORG_ONAP_CPS_DATA_UPDATED_EVENT_SCHEMA_1_1_0_SNAPSHOT);
+ cpsDataUpdatedEvent.withSchema(EVENT_SCHEMA);
cpsDataUpdatedEvent.withSource(EVENT_SOURCE);
cpsDataUpdatedEvent.withType(EVENT_TYPE);
return cpsDataUpdatedEvent;
import org.onap.cps.api.CpsAdminService
import org.onap.cps.api.CpsDataService
-import org.onap.cps.event.model.CpsDataUpdatedEvent
import org.onap.cps.event.model.Data
import org.onap.cps.spi.FetchDescendantsOption
import org.onap.cps.spi.model.Anchor
with(cpsDataUpdatedEvent) {
type == 'org.onap.cps.data-updated-event'
source == new URI('urn:cps:org.onap.cps')
- schema == CpsDataUpdatedEvent.Schema.URN_CPS_ORG_ONAP_CPS_DATA_UPDATED_EVENT_SCHEMA_1_1_0_SNAPSHOT
+ schema == new URI('urn:cps:org.onap.cps:data-updated-event-schema:v1')
StringUtils.hasText(id)
content != null
}