summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml20
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml7
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt7
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt25
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt4
5 files changed, 41 insertions, 22 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
index 6395963b..dcf42c20 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
@@ -15,16 +15,16 @@
~ 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">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>inbounds</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+ <artifactId>inbounds</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </parent>
- <artifactId>resource-api</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Resource API</name>
- <description>Blueprints Processor Resource API</description>
+ <artifactId>resource-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Blueprints Processor Resource API</name>
+ <description>Blueprints Processor Resource API</description>
</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
index c4aa08df..818adf9d 100644..100755
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
@@ -2,6 +2,8 @@
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
~
+ ~ Modifications Copyright © 2019 Bell Canada.
+ ~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
@@ -35,6 +37,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <version>${project.version}</version>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-testing</artifactId>
</dependency>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
index 2cd7a810..b80f9909 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
@@ -79,15 +79,16 @@ class BluePrintManagementGRPCHandler(private val bluePrintCoreConfiguration: Blu
}
private fun saveToDisk(request: BluePrintManagementInput, blueprintDir: File) {
- log.debug("request(${request.commonHeader.requestId}): Writing CBA File under :${blueprintDir.absolutePath}")
+ log.info("request(${request.commonHeader.requestId}): Writing CBA File under :${blueprintDir.absolutePath}")
if (blueprintDir.exists()) {
- log.debug("request(${request.commonHeader.requestId}): Re-creating blueprint directory(${blueprintDir.absolutePath})")
+ log.info("request(${request.commonHeader.requestId}): Re-creating blueprint directory(${blueprintDir.absolutePath})")
FileUtils.deleteDirectory(blueprintDir.parentFile)
}
FileUtils.forceMkdir(blueprintDir.parentFile)
blueprintDir.writeBytes(request.fileChunk.chunk.toByteArray()).apply {
- log.debug("request(${request.commonHeader.requestId}): CBA file(${blueprintDir.absolutePath} written successfully")
+ log.info("request(${request.commonHeader.requestId}): CBA file(${blueprintDir.absolutePath} written successfully")
}
+
}
private fun successStatus(message: String, header: CommonHeader): BluePrintManagementOutput =
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
index 668d3dbf..4da3b745 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
@@ -59,16 +59,21 @@ class BluePrintManagementGRPCHandlerTest {
grpcServerRule.serviceRegistry.addService(bluePrintManagementGRPCHandler)
}
- @AfterTest
+ //@AfterTest
fun cleanDir() {
+ //TODO It's giving fluctuating results, need to look for another way to cleanup
+ // works sometimes otherwise results IO Exception
+ // Most probably bufferReader stream is not getting closed when cleanDir is getting invoked
FileUtils.deleteDirectory(File("./target/blueprints"))
}
@Test
fun `test upload blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
- val id = "123"
- val output = blockingStub.uploadBlueprint(createInputRequest(id))
+ val id = "123_upload"
+ val req = createInputRequest(id)
+ val output = blockingStub.uploadBlueprint(req)
+
assertEquals(200, output.status.code)
assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
assertEquals(id, output.commonHeader.requestId)
@@ -77,10 +82,16 @@ class BluePrintManagementGRPCHandlerTest {
@Test
fun `test delete blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
- val id = "123"
+ val id = "123_delete"
val req = createInputRequest(id)
- blockingStub.uploadBlueprint(req)
- blockingStub.removeBlueprint(req)
+
+ var output = blockingStub.uploadBlueprint(req)
+ assertEquals(200, output.status.code)
+ assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
+ assertEquals(id, output.commonHeader.requestId)
+
+ output = blockingStub.removeBlueprint(req)
+ assertEquals(200, output.status.code)
}
private fun createInputRequest(id: String): BluePrintManagementInput {
@@ -104,4 +115,4 @@ class BluePrintManagementGRPCHandlerTest {
.setFileChunk(fileChunk)
.build()
}
-} \ No newline at end of file
+}
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 f2048c39..2e4ba275 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
@@ -142,8 +142,8 @@ class BluePrintMappingsTest {
val mapper = ObjectMapper()
- Assert.assertEquals(JsonFormat.printer().print(struct).replace(" ", ""),
- mapper.writerWithDefaultPrettyPrinter().writeValueAsString(struct2).replace(" ", ""))
+ Assert.assertEquals(JsonFormat.printer().print(struct).replace(" ", "").replace("\r",""),
+ mapper.writerWithDefaultPrettyPrinter().writeValueAsString(struct2).replace(" ", "").replace("\r",""))
}
fun createValues(): Map<String, Value> {