From b8afed63dea50e0833a820bd15bbeafc1a08412e Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Wed, 4 Sep 2019 11:14:39 -0400 Subject: Add draft and publish grpc upload options. Change-Id: Id1476f1cb449c4070a7ef53a918b62d26da26391 Issue-ID: CCSDK-1682 Signed-off-by: Brinda Santh --- .../api/BluePrintManagementGRPCHandlerTest.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test') diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt index e084c60cf..ea05e88c0 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt @@ -25,13 +25,11 @@ import org.junit.Test import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.messaginglib.MessagingControllerTest import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.messaginglib.ProducerConfiguration +import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput -import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk +import org.onap.ccsdk.cds.controllerblueprints.management.api.* import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.context.annotation.ComponentScan @@ -75,7 +73,7 @@ class BluePrintManagementGRPCHandlerTest { fun `test upload blueprint`() { val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel) val id = "123_upload" - val req = createUploadInputRequest(id) + val req = createUploadInputRequest(id, UploadAction.PUBLISH.toString()) val output = blockingStub.uploadBlueprint(req) assertEquals(200, output.status.code) @@ -87,7 +85,7 @@ class BluePrintManagementGRPCHandlerTest { fun `test delete blueprint`() { val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel) val id = "123_delete" - val req = createUploadInputRequest(id) + val req = createUploadInputRequest(id, UploadAction.DRAFT.toString()) var output = blockingStub.uploadBlueprint(req) assertEquals(200, output.status.code) @@ -99,7 +97,7 @@ class BluePrintManagementGRPCHandlerTest { assertEquals(200, output.status.code) } - private fun createUploadInputRequest(id: String): BluePrintUploadInput { + private fun createUploadInputRequest(id: String, action: String): BluePrintUploadInput { val file = normalizedFile("./src/test/resources/test-cba.zip") assertTrue(file.exists(), "couldnt get file ${file.absolutePath}") @@ -110,11 +108,18 @@ class BluePrintManagementGRPCHandlerTest { .setRequestId(id) .setSubRequestId("1234-56").build() + val actionIdentifier = ActionIdentifiers.newBuilder() + .setActionName(action) + .setBlueprintName("sample") + .setBlueprintVersion("1.0.0") + .build() + val fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(file.inputStream().readBytes())) .build() return BluePrintUploadInput.newBuilder() .setCommonHeader(commonHeader) + .setActionIdentifiers(actionIdentifier) .setFileChunk(fileChunk) .build() } -- cgit 1.2.3-korg