From ee02d9aafb9cf6ff3b045c542fc3a75851b27a93 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 4 Mar 2019 10:22:04 -0500 Subject: Define EventType contract for gRPC message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic8bde56d13f774120c8d64a56993ade71e7b4612 Issue-ID: CCSDK-1118 Signed-off-by: Alexis de Talhouët --- .../blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt | 5 +++-- .../blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt | 3 ++- .../selfservice/api/utils/BluePrintMappingTests.kt | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'ms/blueprintsprocessor/modules/inbounds/selfservice-api') diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt index c53f03935..5278c17ed 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt @@ -30,6 +30,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.saveCBAFile import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.toProto import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.BlueprintDGExecutionService +import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService @@ -112,11 +113,11 @@ class ExecutionServiceHandler(private val bluePrintCoreConfiguration: BluePrintC val status = Status() status.errorMessage = errorMessage if (failure) { - status.eventType = "EVENT-COMPONENT-FAILURE" + status.eventType = EventType.EVENT_COMPONENT_FAILURE.name status.code = 500 status.message = BluePrintConstants.STATUS_FAILURE } else { - status.eventType = "EVENT-COMPONENT-PROCESSING" + status.eventType = EventType.EVENT_COMPONENT_PROCESSING.name status.code = 200 status.message = BluePrintConstants.STATUS_PROCESSING } diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt index df17785c3..c344ca00a 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt @@ -21,6 +21,7 @@ import com.google.protobuf.Struct import com.google.protobuf.util.JsonFormat import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader +import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType import org.onap.ccsdk.apps.controllerblueprints.common.api.Flag import org.onap.ccsdk.apps.controllerblueprints.common.api.Status import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils @@ -101,7 +102,7 @@ fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status.toProto(): Stat status.errorMessage = this.errorMessage ?: "" status.message = this.message status.timestamp = this.timestamp.toString() - status.eventType = this.eventType + status.eventType = EventType.valueOf(this.eventType) return status.build() } diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt index 04a2c1e8e..770e4a9b3 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt @@ -6,6 +6,7 @@ import org.junit.runner.RunWith import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader +import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType import org.onap.ccsdk.apps.controllerblueprints.common.api.Flag import org.springframework.test.context.junit4.SpringRunner import java.text.SimpleDateFormat @@ -47,7 +48,7 @@ class BluePrintMappingsTest { val status = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status() status.code = 400 status.errorMessage = "Concurrent modification exception" - status.eventType = "Update" + status.eventType = EventType.EVENT_COMPONENT_PROCESSING.name status.message = "Error uploading data" status.timestamp = dateForTest return status @@ -60,7 +61,7 @@ class BluePrintMappingsTest { Assert.assertEquals(status.code, status2.code) Assert.assertEquals(status.errorMessage, status2.errorMessage) - Assert.assertEquals(status.eventType, status2.eventType) + Assert.assertEquals(status.eventType, status2.eventType.name) Assert.assertEquals(status.message, status2.message) Assert.assertEquals(status.timestamp.toString(), status2.timestamp) } -- cgit 1.2.3-korg