--- /dev/null
+{
+ "metadata": {
+ "template_author": "Test",
+ "author-email": "test@test.com",
+ "user-groups": "ADMIN, OPERATION",
+ "template_name": "baseconfiguration-no-workflows",
+ "template_version": "1.0.0",
+ "template_tags": "test, no-workflows"
+ },
+ "imports": [],
+ "topology_template": {}
+}
--- /dev/null
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Test
+Entry-Definitions: Definitions/empty-blueprint.json
+Template-Name: baseconfiguration-no-workflows
+Template-Version: 1.0.0
+Template-Type: DEFAULT
+Template-Tags: test, no-workflows
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(processingId, workingDir!!)
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
- val workflows = bluePrintRuntimeService.bluePrintContext().workflows()!!
+ val workflows = bluePrintRuntimeService.bluePrintContext().workflows() ?: emptyMap()
metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = processingId
metadata[BluePrintConstants.PROPERTY_BLUEPRINT_VALID] = valid
normalizedFile("./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
.compress(normalizedFile("./target/blueprints/generated-cba.zip"))
+ // Create sample CBA zip without workflows
+ normalizedFile("./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration-no-workflows")
+ .compress(normalizedFile("./target/blueprints/generated-cba-no-workflows.zip"))
+
bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime(
blueprintId,
"./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
}
+ @Test
+ fun `test save CBA without workflows`() {
+ runBlocking {
+ val file = normalizedFile("./target/blueprints/generated-cba-no-workflows.zip")
+ assertTrue(file.exists(), "couldn't get file ${file.absolutePath}")
+
+ blueprintsProcessorCatalogService.saveToDatabase("5678", file)
+ blueprintsProcessorCatalogService.getFromDatabase("baseconfiguration-no-workflows", "1.0.0")
+
+ blueprintsProcessorCatalogService.deleteFromDatabase("baseconfiguration-no-workflows", "1.0.0")
+ }
+ }
+
@Test
fun `test delete function`() {
runBlocking {
import org.springframework.dao.IncorrectResultSizeDataAccessException
import org.springframework.http.ResponseEntity
import org.springframework.orm.jpa.JpaObjectRetrievalFailureException
+import org.slf4j.LoggerFactory
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.server.ServerWebInputException
abstract class ErrorCatalogExceptionHandler(private val errorCatalogService: ErrorCatalogService) {
+ private val log = LoggerFactory.getLogger(ErrorCatalogExceptionHandler::class.java)
+
@ExceptionHandler(ErrorCatalogException::class)
fun errorCatalogException(e: ErrorCatalogException): ResponseEntity<ErrorPayload> {
val errorPayload = errorCatalogService.errorPayload(e)
@ExceptionHandler
fun errorCatalogException(e: Exception): ResponseEntity<ErrorPayload> {
+ log.error("Unhandled exception: ${e.message}", e)
val error = ErrorCatalogException(
HttpErrorCodes.code(ErrorCatalogCodes.GENERIC_FAILURE),
e.errorMessageOrDefault(), e.errorCauseOrDefault()