aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds/designer-api/src
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 12:16:46 -0400
committerSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 13:49:05 -0400
commit1072867dfac0df993cbd3e44bcc11a5cac7465fd (patch)
tree4a821659cf3b50cf946cbb535d528be8508e9fff /ms/blueprintsprocessor/modules/inbounds/designer-api/src
parentd97021cd756d63402545fdc2e14ac7611c3da118 (diff)
Enabling Code Formatter
Code Formatter was turned off due to java 11 migation Issue-ID: CCSDK-2852 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds/designer-api/src')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt57
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt37
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt5
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt17
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt19
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt26
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt15
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt15
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt226
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt16
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt9
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt29
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt6
29 files changed, 326 insertions, 222 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
index 714cf3a46..54f8dbc9d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
@@ -71,6 +71,7 @@ open class BluePrintManagementGRPCHandler(
try {
/** Get the file byte array */
val byteArray = request.fileChunk.chunk.toByteArray()
+
/** Get the Upload Action */
val uploadAction = request.actionIdentifiers?.actionName.emptyTONull()
?: UploadAction.DRAFT.toString()
@@ -169,7 +170,7 @@ open class BluePrintManagementGRPCHandler(
override fun removeBlueprint(
request: BluePrintRemoveInput,
responseObserver:
- StreamObserver<BluePrintManagementOutput>
+ StreamObserver<BluePrintManagementOutput>
) {
runBlocking {
@@ -282,38 +283,38 @@ open class BluePrintManagementGRPCHandler(
private fun onError(header: CommonHeader, message: String, error: Exception): BluePrintManagementOutput {
val code = GrpcErrorCodes.code(ErrorCatalogCodes.GENERIC_FAILURE)
return BluePrintManagementOutput.newBuilder()
- .setCommonHeader(header)
- .setStatus(
- Status.newBuilder()
- .setTimestamp(currentTimestamp())
- .setMessage(BluePrintConstants.STATUS_FAILURE)
- .setEventType(EventType.EVENT_COMPONENT_FAILURE)
- .setErrorMessage("Error : $message \n Details: ${error.errorMessageOrDefault()}")
- .setCode(code)
- .build()
- )
- .build()
+ .setCommonHeader(header)
+ .setStatus(
+ Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_FAILURE)
+ .setEventType(EventType.EVENT_COMPONENT_FAILURE)
+ .setErrorMessage("Error : $message \n Details: ${error.errorMessageOrDefault()}")
+ .setCode(code)
+ .build()
+ )
+ .build()
}
private fun onErrorCatalog(header: CommonHeader, message: String, error: BluePrintProcessorException):
- BluePrintManagementOutput {
- val err = if (error.protocol == "") {
- error.grpc(ErrorCatalogCodes.GENERIC_FAILURE)
- } else {
- error.convertToGrpc()
- }
- val errorPayload = errorCatalogService.errorPayload(err.addErrorPayloadMessage(message))
- return BluePrintManagementOutput.newBuilder()
+ BluePrintManagementOutput {
+ val err = if (error.protocol == "") {
+ error.grpc(ErrorCatalogCodes.GENERIC_FAILURE)
+ } else {
+ error.convertToGrpc()
+ }
+ val errorPayload = errorCatalogService.errorPayload(err.addErrorPayloadMessage(message))
+ return BluePrintManagementOutput.newBuilder()
.setCommonHeader(header)
.setStatus(
- Status.newBuilder()
- .setTimestamp(currentTimestamp())
- .setMessage(BluePrintConstants.STATUS_FAILURE)
- .setEventType(EventType.EVENT_COMPONENT_FAILURE)
- .setErrorMessage("Error : ${errorPayload.message}")
- .setCode(errorPayload.code)
- .build()
+ Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_FAILURE)
+ .setEventType(EventType.EVENT_COMPONENT_FAILURE)
+ .setErrorMessage("Error : ${errorPayload.message}")
+ .setCode(errorPayload.code)
+ .build()
)
.build()
- }
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
index bb7a4b15c..0de298c62 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
@@ -92,8 +92,10 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption,
@RequestParam(defaultValue = "ASC") sortType: String
): Page<BlueprintModelSearch> {
- val pageRequest = PageRequest.of(offset, limit,
- Sort.Direction.fromString(sortType), sort.columnName)
+ val pageRequest = PageRequest.of(
+ offset, limit,
+ Sort.Direction.fromString(sortType), sort.columnName
+ )
return this.bluePrintModelHandler.allBlueprintModel(pageRequest)
}
@@ -115,8 +117,10 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption,
@RequestParam(defaultValue = "ASC") sortType: String
): Page<BlueprintModelSearch> {
- val pageRequest = PageRequest.of(offset, limit,
- Sort.Direction.fromString(sortType), sort.columnName)
+ val pageRequest = PageRequest.of(
+ offset, limit,
+ Sort.Direction.fromString(sortType), sort.columnName
+ )
return this.bluePrintModelHandler.searchBluePrintModelsByKeyWordPaged(keyWord, pageRequest)
}
@@ -172,8 +176,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
}
@PostMapping(
- "/enrich", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType
- .MULTIPART_FORM_DATA_VALUE]
+ "/enrich", produces = [MediaType.APPLICATION_JSON_VALUE],
+ consumes = [
+ MediaType
+ .MULTIPART_FORM_DATA_VALUE
+ ]
)
@ResponseBody
@Throws(BluePrintException::class)
@@ -183,8 +190,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
}
@PostMapping(
- "/enrichandpublish", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType
- .MULTIPART_FORM_DATA_VALUE]
+ "/enrichandpublish", produces = [MediaType.APPLICATION_JSON_VALUE],
+ consumes = [
+ MediaType
+ .MULTIPART_FORM_DATA_VALUE
+ ]
)
@ResponseBody
@Throws(BluePrintException::class)
@@ -226,7 +236,8 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
}
@PostMapping(
- path = arrayOf("/workflow-spec"), produces = arrayOf(
+ path = arrayOf("/workflow-spec"),
+ produces = arrayOf(
MediaType
.APPLICATION_JSON_VALUE
),
@@ -237,10 +248,10 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@PreAuthorize("hasRole('USER')")
suspend fun workflowSpec(@RequestBody workFlowSpecReq: WorkFlowSpecRequest):
ResponseEntity<String> = mdcWebCoroutineScope {
- var json = bluePrintModelHandler.prepareWorkFlowSpec(workFlowSpecReq)
- .asJsonString()
- ResponseEntity(json, HttpStatus.OK)
- }
+ var json = bluePrintModelHandler.prepareWorkFlowSpec(workFlowSpecReq)
+ .asJsonString()
+ ResponseEntity(json, HttpStatus.OK)
+ }
@GetMapping(
path = arrayOf(
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
index 1d61c7f0c..1d32b9493 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
@@ -26,18 +26,21 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
class BootstrapRequest {
+
var loadModelType: Boolean = false
var loadResourceDictionary: Boolean = false
var loadCBA: Boolean = false
}
class WorkFlowsResponse {
+
lateinit var blueprintName: String
var version: String = DEFAULT_VERSION_NUMBER
var workflows: MutableSet<String> = mutableSetOf()
}
class WorkFlowSpecRequest {
+
lateinit var blueprintName: String
var version: String = DEFAULT_VERSION_NUMBER
var returnContent: String = DATA_TYPE_JSON
@@ -46,6 +49,7 @@ class WorkFlowSpecRequest {
}
class WorkFlowSpecResponse {
+
lateinit var blueprintName: String
var version: String = DEFAULT_VERSION_NUMBER
lateinit var workFlowData: WorkFlowData
@@ -53,6 +57,7 @@ class WorkFlowSpecResponse {
}
class WorkFlowData {
+
lateinit var workFlowName: String
var inputs: MutableMap<String, PropertyDefinition>? = null
var outputs: MutableMap<String, PropertyDefinition>? = null
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt
index a083d7a8b..ffb383e6c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerBlueprintExceptionHandler.kt
@@ -28,4 +28,4 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
@RestControllerAdvice("org.onap.ccsdk.cds.blueprintsprocessor.designer.api")
open class DesignerBlueprintExceptionHandler(private val errorCatalogService: ErrorCatalogService) :
- ErrorCatalogExceptionHandler(errorCatalogService)
+ ErrorCatalogExceptionHandler(errorCatalogService)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt
index ae91246fe..ef1c3b103 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorHandling.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
object DesignerApiDomains {
+
// Designer Api Domains Constants
const val DESIGNER_API = "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"
const val DESIGNER_API_ENHANCER = "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer"
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
index 6e277e5c8..b00e5a0a6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
@@ -89,17 +89,18 @@ class ModelType : Serializable {
override fun toString(): String {
return "[" + "modelName = " + modelName +
- ", derivedFrom = " + derivedFrom +
- ", definitionType = " + definitionType +
- ", description = " + description +
- ", creationDate = " + creationDate +
- ", version = " + version +
- ", updatedBy = " + updatedBy +
- ", tags = " + tags +
- "]"
+ ", derivedFrom = " + derivedFrom +
+ ", definitionType = " + definitionType +
+ ", description = " + description +
+ ", creationDate = " + creationDate +
+ ", version = " + version +
+ ", updatedBy = " + updatedBy +
+ ", tags = " + tags +
+ "]"
}
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
index e91d9e136..eaa63ddee 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
@@ -88,18 +88,19 @@ class ResourceDictionary : Serializable {
override fun toString(): String {
return "[" + ", name = " + name +
- ", dataType = " + dataType +
- ", entrySchema = " + entrySchema +
- ", resourceDictionaryGroup = " + resourceDictionaryGroup +
- ", definition =" + definition +
- ", description = " + description +
- ", updatedBy = " + updatedBy +
- ", tags = " + tags +
- ", creationDate = " + creationDate +
- "]"
+ ", dataType = " + dataType +
+ ", entrySchema = " + entrySchema +
+ ", resourceDictionaryGroup = " + resourceDictionaryGroup +
+ ", definition =" + definition +
+ ", description = " + description +
+ ", updatedBy = " + updatedBy +
+ ", tags = " + tags +
+ ", creationDate = " + creationDate +
+ "]"
}
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
index f954df7ac..c63c7260d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
@@ -40,6 +40,7 @@ open class BluePrintArtifactDefinitionEnhancerImpl(
BluePrintArtifactDefinitionEnhancer {
companion object {
+
const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
}
@@ -79,7 +80,7 @@ open class BluePrintArtifactDefinitionEnhancerImpl(
if (!alreadyEnhanced) {
val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(artifactFilePath, ResourceAssignment::class.java)
- as? MutableList<ResourceAssignment>
+ as? MutableList<ResourceAssignment>
?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($artifactFilePath)")
// Call Resource Assignment Enhancer
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
index 1d534bb73..c163cc0d4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
@@ -20,12 +20,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiDomains
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.httpProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
@@ -83,15 +83,21 @@ open class BluePrintEnhancerServiceImpl(
}
} catch (e: BluePrintProcessorException) {
val errorMsg = "Error while enriching the CBA package."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong blueprint definitions or resource definitions.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong blueprint definitions or resource definitions."
+ )
} catch (e: IOException) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "IO Error: CBA file failed enrichment - ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "IO Error: CBA file failed enrichment - ${e.message}", e.errorCauseOrDefault()
+ )
} catch (e: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error in Enriching CBA: ${e.message}", e.errorCauseOrDefault())
- }
- return blueprintRuntimeService.bluePrintContext()
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error in Enriching CBA: ${e.message}", e.errorCauseOrDefault()
+ )
}
+ return blueprintRuntimeService.bluePrintContext()
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
index d28084e40..bb178b1e6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
@@ -101,7 +101,7 @@ open class BluePrintNodeTypeEnhancerImpl(
val relationShipTypeName = requirementDefinition.relationship
?: throw BluePrintException(
"couldn't get relationship name for the NodeType($nodeTypeName) " +
- "Requirement($requirementName)"
+ "Requirement($requirementName)"
)
enrichRelationShipType(relationShipTypeName)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
index 88127e3ca..dd60acac1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
@@ -48,6 +48,7 @@ open class BluePrintWorkflowEnhancerImpl(
private val log = logger(BluePrintWorkflowEnhancerImpl::class)
companion object {
+
const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
const val PROPERTY_DEPENDENCY_NODE_TEMPLATES = "dependency-node-templates"
}
@@ -109,7 +110,7 @@ open class BluePrintWorkflowEnhancerImpl(
else -> {
throw BluePrintProcessorException(
"couldn't execute workflow($name) step mapped " +
- "to node template($firstNodeTemplateName) derived from($derivedFrom)"
+ "to node template($firstNodeTemplateName) derived from($derivedFrom)"
)
}
}
@@ -139,11 +140,11 @@ open class BluePrintWorkflowEnhancerImpl(
val resourceAssignmentArtifacts = bluePrintContext.nodeTemplateByName(componentNodeTemplateName)
.artifacts?.filter {
- it.value.type == ARTIFACT_TYPE_MAPPING_SOURCE
- }?.map {
- log.info("resource assignment artifacts(${it.key}) for NodeType($componentNodeTemplateName)")
- it.value.file
- }
+ it.value.type == ARTIFACT_TYPE_MAPPING_SOURCE
+ }?.map {
+ log.info("resource assignment artifacts(${it.key}) for NodeType($componentNodeTemplateName)")
+ it.value.file
+ }
resourceAssignmentArtifacts
}?.flatten()
@@ -173,7 +174,7 @@ open class BluePrintWorkflowEnhancerImpl(
val resourceAssignmentProperties: MutableMap<String, PropertyDefinition> = hashMapOf()
val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java)
- as? MutableList<ResourceAssignment>
+ as? MutableList<ResourceAssignment>
?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
val alreadyEnhancedKey = "enhanced-$fileName"
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
index 94e183405..621b046e6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
@@ -105,9 +105,13 @@ open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionR
}
private fun checkResourceDefinitionNeeded(resourceAssignment: ResourceAssignment): Boolean {
- return !((resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT) ||
- resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT)) &&
- BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!))
+ return !(
+ (
+ resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT) ||
+ resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT)
+ ) &&
+ BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!)
+ )
}
private fun getResourceDefinition(name: String): ResourceDefinition {
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
index 042c76805..bbec8e685 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
@@ -48,6 +48,7 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
private val log = logger(ResourceDefinitionEnhancerService::class)
companion object {
+
const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
}
@@ -112,15 +113,15 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
// Read the Resource Definitions from the Database and write to type file.
private fun generateResourceDictionary(blueprintBasePath: String, resourceAssignments: List<ResourceAssignment>):
- List<ResourceDefinition> {
- val resourceKeys = resourceAssignments.mapNotNull { it.dictionaryName }.distinct().sorted()
- log.info("distinct resource keys ($resourceKeys)")
+ List<ResourceDefinition> {
+ val resourceKeys = resourceAssignments.mapNotNull { it.dictionaryName }.distinct().sorted()
+ log.info("distinct resource keys ($resourceKeys)")
- // TODO("Optimise DB single Query to multiple Query")
- return resourceKeys.map { resourceKey ->
- getResourceDefinition(resourceKey)
+ // TODO("Optimise DB single Query to multiple Query")
+ return resourceKeys.map { resourceKey ->
+ getResourceDefinition(resourceKey)
+ }
}
- }
private fun enrichResourceDefinitionSources(
bluePrintContext: BluePrintContext,
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
index 3140abfb3..7bbaa8c59 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
@@ -24,29 +24,29 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSe
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelContentRepository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelSearchRepository
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiDomains
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BootstrapRequest
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiDomains
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowData
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowSpecRequest
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowSpecResponse
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowData
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.WorkFlowsResponse
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.BluePrintDatabaseLoadService
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import org.onap.ccsdk.cds.controllerblueprints.core.httpProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
-import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
+import org.onap.ccsdk.cds.controllerblueprints.core.httpProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -92,8 +92,8 @@ open class BluePrintModelHandler(
open suspend fun bootstrapBlueprint(bootstrapRequest: BootstrapRequest) {
log.info(
"Bootstrap request with type load(${bootstrapRequest.loadModelType}), " +
- "resource dictionary load(${bootstrapRequest.loadResourceDictionary}) and " +
- "cba load(${bootstrapRequest.loadCBA})"
+ "resource dictionary load(${bootstrapRequest.loadResourceDictionary}) and " +
+ "cba load(${bootstrapRequest.loadCBA})"
)
if (bootstrapRequest.loadModelType) {
bluePrintDatabaseLoadService.initModelTypes()
@@ -108,38 +108,41 @@ open class BluePrintModelHandler(
@Throws(BluePrintException::class)
open suspend fun prepareWorkFlowSpec(req: WorkFlowSpecRequest):
- WorkFlowSpecResponse {
- val basePath = blueprintsProcessorCatalogService.getFromDatabase(req
- .blueprintName, req.version)
- log.info("blueprint base path $basePath")
-
- val blueprintContext = BluePrintMetadataUtils.getBluePrintContext(basePath.toString())
- val workFlow = blueprintContext.workflowByName(req.workflowName)
-
- val wfRes = WorkFlowSpecResponse()
- wfRes.blueprintName = req.blueprintName
- wfRes.version = req.version
-
- val workFlowData = WorkFlowData()
- workFlowData.workFlowName = req.workflowName
- workFlowData.inputs = workFlow.inputs
- workFlowData.outputs = workFlow.outputs
- wfRes.workFlowData = workFlowData
-
- if (workFlow.inputs != null) {
- for ((k, v) in workFlow.inputs!!) {
- addPropertyInfo(k, v, blueprintContext, wfRes)
+ WorkFlowSpecResponse {
+ val basePath = blueprintsProcessorCatalogService.getFromDatabase(
+ req
+ .blueprintName,
+ req.version
+ )
+ log.info("blueprint base path $basePath")
+
+ val blueprintContext = BluePrintMetadataUtils.getBluePrintContext(basePath.toString())
+ val workFlow = blueprintContext.workflowByName(req.workflowName)
+
+ val wfRes = WorkFlowSpecResponse()
+ wfRes.blueprintName = req.blueprintName
+ wfRes.version = req.version
+
+ val workFlowData = WorkFlowData()
+ workFlowData.workFlowName = req.workflowName
+ workFlowData.inputs = workFlow.inputs
+ workFlowData.outputs = workFlow.outputs
+ wfRes.workFlowData = workFlowData
+
+ if (workFlow.inputs != null) {
+ for ((k, v) in workFlow.inputs!!) {
+ addPropertyInfo(k, v, blueprintContext, wfRes)
+ }
}
- }
- if (workFlow.outputs != null) {
- for ((k, v) in workFlow.outputs!!) {
- addPropertyInfo(k, v, blueprintContext, wfRes)
+ if (workFlow.outputs != null) {
+ for ((k, v) in workFlow.outputs!!) {
+ addPropertyInfo(k, v, blueprintContext, wfRes)
+ }
}
- }
- return wfRes
- }
+ return wfRes
+ }
private fun addPropertyInfo(propName: String, prop: PropertyDefinition, ctx: BluePrintContext, res: WorkFlowSpecResponse) {
updatePropertyInfo(propName, prop, ctx, res)
@@ -172,6 +175,7 @@ open class BluePrintModelHandler(
}
}
}
+
private fun addDataType(name: String, ctx: BluePrintContext, res: WorkFlowSpecResponse) {
var data = ctx.dataTypeByName(name)
if (data != null) {
@@ -191,7 +195,8 @@ open class BluePrintModelHandler(
@Throws(BluePrintException::class)
open suspend fun getWorkflowNames(name: String, version: String): WorkFlowsResponse {
val basePath = blueprintsProcessorCatalogService.getFromDatabase(
- name, version)
+ name, version
+ )
log.info("blueprint base path $basePath")
var res = WorkFlowsResponse()
@@ -199,7 +204,8 @@ open class BluePrintModelHandler(
res.version = version
val blueprintContext = BluePrintMetadataUtils.getBluePrintContext(
- basePath.toString())
+ basePath.toString()
+ )
if (blueprintContext.workflows() != null) {
res.workflows = blueprintContext.workflows()!!.keys
}
@@ -210,7 +216,7 @@ open class BluePrintModelHandler(
* This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
*
* @return List<BlueprintModelSearch> list of the controller blueprint archives
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun allBlueprintModel(): List<BlueprintModelSearch> {
return blueprintModelSearchRepository.findAll()
}
@@ -219,7 +225,7 @@ open class BluePrintModelHandler(
* This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
*
* @return List<BlueprintModelSearch> list of the controller blueprint archives
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun allBlueprintModel(pageRequest: Pageable): Page<BlueprintModelSearch> {
return blueprintModelSearchRepository.findAll(pageRequest)
}
@@ -230,14 +236,16 @@ open class BluePrintModelHandler(
* @param filePart filePart
* @return Mono<BlueprintModelSearch>
* @throws BluePrintException BluePrintException
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
@Throws(BluePrintException::class)
open suspend fun saveBlueprintModel(filePart: FilePart): BlueprintModelSearch {
try {
return upload(filePart, false)
} catch (e: IOException) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error in Save CBA: ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error in Save CBA: ${e.message}", e.errorCauseOrDefault()
+ )
}
}
@@ -246,7 +254,7 @@ open class BluePrintModelHandler(
*
* @param tags tags
* @return List<BlueprintModelSearch>
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun searchBlueprintModels(tags: String): List<BlueprintModelSearch> {
return blueprintModelSearchRepository.findByTagsContainingIgnoreCase(tags)
}
@@ -262,10 +270,10 @@ open class BluePrintModelHandler(
@Throws(BluePrintException::class)
open fun getBlueprintModelSearchByNameAndVersion(name: String, version: String): BlueprintModelSearch? {
return blueprintModelSearchRepository.findByArtifactNameAndArtifactVersion(name, version)
- /*?: throw BluePrintException(
- ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)
- )*/
+ /*?: throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)
+ )*/
}
/**
@@ -275,7 +283,7 @@ open class BluePrintModelHandler(
* @param version version
* @return ResponseEntity<Resource>
* @throws BluePrintException BluePrintException
- </Resource> */
+ </Resource> */
@Throws(BluePrintException::class)
open fun downloadBlueprintModelFileByNameAndVersion(
name: String,
@@ -288,8 +296,10 @@ open class BluePrintModelHandler(
} catch (e: BluePrintProcessorException) {
e.http(ErrorCatalogCodes.RESOURCE_NOT_FOUND)
val errorMsg = "Error while downloading the CBA file by Blueprint Name ($name) and Version ($version)."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong resource definition or resolution failed.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong resource definition or resolution failed."
+ )
}
}
@@ -298,28 +308,32 @@ open class BluePrintModelHandler(
*
* @return ResponseEntity<Resource>
* @throws BluePrintException BluePrintException
- </Resource> */
+ </Resource> */
@Throws(BluePrintException::class)
open fun downloadBlueprintModelFile(id: String): ResponseEntity<Resource> {
val blueprintModel: BlueprintModel
try {
blueprintModel = getBlueprintModel(id)
} catch (e: BluePrintException) {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- "Error while downloading the CBA file: couldn't get blueprint modelby ID ($id)",
- e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ "Error while downloading the CBA file: couldn't get blueprint modelby ID ($id)",
+ e.errorCauseOrDefault()
+ )
}
val fileName = "${blueprintModel.artifactName}_${blueprintModel.artifactVersion}.zip"
val file = blueprintModel.blueprintModelContent?.content
- ?: throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- "Error while downloading the CBA file: couldn't get model content")
+ ?: throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ "Error while downloading the CBA file: couldn't get model content"
+ )
return prepareResourceEntity(fileName, file)
}
/**
* @return ResponseEntity<Resource>
- </Resource> */
+ </Resource> */
private fun prepareResourceEntity(fileName: String, file: ByteArray): ResponseEntity<Resource> {
return ResponseEntity.ok()
.contentType(MediaType.parseMediaType("text/plain"))
@@ -377,8 +391,10 @@ open class BluePrintModelHandler(
@Throws(BluePrintException::class)
open fun getBlueprintModelSearch(id: String): BlueprintModelSearch {
return blueprintModelSearchRepository.findById(id)
- ?: throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id))
+ ?: throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ )
}
/**
@@ -388,7 +404,7 @@ open class BluePrintModelHandler(
* @param keyWord
*
* @return List<BlueprintModelSearch> list of the controller blueprint
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun searchBluePrintModelsByKeyWord(keyWord: String): List<BlueprintModelSearch> {
return blueprintModelSearchRepository.findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
keyWord, keyWord, keyWord, keyWord, keyWord
@@ -402,7 +418,7 @@ open class BluePrintModelHandler(
* @param keyWord
*
* @return List<BlueprintModelSearch> list of the controller blueprint
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
open fun searchBluePrintModelsByKeyWordPaged(keyWord: String, pageRequest: PageRequest): Page<BlueprintModelSearch> {
return blueprintModelSearchRepository.findByUpdatedByContainingIgnoreCaseOrTagsContainingIgnoreCaseOrArtifactNameContainingIgnoreCaseOrArtifactVersionContainingIgnoreCaseOrArtifactTypeContainingIgnoreCase(
keyWord,
@@ -457,11 +473,15 @@ open class BluePrintModelHandler(
} catch (e: BluePrintProcessorException) {
e.http(ErrorCatalogCodes.IO_FILE_INTERRUPT)
val errorMsg = "Error while enhancing the CBA package."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong CBA file provided, please verify and enrich Again.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong CBA file provided, please verify and enrich Again."
+ )
} catch (e: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "EnrichBlueprint: ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "EnrichBlueprint: ${e.message}", e.errorCauseOrDefault()
+ )
}
}
@@ -480,11 +500,15 @@ open class BluePrintModelHandler(
} catch (e: BluePrintProcessorException) {
e.http(ErrorCatalogCodes.IO_FILE_INTERRUPT)
val errorMsg = "Error in Publishing CBA."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong CBA provided, please verify and enrich your CBA.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong CBA provided, please verify and enrich your CBA."
+ )
} catch (e: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error in Publishing CBA: ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error in Publishing CBA: ${e.message}", e.errorCauseOrDefault()
+ )
}
}
@@ -505,11 +529,15 @@ open class BluePrintModelHandler(
} catch (e: BluePrintProcessorException) {
e.http(ErrorCatalogCodes.IO_FILE_INTERRUPT)
val errorMsg = "Error while enhancing and uploading the CBA package."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong CBA file provided, please verify the source CBA.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong CBA file provided, please verify the source CBA."
+ )
} catch (e: Exception) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "EnrichBlueprint: ${e.message}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "EnrichBlueprint: ${e.message}", e.errorCauseOrDefault()
+ )
}
}
@@ -529,16 +557,22 @@ open class BluePrintModelHandler(
val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(saveId, compressedFile, validate)
return blueprintModelSearchRepository.findById(blueprintId)
- ?: throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId))
+ ?: throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId)
+ )
} catch (e: BluePrintException) {
e.http(ErrorCatalogCodes.IO_FILE_INTERRUPT)
val errorMsg = "Error in Upload CBA."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong enriched CBA.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong enriched CBA."
+ )
} catch (e: IOException) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error in Upload CBA: ${e.errorMessageOrDefault()}", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error in Upload CBA: ${e.errorMessageOrDefault()}", e.errorCauseOrDefault()
+ )
} finally {
// Clean blueprint script cache
val cacheKey = BluePrintFileUtils
@@ -555,13 +589,17 @@ open class BluePrintModelHandler(
try {
val blueprintModel = getBlueprintModelByNameAndVersion(name, version)
return blueprintModel.blueprintModelContent?.content
- ?: throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- "Error while downloading the CBA file: couldn't get model content")
+ ?: throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ "Error while downloading the CBA file: couldn't get model content"
+ )
} catch (e: BluePrintException) {
e.http(ErrorCatalogCodes.RESOURCE_NOT_FOUND)
val errorMsg = "Fail to get Blueprint Model content."
- throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg,
- "Wrong name and version was provide.")
+ throw e.updateErrorMessage(
+ DesignerApiDomains.DESIGNER_API, errorMsg,
+ "Wrong name and version was provide."
+ )
}
}
@@ -573,10 +611,12 @@ open class BluePrintModelHandler(
val blueprintWorkingDir = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, enhanceId)
try {
when (fileSource) {
- is FilePart -> BluePrintEnhancerUtils
- .copyFilePartToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
- is ByteArray -> BluePrintEnhancerUtils
- .copyByteArrayToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
+ is FilePart ->
+ BluePrintEnhancerUtils
+ .copyFilePartToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
+ is ByteArray ->
+ BluePrintEnhancerUtils
+ .copyByteArrayToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
} // Enhance the Blue Prints
bluePrintEnhancerService.enhance(blueprintWorkingDir)
@@ -586,8 +626,10 @@ open class BluePrintModelHandler(
val errorMsg = "Fail Enriching the CBA."
throw e.updateErrorMessage(DesignerApiDomains.DESIGNER_API, errorMsg)
} catch (e: IOException) {
- throw httpProcessorException(ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
- "Error while Enriching the CBA file.", e.errorCauseOrDefault())
+ throw httpProcessorException(
+ ErrorCatalogCodes.IO_FILE_INTERRUPT, DesignerApiDomains.DESIGNER_API,
+ "Error while Enriching the CBA file.", e.errorCauseOrDefault()
+ )
} finally {
BluePrintEnhancerUtils.cleanEnhancer(blueprintArchive, blueprintWorkingDir)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
index d11c128f0..0d94aab27 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
@@ -45,8 +45,10 @@ open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository
return if (modelType != null) {
modelType
} else {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- "couldn't get modelType($modelTypeName)")
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ "couldn't get modelType($modelTypeName)"
+ )
}
}
@@ -55,7 +57,7 @@ open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository
*
* @param tags tags
* @return List<ModelType>
- </ModelType> */
+ </ModelType> */
suspend fun searchModelTypes(tags: String): List<ModelType> {
check(tags.isNotBlank()) { "No Search Information provide" }
return modelTypeRepository.findByTagsContainingIgnoreCase(tags)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
index 20895efce..3f06a4a98 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
@@ -49,8 +49,10 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
return if (resourceDictionaryDb != null) {
resourceDictionaryDb
} else {
- throw httpProcessorException(ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
- String.format("couldn't get resource dictionary for name (%s)", name))
+ throw httpProcessorException(
+ ErrorCatalogCodes.RESOURCE_NOT_FOUND, DesignerApiDomains.DESIGNER_API,
+ String.format("couldn't get resource dictionary for name (%s)", name)
+ )
}
}
@@ -59,7 +61,7 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
*
* @param names names
* @return List<ResourceDictionary>
- </ResourceDictionary> */
+ </ResourceDictionary> */
suspend fun searchResourceDictionaryByNames(names: List<String>): List<ResourceDictionary> {
Preconditions.checkArgument(CollectionUtils.isNotEmpty(names), "No Search Information provide")
return resourceDictionaryRepository.findByNameIn(names)
@@ -70,7 +72,7 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
*
* @param tags tags
* @return List<ResourceDictionary>
- </ResourceDictionary> */
+ </ResourceDictionary> */
suspend fun searchResourceDictionaryByTags(tags: String): List<ResourceDictionary> {
Preconditions.checkArgument(StringUtils.isNotBlank(tags), "No search tag information provide")
return resourceDictionaryRepository.findByTagsContainingIgnoreCase(tags)
@@ -139,8 +141,10 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
resourceDictionary.resourceDictionaryGroup = resourceDefinition.group
resourceDictionary.entrySchema = resourceDefinition.property.entrySchema?.type
if (StringUtils.isBlank(resourceDefinition.tags)) {
- resourceDictionary.tags = (resourceDefinition.name + ", " + resourceDefinition.updatedBy +
- ", " + resourceDefinition.updatedBy)
+ resourceDictionary.tags = (
+ resourceDefinition.name + ", " + resourceDefinition.updatedBy +
+ ", " + resourceDefinition.updatedBy
+ )
} else {
resourceDictionary.tags = resourceDefinition.tags!!
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
index fea01992b..703542f60 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
@@ -35,7 +35,7 @@ interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, Strin
*
* @param name name
* @return Optional<ResourceMapping>
- </ResourceMapping> */
+ </ResourceMapping> */
fun findByName(name: String): ResourceDictionary?
/**
@@ -43,7 +43,7 @@ interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, Strin
*
* @param names names
* @return Optional<ResourceMapping>
- </ResourceMapping> */
+ </ResourceMapping> */
fun findByNameIn(names: List<String>): List<ResourceDictionary>
/**
@@ -51,7 +51,7 @@ interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, Strin
*
* @param tags tags
* @return Optional<ModelType>
- </ModelType> */
+ </ModelType> */
fun findByTagsContainingIgnoreCase(tags: String): List<ResourceDictionary>
/**
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt
index edf4c8cf6..db2e06eb5 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/ApplicationRegistrationService.kt
@@ -49,6 +49,7 @@ class ApplicationRegistrationService {
}
companion object {
+
private val log = LoggerFactory.getLogger(ApplicationRegistrationService::class.java)
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
index 4affd3b3f..6d72c2741 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
@@ -44,6 +44,7 @@ import java.nio.file.Paths
class BluePrintEnhancerUtils {
companion object {
+
val log = logger(BluePrintEnhancerUtils)
fun populateDataTypes(
@@ -164,10 +165,10 @@ class BluePrintEnhancerUtils {
outputFileName: String = "enhanced-cba.zip"
):
ResponseEntity<Resource> {
- val compressedFile = normalizedFile(archiveDir, outputFileName)
- BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
- return prepareResourceEntity(compressedFile)
- }
+ val compressedFile = normalizedFile(archiveDir, outputFileName)
+ BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
+ return prepareResourceEntity(compressedFile)
+ }
/** convert [file] to ResourceEntity */
suspend fun prepareResourceEntity(file: File): ResponseEntity<Resource> {
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
index 6b9ea28f0..08de136d8 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
@@ -30,6 +30,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
class ModelTypeValidator {
companion object {
+
/**
* This is a validateModelTypeDefinition
*
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
index 9489f2882..a42ac05e7 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
@@ -72,6 +72,7 @@ class BlueprintModelControllerTest {
private val log = logger(BlueprintModelControllerTest::class)
companion object {
+
private var bp: BlueprintModelSearch? = null
}
@@ -115,11 +116,14 @@ class BlueprintModelControllerTest {
fun test01_saveBluePrint() {
bp = runBlocking {
val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(testZipFile!!.readBytes()) {
- override fun getFilename(): String {
- return "test.zip"
+ part(
+ "file",
+ object : ByteArrayResource(testZipFile!!.readBytes()) {
+ override fun getFilename(): String {
+ return "test.zip"
+ }
}
- })
+ )
}.build()
val saveBP = webTestClient
@@ -184,11 +188,14 @@ class BlueprintModelControllerTest {
fun test07_publishBlueprintModel() {
bp = runBlocking {
val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(testZipFile!!.readBytes()) {
- override fun getFilename(): String {
- return "test.zip"
+ part(
+ "file",
+ object : ByteArrayResource(testZipFile!!.readBytes()) {
+ override fun getFilename(): String {
+ return "test.zip"
+ }
}
- })
+ )
}.build()
val publishBP = webTestClient
@@ -239,7 +246,8 @@ class BlueprintModelControllerTest {
webTestClient.delete().uri("/api/v1/blueprint-model/name/${bp!!.artifactName}/version/${bp!!.artifactVersion}")
.header(
- "Authorization", "Basic " + Base64Utils
+ "Authorization",
+ "Basic " + Base64Utils
.encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8))
)
.exchange()
@@ -259,7 +267,8 @@ class BlueprintModelControllerTest {
webTestClient.method(requestMethod).uri(uri)
.header(
- "Authorization", "Basic " + Base64Utils
+ "Authorization",
+ "Basic " + Base64Utils
.encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8))
)
.body(body)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
index 33a2bd778..5b4463d36 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
@@ -22,9 +22,11 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
+ basePackages = [
+ "org.onap.ccsdk.cds.controllerblueprints",
"org.onap.ccsdk.cds.blueprintsprocessor.designer.api",
- "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"]
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"
+ ]
)
@EnableAutoConfiguration
open class DesignerApiTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt
index d081dc5ab..9520f0e8c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ErrorCatalogTestConfiguration.kt
@@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan(
- basePackages = ["org.onap.ccsdk.cds.error.catalog"]
+ basePackages = ["org.onap.ccsdk.cds.error.catalog"]
)
@EnableAutoConfiguration
open class ErrorCatalogTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
index c5bcd467b..8226aaad0 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
@@ -62,8 +62,10 @@ class ModelTypeControllerTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
- BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = (
+ "test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ )
modelType.updatedBy = "xxxxxx@xxx.com"
modelType = modelTypeController.saveModelType(modelType)
log.info("Saved Mode {}", modelType.toString())
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
index be012bbc0..6808a2717 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
@@ -31,8 +31,10 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
- "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"],
+ basePackages = [
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
index c4a77e565..8ee2eb3a2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
@@ -63,8 +63,10 @@ class ModelTypeServiceTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
- BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = (
+ "test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ )
modelType.updatedBy = "xxxxxx@xxx.com"
modelType = modelTypeHandler!!.saveModel(modelType)
log.info("Saved Mode {}", modelType.toString())
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt
index db25b6c35..7b752266d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandlerTest.kt
@@ -39,10 +39,10 @@ class ResourceDictionaryHandlerTest {
@Test
fun testSaveResourceDictionary() {
val resourceDefinition: ResourceDefinition = JacksonUtils
- .readValueFromFile(
- "./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json",
- ResourceDefinition::class.java
- )!!
+ .readValueFromFile(
+ "./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json",
+ ResourceDefinition::class.java
+ )!!
val expectedResourceDictionary = ResourceDictionary()
expectedResourceDictionary.name = resourceDefinition.name
@@ -57,7 +57,7 @@ class ResourceDictionaryHandlerTest {
val mockReturnValue = ResourceDictionary()
mockReturnValue.definition = ResourceDefinition()
Mockito.`when`(mockRepository.save(any(ResourceDictionary::class.java)))
- .thenReturn(mockReturnValue)
+ .thenReturn(mockReturnValue)
runBlocking {
resourceDictionaryHandler.saveResourceDefinition(resourceDefinition)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
index 27949901c..a7d166f5e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
@@ -28,6 +28,7 @@ import java.io.File
import java.nio.file.Path
class MockFilePart(private val fileName: String) : FilePart {
+
val log = LoggerFactory.getLogger(MockFilePart::class.java)!!
override fun content(): Flux<DataBuffer> {
TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
index 4c05f6009..ca85ed22f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
@@ -65,8 +65,10 @@ class ModelTypeReactRepositoryTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
- BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = (
+ "test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ )
modelType.updatedBy = "xxxxxx@xxx.com"
val dbModelType = modelTypeReactRepository!!.save(modelType).block()