From feb0214caf9d9dfcf3280c8c0f63137219aafabb Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Fri, 29 Mar 2019 13:39:32 -0400 Subject: Improve bulk processing Change-Id: Ia8bd447563072284aa71e00eab0ef9b93e1776b1 Issue-ID: CCSDK-1127 Signed-off-by: Muthuramalingam, Brinda Santh --- .../src/main/resources/application-dev.properties | 2 +- .../src/test/resources/logback-test.xml | 2 +- .../netconf/executor/NetconfComponentFunction.kt | 14 ++- .../resolution/ResourceResolutionService.kt | 137 +++++++++++---------- .../db/ResourceResolutionResultService.kt | 23 ++-- .../resolution/ResourceResolutionServiceTest.kt | 19 +-- .../src/test/resources/logback-test.xml | 3 +- .../restconf/executor/RestconfComponentFunction.kt | 13 +- .../src/test/resources/logback-test.xml | 35 ++++++ .../application/src/test/resources/logback.xml | 35 ------ .../core/utils/TopologicalSortingUtilsTest.kt | 14 ++- .../src/test/resources/logback-test.xml | 31 +++++ .../service/src/test/resources/logback-test.xml | 39 ++++++ .../modules/service/src/test/resources/logback.xml | 40 ------ 14 files changed, 228 insertions(+), 179 deletions(-) create mode 100644 ms/controllerblueprints/application/src/test/resources/logback-test.xml delete mode 100644 ms/controllerblueprints/application/src/test/resources/logback.xml create mode 100644 ms/controllerblueprints/modules/blueprint-core/src/test/resources/logback-test.xml create mode 100644 ms/controllerblueprints/modules/service/src/test/resources/logback-test.xml delete mode 100644 ms/controllerblueprints/modules/service/src/test/resources/logback.xml (limited to 'ms') diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties index 7ed4cc942..fc148bf49 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties @@ -20,7 +20,7 @@ # Web server config server.port=8080 -blueprintsprocessor.grpcEnable=true +blueprintsprocessor.grpcEnable=false blueprintsprocessor.httpPort=8080 blueprintsprocessor.grpcPort=9111 diff --git a/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml index 0c8d93bf0..16e7d3d1b 100644 --- a/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml +++ b/ms/blueprintsprocessor/application/src/test/resources/logback-test.xml @@ -19,7 +19,7 @@ - %d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n + %d{HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt index 4b08ce8e2..be7451aa9 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt +++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt @@ -1,5 +1,6 @@ /* * Copyright © 2018-2019 IBM, Bell Canada. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +18,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor import com.fasterxml.jackson.databind.JsonNode +import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService @@ -38,17 +40,17 @@ abstract class NetconfComponentFunction : AbstractScriptComponentFunction() { return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName) } - fun resolveFromDatabase(resolutionKey: String, artifactName: String): String { - return resourceResolutionService().resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey) + fun resolveFromDatabase(resolutionKey: String, artifactName: String): String = runBlocking { + resourceResolutionService().resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey) } - fun resolveAndGenerateMessage(artifactMapping: String, artifactTemplate: String): String { - return resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName, + fun resolveAndGenerateMessage(artifactMapping: String, artifactTemplate: String): String = runBlocking { + resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactMapping, artifactTemplate) } - fun resolveAndGenerateMessage(artifactPrefix: String): String { - return resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName, + fun resolveAndGenerateMessage(artifactPrefix: String): String = runBlocking { + resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactPrefix, mapOf()) } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt index dad804692..8a14ded61 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt @@ -1,6 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2018 IBM. + * Modifications Copyright © 2018-2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution -import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.async +import kotlinx.coroutines.awaitAll +import kotlinx.coroutines.coroutineScope import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolutionResultService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils @@ -39,22 +41,22 @@ interface ResourceResolutionService { fun registeredResourceSources(): List - fun resolveFromDatabase(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactTemplate: String, - resolutionKey: String): String + suspend fun resolveFromDatabase(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactTemplate: String, + resolutionKey: String): String - fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, - artifactNames: List, properties: Map): MutableMap + suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, + artifactNames: List, properties: Map): MutableMap - fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, - artifactPrefix: String, properties: Map): String + suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, + artifactPrefix: String, properties: Map): String - fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, - artifactMapping: String, artifactTemplate: String?): String + suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, + artifactMapping: String, artifactTemplate: String?): String - fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>, - resourceDictionaries: MutableMap, - resourceAssignments: MutableList, - identifierName: String) + suspend fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>, + resourceDictionaries: MutableMap, + resourceAssignments: MutableList, + identifierName: String) } @Service(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION) @@ -70,9 +72,15 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica .map { it.substringAfter(ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR) } } - override fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, - artifactNames: List, - properties: Map): MutableMap { + override suspend fun resolveFromDatabase(bluePrintRuntimeService: BluePrintRuntimeService<*>, + artifactTemplate: String, + resolutionKey: String): String { + return resolutionResultService.read(bluePrintRuntimeService, artifactTemplate, resolutionKey) + } + + override suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, + artifactNames: List, + properties: Map): MutableMap { val resolvedParams: MutableMap = hashMapOf() artifactNames.forEach { artifactName -> @@ -82,8 +90,8 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica return resolvedParams } - override fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, - artifactPrefix: String, properties: Map): String { + override suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, + artifactPrefix: String, properties: Map): String { // Velocity Artifact Definition Name val artifactTemplate = "$artifactPrefix-template" @@ -95,20 +103,17 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica if (properties.containsKey(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT) && properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] as Boolean) { resolutionResultService.write(properties, result, bluePrintRuntimeService, artifactPrefix) + log.info("resolution saved into database successfully : ($properties)") } return result } - override fun resolveFromDatabase(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactTemplate: String, - resolutionKey: String): String { - return resolutionResultService.read(bluePrintRuntimeService, artifactTemplate, resolutionKey) - } - override fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, - artifactMapping: String, artifactTemplate: String?): String { + override suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, + artifactMapping: String, artifactTemplate: String?): String { - var resolvedContent = "" + val resolvedContent: String log.info("Resolving resource for template artifact($artifactTemplate) with resource assignment artifact($artifactMapping)") val identifierName = artifactTemplate ?: "no-template" @@ -128,7 +133,6 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica val resourceDictionaries: MutableMap = JacksonUtils.getMapFromFile(dictionaryFile, ResourceDefinition::class.java) - ?: throw BluePrintProcessorException("couldn't get Dictionary Definitions") // Resolve resources resolveResourceAssignments(bluePrintRuntimeService, resourceDictionaries, resourceAssignments, identifierName) @@ -153,46 +157,51 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica * name, then get the type of the Resource Definition, Get the instance for the Resource Type and process the * request. */ - override fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>, - resourceDictionaries: MutableMap, - resourceAssignments: MutableList, - identifierName: String) { + override suspend fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>, + resourceDictionaries: MutableMap, + resourceAssignments: MutableList, + identifierName: String) { val bulkSequenced = BulkResourceSequencingUtils.process(resourceAssignments) val resourceAssignmentRuntimeService = ResourceAssignmentUtils.transformToRARuntimeService(blueprintRuntimeService, identifierName) - bulkSequenced.map { batchResourceAssignments -> - batchResourceAssignments.filter { it.name != "*" && it.name != "start" } - .forEach { resourceAssignment -> - val dictionaryName = resourceAssignment.dictionaryName - val dictionarySource = resourceAssignment.dictionarySource - /** - * Get the Processor name - */ - val processorName = processorName(dictionaryName!!, dictionarySource!!, resourceDictionaries) - - val resourceAssignmentProcessor = - applicationContext.getBean(processorName) as? ResourceAssignmentProcessor - ?: throw BluePrintProcessorException("failed to get resource processor for name($processorName) " + - "for resource assignment(${resourceAssignment.name})") - try { - // Set BluePrint Runtime Service - resourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService - // Set Resource Dictionaries - resourceAssignmentProcessor.resourceDictionaries = resourceDictionaries - // TODO ("Implement suspend function") - runBlocking { - // Invoke Apply Method - resourceAssignmentProcessor.applyNB(resourceAssignment) + coroutineScope { + bulkSequenced.forEach { batchResourceAssignments -> + // Execute Non Dependent Assignments in parallel ( ie asynchronously ) + val deferred = batchResourceAssignments.filter { it.name != "*" && it.name != "start" } + .map { resourceAssignment -> + async { + val dictionaryName = resourceAssignment.dictionaryName + val dictionarySource = resourceAssignment.dictionarySource + /** + * Get the Processor name + */ + val processorName = processorName(dictionaryName!!, dictionarySource!!, resourceDictionaries) + + val resourceAssignmentProcessor = + applicationContext.getBean(processorName) as? ResourceAssignmentProcessor + ?: throw BluePrintProcessorException("failed to get resource processor ($processorName) " + + "for resource assignment(${resourceAssignment.name})") + try { + // Set BluePrint Runtime Service + resourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService + // Set Resource Dictionaries + resourceAssignmentProcessor.resourceDictionaries = resourceDictionaries + // Invoke Apply Method + resourceAssignmentProcessor.applyNB(resourceAssignment) + // Set errors from RA + blueprintRuntimeService.setBluePrintError(resourceAssignmentRuntimeService.getBluePrintError()) + } catch (e: RuntimeException) { + throw BluePrintProcessorException(e) + } } - // Set errors from RA - blueprintRuntimeService.setBluePrintError(resourceAssignmentRuntimeService.getBluePrintError()) - } catch (e: RuntimeException) { - throw BluePrintProcessorException(e) } - } + log.debug("Resolving (${deferred.size})resources parallel.") + deferred.awaitAll() + } } + } @@ -202,13 +211,12 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica */ private fun processorName(dictionaryName: String, dictionarySource: String, resourceDictionaries: MutableMap): String { - var processorName: String? = null - when (dictionarySource) { + val processorName: String = when (dictionarySource) { "input" -> { - processorName = "${ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-input" + "${ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-input" } "default" -> { - processorName = "${ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-default" + "${ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-default" } else -> { val resourceDefinition = resourceDictionaries[dictionaryName] @@ -217,8 +225,7 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica val resourceSource = resourceDefinition.sources[dictionarySource] ?: throw BluePrintProcessorException("couldn't get resource definition $dictionaryName source($dictionarySource)") - processorName = ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR - .plus(resourceSource.type) + ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR.plus(resourceSource.type) } } checkNotEmptyOrThrow(processorName, diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt index 225251fce..cbc68bbc9 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionResultService.kt @@ -1,5 +1,6 @@ /* * Copyright (C) 2019 Bell Canada. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +16,8 @@ */ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException @@ -26,8 +29,8 @@ import java.util.* @Service class ResourceResolutionResultService(private val resourceResolutionRepository: ResourceResolutionRepository) { - fun write(properties: Map, result: String, bluePrintRuntimeService: BluePrintRuntimeService<*>, - artifactPrefix: String) { + suspend fun write(properties: Map, result: String, bluePrintRuntimeService: BluePrintRuntimeService<*>, + artifactPrefix: String) = withContext(Dispatchers.IO) { val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! @@ -37,7 +40,7 @@ class ResourceResolutionResultService(private val resourceResolutionRepository: resourceResolutionResult.blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] resourceResolutionResult.blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] resourceResolutionResult.resolutionKey = - properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY].toString() + properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY].toString() resourceResolutionResult.result = result try { @@ -47,18 +50,18 @@ class ResourceResolutionResultService(private val resourceResolutionRepository: } } - fun read(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactPrefix: String, - resolutionKey: String): String { + suspend fun read(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactPrefix: String, + resolutionKey: String): String = withContext(Dispatchers.IO) { val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] - return resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName( - resolutionKey, - blueprintName, - blueprintVersion, - artifactPrefix).result!! + resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName( + resolutionKey, + blueprintName, + blueprintVersion, + artifactPrefix).result!! } } \ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt index 433ee1d85..5ad9b3ace 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt @@ -17,6 +17,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution +import kotlinx.coroutines.runBlocking import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -72,20 +73,22 @@ class ResourceResolutionServiceTest { @Test @Throws(Exception::class) fun testResolveResource() { + runBlocking { - Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) + Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") - val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json", - ExecutionServiceInput::class.java)!! + val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json", + ExecutionServiceInput::class.java)!! - // Prepare Inputs - PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment") + // Prepare Inputs + PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment") - resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", "baseconfig", mapOf()) + resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", "baseconfig", mapOf()) + } } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml index 0c8d93bf0..c37e0b5a0 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml @@ -19,13 +19,14 @@ - %d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n + %d{HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n + diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt index b95879274..3895c39c8 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt +++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt @@ -17,6 +17,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor +import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants @@ -38,21 +39,21 @@ abstract class RestconfComponentFunction : AbstractScriptComponentFunction() { return bluePrintRestLibPropertyService().blueprintWebClientService(selector) } - fun resolveFromDatabase(resolutionKey: String, artifactName: String): String { - return resourceResolutionService().resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey) + fun resolveFromDatabase(resolutionKey: String, artifactName: String): String = runBlocking { + resourceResolutionService().resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey) } fun generateMessage(artifactName: String): String { return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName) } - fun resolveAndGenerateMessage(artifactMapping: String, artifactTemplate: String): String { - return resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName, + fun resolveAndGenerateMessage(artifactMapping: String, artifactTemplate: String): String = runBlocking { + resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactMapping, artifactTemplate) } - fun resolveAndGenerateMessage(artifactPrefix: String): String { - return resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName, + fun resolveAndGenerateMessage(artifactPrefix: String): String = runBlocking { + resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactPrefix, mapOf()) } } \ No newline at end of file diff --git a/ms/controllerblueprints/application/src/test/resources/logback-test.xml b/ms/controllerblueprints/application/src/test/resources/logback-test.xml new file mode 100644 index 000000000..2252939e7 --- /dev/null +++ b/ms/controllerblueprints/application/src/test/resources/logback-test.xml @@ -0,0 +1,35 @@ + + + + + + + %d{HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n + + + + + + + + + + + + + diff --git a/ms/controllerblueprints/application/src/test/resources/logback.xml b/ms/controllerblueprints/application/src/test/resources/logback.xml deleted file mode 100644 index 55b008d11..000000000 --- a/ms/controllerblueprints/application/src/test/resources/logback.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n - - - - - - - - - - - - - diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt index 08b77bd4e..5da43484c 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt @@ -17,20 +17,22 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils import org.junit.Test +import org.slf4j.LoggerFactory class TopologicalSortingUtilsTest { - + + private val log = LoggerFactory.getLogger(TopologicalSortingUtilsTest::class.java) @Test - fun testSorting(): Unit { + fun testSorting() { val graph: TopologicalSortingUtils = TopologicalSortingUtils() graph.add("bundle-id", "bundle-mac") graph.add("bundle-id", "bundle-ip") graph.add("bundle-mac", "bundle-ip") graph.add("bundle-ip", "bundle-mac") - println("The current graph: " + graph) - println("In-degrees: " + graph.inDegree()) - println("Out-degrees: " + graph.outDegree()) - println("A topological sort of the vertices: " + graph.topSort()) + log.debug("The current graph: $graph") + log.debug("In-degrees: " + graph.inDegree()) + log.debug("Out-degrees: " + graph.outDegree()) + log.debug("A topological sort of the vertices: " + graph.topSort()) } } \ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/logback-test.xml b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/logback-test.xml new file mode 100644 index 000000000..83e0bc674 --- /dev/null +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/logback-test.xml @@ -0,0 +1,31 @@ + + + + + + + %d{HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n + + + + + + + + + diff --git a/ms/controllerblueprints/modules/service/src/test/resources/logback-test.xml b/ms/controllerblueprints/modules/service/src/test/resources/logback-test.xml new file mode 100644 index 000000000..feb4514d6 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/resources/logback-test.xml @@ -0,0 +1,39 @@ + + + + + + + + %d{HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n + + + + + + + + + + + + + + + diff --git a/ms/controllerblueprints/modules/service/src/test/resources/logback.xml b/ms/controllerblueprints/modules/service/src/test/resources/logback.xml deleted file mode 100644 index e66127977..000000000 --- a/ms/controllerblueprints/modules/service/src/test/resources/logback.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - ${localPattern} - - - - - - - - - - - - - - -- cgit 1.2.3-korg