Fix missing status event type workflow response. 53/98153/1
authorBrinda Santh <bs2796@att.com>
Thu, 7 Nov 2019 17:32:06 +0000 (12:32 -0500)
committerBrinda Santh <bs2796@att.com>
Thu, 7 Nov 2019 17:32:06 +0000 (12:32 -0500)
Issue-ID: CCSDK-1896
Signed-off-by: Brinda Santh <bs2796@att.com>
Change-Id: Iffb4c5e9d4e5788895bda6c7ee4197ee9e0bd60e

ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappings.kt [moved from ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt with 97% similarity]
ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingTests.kt [moved from ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt with 98% similarity]
ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt

index 15cabb2..052b81c 100644 (file)
     <description>Blueprints Processor GRPC Lib</description>
 
     <dependencies>
-        <dependency>
-            <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
-            <artifactId>blueprint-proto</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
             <artifactId>blueprint-core</artifactId>
index 0bc8844..a79e8d6 100644 (file)
     <description>Blueprints Processor Core</description>
 
     <dependencies>
+        <dependency>
+            <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+            <artifactId>blueprint-proto</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-webflux</artifactId>
index 5a6ba06..dae6eea 100644 (file)
@@ -22,6 +22,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore
 import com.fasterxml.jackson.databind.JsonNode
 import com.fasterxml.jackson.databind.node.ObjectNode
 import io.swagger.annotations.ApiModelProperty
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import java.util.*
 
 /**
@@ -36,9 +38,9 @@ open class ExecutionServiceInput {
     @get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
     lateinit var actionIdentifiers: ActionIdentifiers
     @get:ApiModelProperty(required = true,
-        value = "Contain the information to be passed as input to the action." +
-                "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
-                " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
+            value = "Contain the information to be passed as input to the action." +
+                    "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
+                    " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
     lateinit var payload: ObjectNode
     @get:ApiModelProperty(hidden = true)
     @get:JsonIgnore
@@ -53,9 +55,9 @@ open class ExecutionServiceOutput {
     @get:ApiModelProperty(required = true, value = "Status of the request.")
     lateinit var status: Status
     @get:ApiModelProperty(required = true,
-        value = "Contain the information to be passed as input to the action." +
-                "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
-                " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
+            value = "Contain the information to be passed as input to the action." +
+                    "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
+                    " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
     lateinit var payload: ObjectNode
     @get:ApiModelProperty(hidden = true)
     @get:JsonIgnore
@@ -73,8 +75,8 @@ open class ActionIdentifiers {
     @get:ApiModelProperty(required = true, value = "Name of the workflow to execute.")
     lateinit var actionName: String
     @get:ApiModelProperty(required = true,
-        value = "Async processing is only supported for gRPC client.",
-        allowableValues = "sync, async")
+            value = "Async processing is only supported for gRPC client.",
+            allowableValues = "sync, async")
     lateinit var mode: String
 }
 
@@ -103,16 +105,16 @@ open class Status {
     @get:ApiModelProperty(required = true, value = "HTTP status code equivalent.")
     var code: Int = 200
     @get:ApiModelProperty(required = true, value = "Type of the event being emitted by CDS.")
-    var eventType: String = ""
+    var eventType: String = EventType.EVENT_COMPONENT_EXECUTED.name
     @get:ApiModelProperty(required = true,
-        value = "Time when the execution ended.",
-        example = "2012-04-23T18:25:43.511Z")
+            value = "Time when the execution ended.",
+            example = "2012-04-23T18:25:43.511Z")
     @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
     var timestamp: Date = Date()
     @get:ApiModelProperty(required = false, value = "Error message when system failed")
     var errorMessage: String? = null
     @get:ApiModelProperty(required = true, value = "Message providing request status")
-    var message: String = "success"
+    var message: String = BluePrintConstants.STATUS_SUCCESS
 }
 
 open class StepData {
@@ -5,7 +5,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils
+package org.onap.ccsdk.cds.blueprintsprocessor.core.utils
 
 import com.fasterxml.jackson.databind.node.ObjectNode
 import com.google.common.base.Strings
index 1a9b5fc..9f45c0f 100755 (executable)
     <description>Blueprints Processor Selfservice API</description>
 
     <dependencies>
-
-        <dependency>
-            <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
-            <artifactId>blueprint-proto</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
             <artifactId>blueprint-core</artifactId>
index 636a554..b25acd1 100644 (file)
@@ -20,7 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
 import io.grpc.stub.StreamObserver
 import kotlinx.coroutines.runBlocking
 import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.toJava
+import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.toJava
 import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
 import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput
 import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput
index ade47cf..356f0f7 100644 (file)
@@ -22,7 +22,7 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.launch
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
-import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.toProto
+import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.toProto
 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractServiceFunction
 import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
index 6bee17f..d296ec6 100644 (file)
@@ -20,6 +20,7 @@ import kotlinx.coroutines.CompletableDeferred
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
 import org.onap.ccsdk.cds.controllerblueprints.core.*
 import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeLabel
 import org.onap.ccsdk.cds.controllerblueprints.core.data.Graph
@@ -93,6 +94,7 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
             } else {
                 message = BluePrintConstants.STATUS_SUCCESS
             }
+            eventType = EventType.EVENT_COMPONENT_EXECUTED.name
         }
         return ExecutionServiceOutput().apply {
             commonHeader = executionServiceInput.commonHeader
index becd228..b7fcae1 100644 (file)
@@ -26,6 +26,8 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu
 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor
 import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.mock.MockComponentFunction
 import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.mock.mockNodeTemplateComponentScriptExecutor
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
 import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
@@ -36,6 +38,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyS
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 import kotlin.test.Test
+import kotlin.test.assertEquals
 import kotlin.test.assertNotNull
 
 class ImperativeWorkflowExecutionServiceTest {
@@ -99,7 +102,10 @@ class ImperativeWorkflowExecutionServiceTest {
             val imperativeWorkflowExecutionService = ImperativeWorkflowExecutionService(bluePrintWorkFlowService)
             val output = imperativeWorkflowExecutionService
                     .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
-            assertNotNull(output)
+            assertNotNull(output, "failed to get imperative workflow output")
+            assertNotNull(output.status, "failed to get imperative workflow output status")
+            assertEquals(output.status.message, BluePrintConstants.STATUS_SUCCESS)
+            assertEquals(output.status.eventType, EventType.EVENT_COMPONENT_EXECUTED.name)
         }
     }
 }
\ No newline at end of file