summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/parent/pom.xml5
-rwxr-xr-xms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt13
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts)0
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt22
-rw-r--r--ms/controllerblueprints/parent/pom.xml5
7 files changed, 22 insertions, 35 deletions
diff --git a/components/parent/pom.xml b/components/parent/pom.xml
index 4411b84f9..821448d66 100644
--- a/components/parent/pom.xml
+++ b/components/parent/pom.xml
@@ -29,11 +29,6 @@
<packaging>pom</packaging>
<properties>
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
- <spring.boot.version>2.1.3.RELEASE</spring.boot.version>
- <spring.version>5.1.5.RELEASE</spring.version>
- <kotlin.version>1.3.21</kotlin.version>
- <kotlin.maven.version>1.3.21</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
<grpc.version>1.18.0</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
index 70aadb4b1..e3f876365 100755
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
@@ -71,7 +71,7 @@ class TemplateResolution : Serializable {
@get:ApiModelProperty(value = "If resolution occurred multiple time, this field provides the index.",
required = true)
@Column(name = "occurrence", nullable = false)
- var occurrence: Int = 0
+ var occurrence: Int = 1
@Id
@Column(name = "template_resolution_id")
@@ -87,4 +87,4 @@ class TemplateResolution : Serializable {
companion object {
private const val serialVersionUID = 1L
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
index 55f7e770b..c64605ef0 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
@@ -53,7 +53,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
blueprintVersion: String,
artifactPrefix: String,
resolutionKey: String,
- occurrence: Int = 0): String =
+ occurrence: Int = 1): String =
withContext(Dispatchers.IO) {
templateResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
@@ -69,7 +69,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
artifactPrefix: String,
resourceId: String,
resourceType: String,
- occurrence: Int = 0): String =
+ occurrence: Int = 1): String =
withContext(Dispatchers.IO) {
templateResolutionRepository.findByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
@@ -93,7 +93,6 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
val resourceId = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] as String
val resourceType = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] as String
val occurrence = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] as Int
-
write(blueprintName,
blueprintVersion,
artifactPrefix,
@@ -105,7 +104,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
}
suspend fun write(blueprintName: String, blueprintVersion: String, artifactPrefix: String,
- template: String, occurrence: Int = 0, resolutionKey: String = "", resourceId: String = "",
+ template: String, occurrence: Int = 1, resolutionKey: String = "", resourceId: String = "",
resourceType: String = ""): TemplateResolution =
withContext(Dispatchers.IO) {
@@ -148,9 +147,13 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
}
}
try {
+ log.info("Writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence")
templateResolutionRepository.saveAndFlush(resourceResolutionResult)
} catch (ex: DataIntegrityViolationException) {
+ log.error("Error writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}", ex.message)
throw BluePrintException("Failed to store resource api result.", ex)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt
index 32f04e6a0..32f04e6a0 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index b03c7b4d7..1ed0a6570 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
@@ -28,11 +29,6 @@
<description>Blueprints Processor Parent</description>
<properties>
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
- <spring.boot.version>2.1.3.RELEASE</spring.boot.version>
- <spring.version>5.1.5.RELEASE</spring.version>
- <kotlin.version>1.3.21</kotlin.version>
- <kotlin.maven.version>1.3.21</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
<grpc.version>1.18.0</grpc.version>
<sshd.version>2.2.0</sshd.version>
<jsch.version>0.1.55</jsch.version>
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt
index 05a147171..d35f2b49b 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt
@@ -31,14 +31,13 @@ val blueprintScriptCompiler = JvmScriptCompiler(defaultJvmScriptingHostConfigura
open class BlueprintScriptingHost(evaluator: ScriptEvaluator) : BasicScriptingHost(blueprintScriptCompiler, evaluator) {
- override fun eval(script: SourceCode, scriptCompilationConfiguration: ScriptCompilationConfiguration,
- configuration: ScriptEvaluationConfiguration?): ResultWithDiagnostics<EvaluationResult> =
+ override fun eval(script: SourceCode, compilationConfiguration: ScriptCompilationConfiguration,
+ evaluationConfiguration: ScriptEvaluationConfiguration?): ResultWithDiagnostics<EvaluationResult> =
runInCoroutineContext {
-
- blueprintScriptCompiler(script, scriptCompilationConfiguration)
- .onSuccess {
- evaluator(it, configuration)
+ blueprintScriptCompiler(script, compilationConfiguration)
+ .onSuccess { compiledScript ->
+ evaluator(compiledScript, evaluationConfiguration ?: ScriptEvaluationConfiguration.Default)
}.onFailure { failedResult ->
val messages = failedResult.reports.joinToString("\n")
throw BluePrintProcessorException(messages)
@@ -51,7 +50,7 @@ open class BluePrintScriptEvaluator(private val scriptClassName: String) : Scrip
private val log = LoggerFactory.getLogger(BluePrintScriptEvaluator::class.java)!!
override suspend operator fun invoke(compiledScript: CompiledScript<*>,
- scriptEvaluationConfiguration: ScriptEvaluationConfiguration?
+ scriptEvaluationConfiguration: ScriptEvaluationConfiguration
): ResultWithDiagnostics<EvaluationResult> =
try {
log.debug("Getting script class name($scriptClassName) from the compiled sources ")
@@ -59,20 +58,19 @@ open class BluePrintScriptEvaluator(private val scriptClassName: String) : Scrip
val bluePrintCompiledScript = compiledScript as BluePrintCompiledScript
bluePrintCompiledScript.scriptClassFQName = scriptClassName
- val classResult = compiledScript.getClass(scriptEvaluationConfiguration)
- when (classResult) {
+ when (val classResult = compiledScript.getClass(scriptEvaluationConfiguration)) {
is ResultWithDiagnostics.Failure -> classResult
is ResultWithDiagnostics.Success -> {
val scriptClass = classResult.value
val args = ArrayList<Any?>()
- scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.providedProperties)?.forEach {
+ scriptEvaluationConfiguration.get(ScriptEvaluationConfiguration.providedProperties)?.forEach {
args.add(it.value)
}
- scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.implicitReceivers)?.let {
+ scriptEvaluationConfiguration.get(ScriptEvaluationConfiguration.implicitReceivers)?.let {
args.addAll(it)
}
- scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.constructorArgs)?.let {
+ scriptEvaluationConfiguration.get(ScriptEvaluationConfiguration.constructorArgs)?.let {
args.addAll(it)
}
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 6ff76e944..4b571191d 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -29,11 +29,6 @@
<packaging>pom</packaging>
<properties>
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
- <spring.boot.version>2.1.3.RELEASE</spring.boot.version>
- <spring.version>5.1.5.RELEASE</spring.version>
- <kotlin.version>1.3.21</kotlin.version>
- <kotlin.maven.version>1.3.21</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
<grpc.version>1.18.0</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>