diff options
author | Bruno Sakoto <bruno.sakoto@bell.ca> | 2021-08-20 18:59:25 -0400 |
---|---|---|
committer | Bruno Sakoto <bruno.sakoto@bell.ca> | 2021-08-25 06:37:49 -0400 |
commit | e36f8e376dbdb8cf10d40e67a89a712bca688601 (patch) | |
tree | 95f7a5a01e3f9f7f6ac4bf98e7bd52a637e128a7 /src/main/java/org | |
parent | 976fe54b0782023ab496904481dc0cc9f4eaf4d4 (diff) |
Prepare for next event schema version
Issue-ID: CPS-584, CPS-459
Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca>
Change-Id: I02ce027a4222fe3178d854628a52626c8184d987
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java b/src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java index 2e4b88e..5fce94e 100644 --- a/src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java +++ b/src/main/java/org/onap/cps/temporal/controller/event/listener/kafka/DataUpdatedEventListener.java @@ -40,6 +40,7 @@ import org.springframework.util.StringUtils; @Slf4j public class DataUpdatedEventListener { + private static final String EVENT_SCHEMA_URN_PREFIX = "urn:cps:org.onap.cps:data-updated-event-schema:v"; private static final URI EVENT_SOURCE; static { @@ -93,12 +94,13 @@ public class DataUpdatedEventListener { new InvalidEventEnvelopException("Validation failure", cpsDataUpdatedEvent); // Validate schema - if (cpsDataUpdatedEvent.getSchema() == null) { + if (cpsDataUpdatedEvent.getSchema() == null + || !cpsDataUpdatedEvent.getSchema().toString().startsWith(EVENT_SCHEMA_URN_PREFIX)) { invalidEventEnvelopException.addInvalidField( new InvalidEventEnvelopException.InvalidField( - MISSING, "schema", null, - CpsDataUpdatedEvent.Schema.URN_CPS_ORG_ONAP_CPS_DATA_UPDATED_EVENT_SCHEMA_1_1_0_SNAPSHOT - .value())); + UNEXPECTED, "schema", + cpsDataUpdatedEvent.getSchema() != null ? cpsDataUpdatedEvent.getSchema().toString() : null, + EVENT_SCHEMA_URN_PREFIX + "99")); } // Validate id if (!StringUtils.hasText(cpsDataUpdatedEvent.getId())) { |