aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-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.kt8
2 files changed, 7 insertions, 8 deletions
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 b80f9909..fb0bc567 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
@@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
import io.grpc.StatusException
import io.grpc.stub.StreamObserver
-import org.apache.commons.io.FileUtils
import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.currentTimestamp
import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
@@ -82,9 +81,11 @@ class BluePrintManagementGRPCHandler(private val bluePrintCoreConfiguration: Blu
log.info("request(${request.commonHeader.requestId}): Writing CBA File under :${blueprintDir.absolutePath}")
if (blueprintDir.exists()) {
log.info("request(${request.commonHeader.requestId}): Re-creating blueprint directory(${blueprintDir.absolutePath})")
- FileUtils.deleteDirectory(blueprintDir.parentFile)
+ //FileUtils.deleteDirectory(blueprintDir.parentFile)
+ blueprintDir.parentFile.deleteRecursively()
}
- FileUtils.forceMkdir(blueprintDir.parentFile)
+ blueprintDir.parentFile.mkdirs()
+ //FileUtils.forceMkdir(blueprintDir.parentFile)
blueprintDir.writeBytes(request.fileChunk.chunk.toByteArray()).apply {
log.info("request(${request.commonHeader.requestId}): CBA file(${blueprintDir.absolutePath} written successfully")
}
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 4da3b745..264e2aea 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
@@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
import com.google.protobuf.ByteString
import io.grpc.testing.GrpcServerRule
-import org.apache.commons.io.FileUtils
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -34,7 +33,6 @@ import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import java.io.File
-import java.nio.file.Paths
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
@@ -59,12 +57,12 @@ 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"))
+ File("./target/blueprints").deleteRecursively()
}
@Test
@@ -95,7 +93,7 @@ class BluePrintManagementGRPCHandlerTest {
}
private fun createInputRequest(id: String): BluePrintManagementInput {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
+ val file = File("./src/test/resources/test-cba.zip")
assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
val commonHeader = CommonHeader