summaryrefslogtreecommitdiffstats
path: root/cps-service/src
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-service/src
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-service/src')
-rw-r--r--cps-service/src/main/java/org/onap/cps/notification/CpsDataUpdatedEventFactory.java9
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/notification/CpsDataUpdateEventFactorySpec.groovy3
2 files changed, 6 insertions, 6 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/notification/CpsDataUpdatedEventFactory.java b/cps-service/src/main/java/org/onap/cps/notification/CpsDataUpdatedEventFactory.java
index e1473d3ff9..26b89fcd57 100644
--- a/cps-service/src/main/java/org/onap/cps/notification/CpsDataUpdatedEventFactory.java
+++ b/cps-service/src/main/java/org/onap/cps/notification/CpsDataUpdatedEventFactory.java
@@ -27,7 +27,6 @@ import org.onap.cps.api.CpsAdminService;
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;
@@ -38,6 +37,7 @@ import org.springframework.stereotype.Component;
@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 =
@@ -45,6 +45,7 @@ class CpsDataUpdatedEventFactory {
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
@@ -52,8 +53,8 @@ class CpsDataUpdatedEventFactory {
}
}
- 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;
@@ -71,7 +72,7 @@ class CpsDataUpdatedEventFactory {
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;
diff --git a/cps-service/src/test/groovy/org/onap/cps/notification/CpsDataUpdateEventFactorySpec.groovy b/cps-service/src/test/groovy/org/onap/cps/notification/CpsDataUpdateEventFactorySpec.groovy
index aecc3f7ee0..2ce77bd1a8 100644
--- a/cps-service/src/test/groovy/org/onap/cps/notification/CpsDataUpdateEventFactorySpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/notification/CpsDataUpdateEventFactorySpec.groovy
@@ -21,7 +21,6 @@ package org.onap.cps.notification
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
@@ -61,7 +60,7 @@ class CpsDataUpdateEventFactorySpec extends Specification {
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
}