summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-09-09 16:44:39 -0400
committerBrinda Santh Muthuramalingam <brindasanth@in.ibm.com>2019-09-12 01:22:27 +0000
commit338cc251c24e9ae8a0d098098d94a9c2af2a1a07 (patch)
treeb36eb8d182370bd68bbb03751ef3cb9a61305cb0 /ms/blueprintsprocessor/modules/inbounds/designer-api/src/test
parenta80bb83c9f6fd4c648abfb273d5b2b28d82a38fa (diff)
Implement GRPC download cab.
Change-Id: I7c872b7e6e20590668c68b92ed221752a9413bd8 Issue-ID: CCSDK-1682 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds/designer-api/src/test')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt29
1 files changed, 28 insertions, 1 deletions
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 9f1bd9c7c..691cfd760 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
@@ -68,7 +68,7 @@ class BluePrintManagementGRPCHandlerTest {
}
@Test
- fun `test upload blueprint`() {
+ fun `test upload and download blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
val id = "123_upload"
val req = createUploadInputRequest(id, UploadAction.PUBLISH.toString())
@@ -78,6 +78,16 @@ class BluePrintManagementGRPCHandlerTest {
assertTrue(output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
"failed to get success status")
assertEquals(id, output.commonHeader.requestId)
+
+ val downloadId = "123_download"
+ val downloadReq = createDownloadInputRequest(downloadId, DownloadAction.SEARCH.toString())
+
+ val downloadOutput = blockingStub.downloadBlueprint(downloadReq)
+ assertEquals(200, downloadOutput.status.code)
+ assertTrue(downloadOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status")
+ assertNotNull(downloadOutput.fileChunk?.chunk, "failed to get cba file chunks")
+ assertEquals(downloadId, downloadOutput.commonHeader.requestId)
}
@Test
@@ -146,6 +156,23 @@ class BluePrintManagementGRPCHandlerTest {
.build()
}
+ private fun createDownloadInputRequest(id: String, action: String): BluePrintDownloadInput {
+ val commonHeader = CommonHeader
+ .newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(id)
+ .setSubRequestId("1234-56").build()
+
+ return BluePrintDownloadInput.newBuilder()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(ActionIdentifiers.newBuilder()
+ .setBlueprintName("baseconfiguration")
+ .setBlueprintVersion("1.0.0")
+ .setActionName(action).build())
+ .build()
+ }
+
private fun createRemoveInputRequest(id: String): BluePrintRemoveInput {
val commonHeader = CommonHeader
.newBuilder()