summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt40
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt5
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt34
3 files changed, 40 insertions, 39 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
index 60016fb98..d48f0c7e4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
@@ -26,7 +26,8 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_ASYNC
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.determineHttpStatusCode
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
@@ -37,36 +38,37 @@ import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("/api/v1/execution-service")
@Api(value = "/api/v1/execution-service",
- description = "Interaction with CBA.")
+ description = "Interaction with CBA.")
open class ExecutionServiceController {
@Autowired
lateinit var executionServiceHandler: ExecutionServiceHandler
@RequestMapping(path = ["/health-check"],
- method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE])
+ method = [RequestMethod.GET],
+ produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
@ApiOperation(value = "Health Check", hidden = true)
fun executionServiceControllerHealthCheck(): JsonNode = runBlocking {
- JacksonUtils.getJsonNode("Success")
+ "Success".asJsonPrimitive()
}
@PostMapping(path = ["/upload"], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
@ResponseBody
@PreAuthorize("hasRole('USER')")
@ApiOperation(value = "Upload a CBA",
- notes = "Upload the CBA package. This will also run validation on the CBA.",
- produces = MediaType.APPLICATION_JSON_VALUE)
+ notes = "Upload the CBA package. This will also run validation on the CBA.",
+ produces = MediaType.APPLICATION_JSON_VALUE)
fun upload(@ApiParam(value = "The ZIP file containing the overall CBA package.", required = true)
@RequestPart("file") filePart: FilePart): JsonNode = runBlocking {
- JacksonUtils.getJsonNode(executionServiceHandler.upload(filePart))
+ val uploadId = executionServiceHandler.upload(filePart)
+ """{"upload-id" : "$uploadId"}""".asJsonType()
}
@DeleteMapping("/name/{name}/version/{version}")
@ApiOperation(value = "Delete a CBA",
- notes = "Delete the CBA package identified by its name and version.",
- produces = MediaType.APPLICATION_JSON_VALUE)
+ notes = "Delete the CBA package identified by its name and version.",
+ produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasRole('USER')")
fun deleteBlueprint(@ApiParam(value = "Name of the CBA.", required = true)
@PathVariable(value = "name") name: String,
@@ -77,18 +79,18 @@ open class ExecutionServiceController {
@RequestMapping(path = ["/process"], method = [RequestMethod.POST], produces = [MediaType.APPLICATION_JSON_VALUE])
@ApiOperation(value = "Execute a CBA workflow (action)",
- notes = "Execute the appropriate CBA's action based on the ExecutionServiceInput object passed as input.",
- produces = MediaType.APPLICATION_JSON_VALUE,
- response = ExecutionServiceOutput::class)
+ notes = "Execute the appropriate CBA's action based on the ExecutionServiceInput object passed as input.",
+ produces = MediaType.APPLICATION_JSON_VALUE,
+ response = ExecutionServiceOutput::class)
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun process(@ApiParam(value = "ExecutionServiceInput payload.", required = true)
@RequestBody executionServiceInput: ExecutionServiceInput): ResponseEntity<ExecutionServiceOutput> =
- runBlocking {
- if (executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC) {
- throw IllegalStateException("Can't process async request through the REST endpoint. Use gRPC for async processing.")
+ runBlocking {
+ if (executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC) {
+ throw IllegalStateException("Can't process async request through the REST endpoint. Use gRPC for async processing.")
+ }
+ val processResult = executionServiceHandler.doProcess(executionServiceInput)
+ ResponseEntity(processResult, determineHttpStatusCode(processResult.status.code))
}
- val processResult = executionServiceHandler.doProcess(executionServiceInput)
- ResponseEntity(processResult, determineHttpStatusCode(processResult.status.code))
- }
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
index de6d4d8e4..ce41cfa1f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
@@ -20,11 +20,8 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import kotlinx.coroutines.runBlocking
import org.junit.Test
-import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
@@ -58,7 +55,7 @@ class BluePrintTemplateServiceTest {
val template = JacksonUtils.getClassPathFileContent("templates/master.jinja")
val json = JacksonUtils.getClassPathFileContent("templates/base-config-data-jinja.json")
- var element: MutableMap<String, Any> = mutableMapOf()
+ val element: MutableMap<String, Any> = mutableMapOf()
element["additional_array"] = arrayListOf(hashMapOf("name" to "Element1", "location" to "Region0"),
hashMapOf("name" to "Element2", "location" to "Region1"))
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
index b4c29dec3..1f872c2da 100644
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
@@ -19,15 +19,12 @@ package org.onap.ccsdk.cds.controllerblueprints.service.enhancer
import kotlinx.coroutines.runBlocking
import org.junit.Assert
-import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.controllerblueprints.TestApplication
-import org.onap.ccsdk.cds.controllerblueprints.core.compress
import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.service.load.ModelTypeLoadService
import org.onap.ccsdk.cds.controllerblueprints.service.load.ResourceDictionaryLoadService
@@ -53,8 +50,11 @@ class BluePrintEnhancerServiceImplTest {
@Autowired
lateinit var bluePrintValidatorService: BluePrintValidatorService
- @Before
- fun init() {
+
+ @Test
+ @Throws(Exception::class)
+ fun testEnhancementAndValidation() {
+
runBlocking {
modelTypeLoadService.loadPathModelType("./../../../../components/model-catalog/definition-type/starter-type")
@@ -62,46 +62,48 @@ class BluePrintEnhancerServiceImplTest {
dictPaths.add("./../../../../components/model-catalog/resource-dictionary/starter-dictionary")
dictPaths.add("./../../../../components/model-catalog/resource-dictionary/test-dictionary")
resourceDictionaryLoadService.loadPathsResourceDictionary(dictPaths)
+
+ testBaseConfigEnhancementAndValidation()
+ testVFWEnhancementAndValidation()
+ testGoldenEnhancementAndValidation()
+ testCapabilityRestconfEnhancementAndValidation()
+ testRemoteScriptsEnhancementAndValidation()
+ testCapabilityCliEnhancementAndValidation()
}
}
- @Test
- @Throws(Exception::class)
- fun testEnhancementAndValidation() {
+ fun testBaseConfigEnhancementAndValidation() {
val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
testComponentInvokeEnhancementAndValidation(basePath, "base-enhance")
}
- @Test
- @Throws(Exception::class)
fun testVFWEnhancementAndValidation() {
val basePath = "./../../../../components/model-catalog/blueprint-model/service-blueprint/vFW"
testComponentInvokeEnhancementAndValidation(basePath, "vFW-enhance")
}
- @Test
- @Throws(Exception::class)
fun testGoldenEnhancementAndValidation() {
val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/golden"
testComponentInvokeEnhancementAndValidation(basePath, "golden-enhance")
}
- @Test
- @Throws(Exception::class)
fun testCapabilityRestconfEnhancementAndValidation() {
val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_restconf"
testComponentInvokeEnhancementAndValidation(basePath, "capability_restconf-enhance")
}
- @Test
- @Throws(Exception::class)
fun testRemoteScriptsEnhancementAndValidation() {
val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts"
testComponentInvokeEnhancementAndValidation(basePath, "remote_scripts-enhance")
}
+ fun testCapabilityCliEnhancementAndValidation() {
+ val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_cli"
+ testComponentInvokeEnhancementAndValidation(basePath, "capability_cli-enhance")
+ }
+
private fun testComponentInvokeEnhancementAndValidation(basePath: String, targetDirName: String) {
runBlocking {
val targetPath = normalizedPathName("target/blueprints/enrichment", targetDirName)