diff options
Diffstat (limited to 'hv-collector-core')
2 files changed, 9 insertions, 12 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 12e1c1e6..3f355e34 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 @@ -27,20 +27,18 @@ internal class MessageValidator { val requiredFieldDescriptors = listOf( "version", "eventName", - "domain", + // "domain", TODO to be restored back when GPB schema will include default value "eventId", "sourceName", "reportingEntityName", - "priority", + // "priority", TODO to be restored back when GPB schema will include default value "startEpochMicrosec", "lastEpochMicrosec", "sequence") .map { fieldName -> CommonEventHeader.getDescriptor().findFieldByName(fieldName)} fun isValid(message: VesMessage): Boolean { - val header = message.header - val ret = allMandatoryFieldsArePresent(header) && header.domain == CommonEventHeader.Domain.HVRANMEAS - return ret + return allMandatoryFieldsArePresent(message.header) } private fun allMandatoryFieldsArePresent(header: CommonEventHeader) = diff --git a/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt b/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt index 017187a4..4d1b879a 100644 --- a/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt +++ b/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt @@ -67,17 +67,16 @@ internal object MessageValidatorTest : Spek({ assertThat(cut.isValid(vesMessage)).describedAs("message validation result").isTrue() } - it("should reject message with domain other than HVRANMEAS") { - Domain.values() - .filter { it != Domain.HVRANMEAS && it != Domain.UNRECOGNIZED } - .forEach { domain -> + Domain.values() + .filter { it != Domain.UNRECOGNIZED } + .forEach {domain -> + it("should accept message with $domain domain"){ val header = newBuilder(commonHeader).setDomain(domain).build() val vesMessage = VesMessage(header, vesMessageBytes(header)) assertThat(cut.isValid(vesMessage)) - .describedAs("message with $domain domain") - .isFalse() + .isTrue() } - } + } } on("ves hv message bytes") { |