aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozsef Csongvai <jozsef.csongvai@bell.ca>2020-07-09 08:32:40 -0400
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2020-07-09 08:56:11 -0400
commitf71ba4e81f04a2a3c5e97d565d34c09f46885fe6 (patch)
tree1190a6aacbbd53e0210c32599bd2b85acd5516b4
parent4ad951ee4c3ed41ca58a240e8b9193416c304b20 (diff)
Set EventType for GRPC response in designer API
Issue-ID: CCSDK-2539 Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca> Change-Id: Iaaf64e4b6683c564c1022b609496fec55ad0df6d
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt5
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt5
2 files changed, 10 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
index 7600979f8..714cf3a46 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
@@ -24,6 +24,7 @@ import io.grpc.stub.StreamObserver
import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BluePrintModelHandler
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
@@ -246,6 +247,7 @@ open class BluePrintManagementGRPCHandler(
.setStatus(
Status.newBuilder()
.setTimestamp(currentTimestamp())
+ .setEventType(EventType.EVENT_COMPONENT_EXECUTED)
.setMessage(BluePrintConstants.STATUS_SUCCESS)
.setCode(200)
.build()
@@ -265,6 +267,7 @@ open class BluePrintManagementGRPCHandler(
Status.newBuilder()
.setTimestamp(currentTimestamp())
.setMessage(BluePrintConstants.STATUS_SUCCESS)
+ .setEventType(EventType.EVENT_COMPONENT_EXECUTED)
.setCode(200)
.build()
)
@@ -284,6 +287,7 @@ open class BluePrintManagementGRPCHandler(
Status.newBuilder()
.setTimestamp(currentTimestamp())
.setMessage(BluePrintConstants.STATUS_FAILURE)
+ .setEventType(EventType.EVENT_COMPONENT_FAILURE)
.setErrorMessage("Error : $message \n Details: ${error.errorMessageOrDefault()}")
.setCode(code)
.build()
@@ -305,6 +309,7 @@ open class BluePrintManagementGRPCHandler(
Status.newBuilder()
.setTimestamp(currentTimestamp())
.setMessage(BluePrintConstants.STATUS_FAILURE)
+ .setEventType(EventType.EVENT_COMPONENT_FAILURE)
.setErrorMessage("Error : ${errorPayload.message}")
.setCode(errorPayload.code)
.build()
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
index d6694de9e..a2f208367 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
@@ -29,6 +29,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TokenAuthGrpcClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.TokenAuthGrpcClientService
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.compress
import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
@@ -94,6 +95,7 @@ class BluePrintManagementGRPCHandlerTest {
bootstrapOutput.status.message!!.contentEquals(BluePrintConstants.STATUS_SUCCESS),
"failed to get success status"
)
+ assertEquals(EventType.EVENT_COMPONENT_EXECUTED, bootstrapOutput.status.eventType)
assertEquals(id, bootstrapOutput.commonHeader.requestId)
}
@@ -109,6 +111,7 @@ class BluePrintManagementGRPCHandlerTest {
output.status.message!!.contentEquals(BluePrintConstants.STATUS_SUCCESS),
"failed to get success status"
)
+ assertEquals(EventType.EVENT_COMPONENT_EXECUTED, output.status.eventType)
assertEquals(id, output.commonHeader.requestId)
val downloadId = "123_download"
@@ -120,6 +123,7 @@ class BluePrintManagementGRPCHandlerTest {
downloadOutput.status.message!!.contentEquals(BluePrintConstants.STATUS_SUCCESS),
"failed to get success status"
)
+ assertEquals(EventType.EVENT_COMPONENT_EXECUTED, downloadOutput.status.eventType)
assertNotNull(downloadOutput.fileChunk?.chunk, "failed to get cba file chunks")
assertEquals(downloadId, downloadOutput.commonHeader.requestId)
}
@@ -137,6 +141,7 @@ class BluePrintManagementGRPCHandlerTest {
"failed to get success status"
)
assertEquals(id, output.commonHeader.requestId)
+ assertEquals(EventType.EVENT_COMPONENT_EXECUTED, output.status.eventType)
val removeReq = createRemoveInputRequest(id)
output = blockingStub.removeBlueprint(removeReq)