diff options
Diffstat (limited to 'ms/controllerblueprints/modules/service')
7 files changed, 28 insertions, 20 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt index de8ba93e3..4537dbb9d 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode import org.onap.ccsdk.cds.controllerblueprints.service.common.ErrorMessage +import org.slf4j.LoggerFactory import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.ExceptionHandler @@ -32,19 +33,25 @@ import org.springframework.web.bind.annotation.ExceptionHandler * @version 1.0 */ @RestControllerAdvice("org.onap.ccsdk.cds.controllerblueprints") -open class ControllerBlueprintExeptionHandler { +open class ControllerBlueprintExceptionHandler { + + companion object ControllerBlueprintExceptionHandler { + val LOG = LoggerFactory.getLogger(ControllerBlueprintExceptionHandler::class.java) + } @ExceptionHandler - fun ControllerBlueprintException(e: BluePrintException): ResponseEntity<ErrorMessage> { + fun ControllerBlueprintExceptionHandler(e: BluePrintException): ResponseEntity<ErrorMessage> { var errorCode = ErrorCode.valueOf(e.code) val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message") + LOG.error("Error: $errorCode ${e.message}") return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode)) } @ExceptionHandler - fun ControllerBlueprintException(e: Exception): ResponseEntity<ErrorMessage> { + fun ControllerBlueprintExceptionHandler(e: Exception): ResponseEntity<ErrorMessage> { var errorCode = ErrorCode.GENERIC_FAILURE val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message") + LOG.error("Error: $errorCode ${e.message}") return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode)) } -}
\ No newline at end of file +} diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt index a0f8ca9c5..97b9a813a 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt @@ -107,8 +107,9 @@ class BluePrintEnhancerUtils { return filePartFile.deCompress(deCompressFileName) } - suspend fun compressToFilePart(enhanceDir: String, archiveDir: String): ResponseEntity<Resource> { - val compressedFile = normalizedFile(archiveDir, "enhanced-cba.zip") + suspend fun compressToFilePart(enhanceDir: String, archiveDir: String, + outputFileName:String="enhanced-cba.zip"): ResponseEntity<Resource> { + val compressedFile = normalizedFile(archiveDir, outputFileName) BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile) return prepareResourceEntity(compressedFile.name, compressedFile.readBytes()) } diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt index b35a86b37..3f52d9183 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt +++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt @@ -46,7 +46,7 @@ class ResourceDictionaryReactRepositoryTest { @Test @Commit fun test01Save() { - val resourceDefinition = JacksonUtils.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json", ResourceDefinition::class.java) + val resourceDefinition = JacksonUtils.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json", ResourceDefinition::class.java) Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition) resourceDefinition!!.name = sourceName @@ -91,4 +91,4 @@ class ResourceDictionaryReactRepositoryTest { resourceDictionary.definition = resourceDefinition return resourceDictionary } -}
\ No newline at end of file +} diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties index 2b16fc05e..5ddc8a60f 100755 --- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties +++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties @@ -20,7 +20,7 @@ logging.level.org.springframework.web=INFO logging.level.org.hibernate.SQL=warn logging.level.org.hibernate.type.descriptor.sql=debug # Load Resource Source Mappings -resourceSourceMappings=processor-db=source-processor-db,primary-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,primary-aai-data=source-rest,capability=source-capability +resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability # Controller Blueprints Core Configuration controllerblueprints.blueprintDeployPath=./target/blueprints/deploy controllerblueprints.blueprintArchivePath=./target/blueprints/archive @@ -38,4 +38,4 @@ controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model- controllerblueprints.loadCbaExtension=zip # CBA examples for tests cases -controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint
\ No newline at end of file +controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json index 3ed188b9a..31f729da8 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json @@ -7,7 +7,7 @@ "required": true
},
"dictionary-name": "sample-db-source",
- "dictionary-source": "primary-db",
+ "dictionary-source": "processor-db",
"dependencies": [
"input-source"
]
@@ -56,7 +56,7 @@ "required": true
},
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": []
}
]
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json index 2e48b6d8b..c9351237d 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json @@ -225,7 +225,7 @@ },
"input-param": false,
"dictionary-name": "sample-db-source",
- "dictionary-source": "primary-db",
+ "dictionary-source": "processor-db",
"dependencies": [
"hostname"
],
@@ -243,7 +243,7 @@ },
"input-param": false,
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"service-instance-id"
],
@@ -314,7 +314,7 @@ },
"input-param": false,
"dictionary-name": "sample-licenses",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"service-instance-id"
],
@@ -348,4 +348,4 @@ },
"data_types": {
}
-}
\ No newline at end of file +}
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json index 6937c719b..b0a6e0979 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json @@ -227,7 +227,7 @@ }, "input-param" : false, "dictionary-name" : "sample-db-source", - "dictionary-source" : "primary-db", + "dictionary-source" : "processor-db", "dependencies" : [ "hostname" ], "version" : 0 }, { @@ -242,7 +242,7 @@ }, "input-param" : false, "dictionary-name" : "sample-mdsal-source", - "dictionary-source" : "primary-config-data", + "dictionary-source" : "config-data", "dependencies" : [ "service-instance-id" ], "version" : 0 }, { @@ -304,7 +304,7 @@ }, "input-param" : false, "dictionary-name" : "sample-licenses", - "dictionary-source" : "primary-config-data", + "dictionary-source" : "config-data", "dependencies" : [ "service-instance-id" ], "version" : 0 }, { @@ -324,4 +324,4 @@ } } } -}
\ No newline at end of file +} |