summaryrefslogtreecommitdiffstats
path: root/hv-collector-core
diff options
context:
space:
mode:
Diffstat (limited to 'hv-collector-core')
-rw-r--r--hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt16
1 files changed, 2 insertions, 14 deletions
diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt
index 543d7dc6..8affa0b1 100644
--- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt
+++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt
@@ -19,29 +19,17 @@
*/
package org.onap.dcae.collectors.veshv.impl
+import org.onap.dcae.collectors.veshv.domain.headerRequiredFieldDescriptors
import org.onap.dcae.collectors.veshv.model.VesMessage
import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader
internal object MessageValidator {
- private val requiredFieldDescriptors = listOf(
- "version",
- "eventName",
- "domain",
- "eventId",
- "sourceName",
- "reportingEntityName",
- "priority",
- "startEpochMicrosec",
- "lastEpochMicrosec",
- "sequence")
- .map { fieldName -> CommonEventHeader.getDescriptor().findFieldByName(fieldName) }
-
fun isValid(message: VesMessage): Boolean {
return allMandatoryFieldsArePresent(message.header)
}
private fun allMandatoryFieldsArePresent(header: CommonEventHeader) =
- requiredFieldDescriptors
+ headerRequiredFieldDescriptors
.all { fieldDescriptor -> header.hasField(fieldDescriptor) }
}