diff options
author | Alexis de Talhouët <adetalhouet89@gmail.com> | 2019-03-04 10:22:04 -0500 |
---|---|---|
committer | Alexis de Talhouët <adetalhouet89@gmail.com> | 2019-03-05 14:23:44 +0000 |
commit | 579b7657572250f82b8121a937a26ab526e26266 (patch) | |
tree | cfc20463c069f6070b49e05d2dd05eb62e6c1b8b /ms/blueprintsprocessor/modules | |
parent | 497a066dab597ff93fe05dbfbb586504ae8a5d41 (diff) |
Define EventType contract for gRPC message
Change-Id: Ic8bde56d13f774120c8d64a56993ade71e7b4612
Issue-ID: CCSDK-1118
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules')
5 files changed, 16 insertions, 7 deletions
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 c53f0393..5278c17e 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 df17785c..c344ca00 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 04a2c1e8..770e4a9b 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) } diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml index 283a8a66..df68b952 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml @@ -15,7 +15,8 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> @@ -57,6 +58,10 @@ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> <artifactId>resource-dict</artifactId> </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.components</groupId> + <artifactId>proto-definition</artifactId> + </dependency> <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt index 7086ebbc..a67e006a 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt @@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status
+import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
@@ -113,7 +114,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic // Populate Status
val status = Status()
- status.eventType = "EVENT-COMPONENT-EXECUTED"
+ status.eventType = EventType.EVENT_COMPONENT_EXECUTED.name
status.code = 200
status.message = BluePrintConstants.STATUS_SUCCESS
executionServiceOutput.status = status
|