summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rwxr-xr-xms/blueprintsprocessor/application/pom.xml1
-rw-r--r--ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java2
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt98
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt (renamed from ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts)6
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt28
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt14
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt18
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt29
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt12
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt6
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt27
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input-missing-resource_assignment_request.json23
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml7
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/filters/ApplicationLoggingFilter.java2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/pom.xml27
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt14
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompiledScript.kt (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintCompiledScript.kt)2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerProxy.kt (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintCompilerProxy.kt)2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptingHost.kt)2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsConfiguration.kt (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptsConfiguration.kt)2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptsServiceImpl.kt)4
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt171
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt9
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript)0
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintScriptingHostTest.kt (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BlueprintScriptingHostTest.kt)2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts1/simple.cba.kts (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts)0
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts2/simple.cba.kts (renamed from ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts)0
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/pom.xml60
-rw-r--r--ms/controllerblueprints/modules/pom.xml1
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml4
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java13
-rw-r--r--ms/controllerblueprints/parent/pom.xml5
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java4
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java46
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java12
41 files changed, 349 insertions, 321 deletions
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml
index 0e207f708..a9552510d 100755
--- a/ms/blueprintsprocessor/application/pom.xml
+++ b/ms/blueprintsprocessor/application/pom.xml
@@ -184,7 +184,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
- <!-- <skip>${skip.compile}</skip>-->
<source>1.8</source>
<target>1.8</target>
</configuration>
diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java
index 16eb4182e..6bb6a2697 100644
--- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java
+++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java
@@ -61,7 +61,7 @@ public class BlueprintGRPCServer implements ApplicationListener<ContextRefreshed
log.info("Blueprint Processor GRPC server started and ready to serve on port({})...", server.getPort());
server.awaitTermination();
} catch (Exception e) {
- e.printStackTrace();
+ log.error("*** Error ***", e);
}
}
}
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
index 63998dd29..947a9630d 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 Bell Canada.
+ * 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.
@@ -18,21 +19,24 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.databind.node.ObjectNode
-import java.net.URI
-import java.net.URLEncoder
-import java.util.NoSuchElementException
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
+import com.fasterxml.jackson.databind.node.TextNode
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
+import org.onap.ccsdk.cds.controllerblueprints.core.isNotNull
+import org.onap.ccsdk.cds.controllerblueprints.core.rootFieldsToMap
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.http.HttpMethod
import org.springframework.stereotype.Component
+import java.net.URI
+import java.net.URLEncoder
+import java.util.*
/**
* ComponentRemoteAnsibleExecutor
@@ -99,7 +103,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
val message = "Error in ComponentRemoteAnsibleExecutor : ${runtimeException.message}"
- log.error(message,runtimeException)
+ log.error(message, runtimeException)
setNodeOutputErrors(ATTRIBUTE_EXEC_CMD_STATUS_ERROR, message)
}
@@ -123,7 +127,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
try {
return blueprintRestLibPropertyService.blueprintWebClientService(endpointSelector)
- } catch (e : NoSuchElementException) {
+ } catch (e: NoSuchElementException) {
throw IllegalArgumentException("No value provided for input selector $endpointSelector", e)
}
}
@@ -131,13 +135,13 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
/**
* Finds the job template ID based on the job template name provided in the request
*/
- private fun lookupJobTemplateIDByName(awxClient : BlueprintWebClientService, job_template_name: String?): String {
- val encodedJTName = URI(null,null,
+ private fun lookupJobTemplateIDByName(awxClient: BlueprintWebClientService, job_template_name: String?): String {
+ val encodedJTName = URI(null, null,
"/api/v2/job_templates/${job_template_name}/",
- null,null).rawPath
+ null, null).rawPath
// Get Job Template details by name
- var response = awxClient.exchangeResource(GET, encodedJTName,"")
+ var response = awxClient.exchangeResource(GET, encodedJTName, "")
val jtDetails: JsonNode = mapper.readTree(response.body)
return jtDetails.at("/id").asText()
}
@@ -148,18 +152,18 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
* its execution. Finally, it retrieves the job results via the stdout api.
* The status and output attributes are populated in the process.
*/
- private fun runJobTemplateOnAWX(awxClient : BlueprintWebClientService, job_template_name: String?, jtId: String) {
- setNodeOutputProperties( "preparing".asJsonPrimitive(), "".asJsonPrimitive())
+ private fun runJobTemplateOnAWX(awxClient: BlueprintWebClientService, job_template_name: String?, jtId: String) {
+ setNodeOutputProperties("preparing".asJsonPrimitive(), "".asJsonPrimitive())
// Get Job Template requirements
- var response = awxClient.exchangeResource(GET, "/api/v2/job_templates/${jtId}/launch/","")
+ var response = awxClient.exchangeResource(GET, "/api/v2/job_templates/${jtId}/launch/", "")
// FIXME: handle non-successful SC
val jtLaunchReqs: JsonNode = mapper.readTree(response.body)
- var payload = prepareLaunchPayload(awxClient, jtLaunchReqs)
+ val payload = prepareLaunchPayload(awxClient, jtLaunchReqs)
log.info("Running job with $payload, for requestId $processId.")
// Launch the job for the targeted template
- var jtLaunched : JsonNode = JacksonUtils.jsonNode("{}") as ObjectNode
+ var jtLaunched: JsonNode = JacksonUtils.objectMapper.createObjectNode()
response = awxClient.exchangeResource(POST, "/api/v2/job_templates/${jtId}/launch/", payload)
if (response.status in HTTP_SUCCESS) {
jtLaunched = mapper.readTree(response.body)
@@ -188,9 +192,9 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
// Get job execution results (stdout)
val plainTextHeaders = mutableMapOf<String, String>()
plainTextHeaders["Content-Type"] = "text/plain ;utf-8"
- response = awxClient.exchangeResource(GET, "/api/v2/jobs/${jobId}/stdout/?format=txt","", plainTextHeaders)
+ response = awxClient.exchangeResource(GET, "/api/v2/jobs/${jobId}/stdout/?format=txt", "", plainTextHeaders)
- setNodeOutputProperties( jobStatus.asJsonPrimitive(), response.body.asJsonPrimitive())
+ setNodeOutputProperties(jobStatus.asJsonPrimitive(), response.body.asJsonPrimitive())
} else {
// The job template requirements were not fulfilled with the values passed in. The message below will
// provide more information via the response, like the ignored_fields, or variables_needed_to_start,
@@ -198,7 +202,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
val message = "Execution of job template $job_template_name could not be started for requestId $processId." +
" (Response: ${response.body}) "
log.error(message)
- setNodeOutputErrors( ATTRIBUTE_EXEC_CMD_STATUS_ERROR, message)
+ setNodeOutputErrors(ATTRIBUTE_EXEC_CMD_STATUS_ERROR, message)
}
}
@@ -207,51 +211,49 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
* by applying the overrides that were provided
* and allowed by the template definition flags in jtLaunchReqs
*/
- private fun prepareLaunchPayload(awxClient : BlueprintWebClientService, jtLaunchReqs: JsonNode): String {
- val payload = JacksonUtils.jsonNode("{}") as ObjectNode
+ private fun prepareLaunchPayload(awxClient: BlueprintWebClientService, jtLaunchReqs: JsonNode): String {
+ val payload = JacksonUtils.objectMapper.createObjectNode()
// Parameter defaults
- val limitProp = getOptionalOperationInput(INPUT_LIMIT_TO_HOST)?.asText()
- val tagsProp = getOptionalOperationInput(INPUT_TAGS)?.asText()
- val skipTagsProp = getOptionalOperationInput(INPUT_SKIP_TAGS)?.asText()
- val inventoryProp : String? = getOptionalOperationInput(INPUT_INVENTORY)?.asText()
- val extraArgs : JsonNode = getOperationInput(INPUT_EXTRA_VARS)
-
- val askLimitOnLaunch = jtLaunchReqs.at( "/ask_limit_on_launch").asBoolean()
- if (askLimitOnLaunch && limitProp!!.isNotEmpty()) {
- payload.put(INPUT_LIMIT_TO_HOST, limitProp)
+ val limitProp = getOptionalOperationInput(INPUT_LIMIT_TO_HOST)
+ val tagsProp = getOptionalOperationInput(INPUT_TAGS)
+ val skipTagsProp = getOptionalOperationInput(INPUT_SKIP_TAGS)
+ val inventoryProp = getOptionalOperationInput(INPUT_INVENTORY)
+ val extraArgs = getOperationInput(INPUT_EXTRA_VARS)
+
+ val askLimitOnLaunch = jtLaunchReqs.at("/ask_limit_on_launch").asBoolean()
+ if (askLimitOnLaunch && limitProp.isNotNull()) {
+ payload.set(INPUT_LIMIT_TO_HOST, limitProp)
}
val askTagsOnLaunch = jtLaunchReqs.at("/ask_tags_on_launch").asBoolean()
- if (askTagsOnLaunch && tagsProp!!.isNotEmpty()) {
- payload.put(INPUT_TAGS, tagsProp)
+ if (askTagsOnLaunch && tagsProp.isNotNull()) {
+ payload.set(INPUT_TAGS, tagsProp)
}
- if (askTagsOnLaunch && skipTagsProp!!.isNotEmpty()) {
- payload.put("skip_tags", skipTagsProp)
+ if (askTagsOnLaunch && skipTagsProp.isNotNull()) {
+ payload.set("skip_tags", skipTagsProp)
}
val askInventoryOnLaunch = jtLaunchReqs.at("/ask_inventory_on_launch").asBoolean()
- if (askInventoryOnLaunch && inventoryProp != null) {
- var inventoryKeyId = inventoryProp.toIntOrNull()
- if (inventoryKeyId == null) {
- inventoryKeyId = resolveInventoryIdByName(awxClient, inventoryProp)
+ if (askInventoryOnLaunch && inventoryProp.isNotNull()) {
+ var inventoryKeyId = if (inventoryProp is TextNode) {
+ resolveInventoryIdByName(awxClient, inventoryProp!!.textValue())?.asJsonPrimitive()
+ } else {
+ inventoryProp
}
- payload.put(INPUT_INVENTORY, inventoryKeyId)
+ payload.set(INPUT_INVENTORY, inventoryKeyId)
}
val askVariablesOnLaunch = jtLaunchReqs.at("/ask_variables_on_launch").asBoolean()
if (askVariablesOnLaunch && extraArgs != null) {
- payload.put("extra_vars", extraArgs)
+ payload.set("extra_vars", extraArgs)
}
-
- val strPayload = "$payload"
-
- return strPayload
+ return payload.asJsonString(false)
}
- private fun resolveInventoryIdByName(awxClient : BlueprintWebClientService, inventoryProp: String): Int? {
- var invId : Int? = null
+ private fun resolveInventoryIdByName(awxClient: BlueprintWebClientService, inventoryProp: String): Int? {
+ var invId: Int? = null
// Get Inventory by name
val encoded = URLEncoder.encode(inventoryProp)
- val response = awxClient.exchangeResource(GET,"/api/v2/inventories/?name=$encoded","")
+ val response = awxClient.exchangeResource(GET, "/api/v2/inventories/?name=$encoded", "")
if (response.status in HTTP_SUCCESS) {
// Extract the inventory ID from response
val invDetails = mapper.readTree(response.body)
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
index e62374747..4c1d92ae6 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
@@ -16,6 +16,8 @@
@file:Suppress("unused")
+package internal.scripts
+
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
@@ -26,10 +28,10 @@ import org.slf4j.LoggerFactory
open class TestCliScriptFunction : AbstractScriptComponentFunction() {
- private val log = LoggerFactory.getLogger(TestCliScriptFunction::class.java.canonicalName)!!
+ private val log = LoggerFactory.getLogger(TestCliScriptFunction::class.java)!!
override fun getName(): String {
- return "SimpleCliConfigure"
+ return "TestCliScriptFunction"
}
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt
deleted file mode 100644
index e1d8825ba..000000000
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor
-
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
-import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Component
-
-@Component("component-cli-executor")
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentCliExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService)
- : ComponentScriptExecutor(componentFunctionScriptingService) \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
index 658092f0a..30e7c8906 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
@@ -38,7 +38,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.cds.controllerblueprints.scripts.BluePrintScriptsServiceImpl
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.ContextConfiguration
@@ -56,12 +56,12 @@ import kotlin.test.assertNotNull
class ComponentCliExecutorTest {
@Autowired
- lateinit var componentCliExecutor: ComponentCliExecutor
+ lateinit var componentScriptExecutor: ComponentScriptExecutor
@Test
fun `test CLI Component Instance`() {
runBlocking {
- assertNotNull(componentCliExecutor, "failed to get ComponentCliExecutor instance")
+ assertNotNull(componentScriptExecutor, "failed to get ComponentCliExecutor instance")
val executionServiceInput = ExecutionServiceInput().apply {
commonHeader = CommonHeader().apply {
requestId = "1234"
@@ -72,8 +72,8 @@ class ComponentCliExecutorTest {
payload = JacksonUtils.jsonNode("{}") as ObjectNode
}
val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
- componentCliExecutor.bluePrintRuntimeService = bluePrintRuntime
- componentCliExecutor.stepName = "sample-step"
+ componentScriptExecutor.bluePrintRuntimeService = bluePrintRuntime
+ componentScriptExecutor.stepName = "sample-step"
val operationInputs = hashMapOf<String, JsonNode>()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "activate-cli".asJsonPrimitive()
@@ -81,7 +81,7 @@ class ComponentCliExecutorTest {
operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive()
operationInputs[ComponentScriptExecutor.SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
operationInputs[ComponentScriptExecutor.SCRIPT_CLASS_REFERENCE] =
- "InternalSimpleCli_cba\$TestCliScriptFunction".asJsonPrimitive()
+ "internal.scripts.TestCliScriptFunction".asJsonPrimitive()
val stepInputData = StepData().apply {
name = "activate-cli"
@@ -102,7 +102,7 @@ class ComponentCliExecutorTest {
"interfaceName", "operationName")
} returns operationOutputs
- componentCliExecutor.applyNB(executionServiceInput)
+ componentScriptExecutor.applyNB(executionServiceInput)
}
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml
index 626b8f911..688a533be 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/test/resources/logback-test.xml
@@ -27,6 +27,7 @@
<logger name="org.springframework" level="warn"/>
<logger name="org.hibernate" level="info"/>
<logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
+ <logger name="internal.scripts" level="info"/>
<root level="warn">
<appender-ref ref="STDOUT"/>
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index ee7c31ad2..b38ebb1b0 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -23,6 +23,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractCompone
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode
+import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
@@ -31,15 +32,16 @@ import org.springframework.stereotype.Component
@Component("component-resource-resolution")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ResourceResolutionComponent(private val resourceResolutionService: ResourceResolutionService) :
- AbstractComponentFunction() {
+ AbstractComponentFunction() {
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val occurrence = getOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE).asInt()
- val resolutionKey = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY)?.asText() ?: ""
+ val resolutionKey = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY)?.returnNullIfMissing()?.textValue() ?: ""
val storeResult = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT)?.asBoolean() ?: false
- val resourceId = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID)?.asText() ?: ""
- val resourceType = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE)?.asText() ?: ""
+ val resourceId = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID)?.returnNullIfMissing()?.textValue() ?: ""
+
+ val resourceType = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE)?.returnNullIfMissing()?.textValue() ?: ""
val properties: MutableMap<String, Any> = mutableMapOf()
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = storeResult
@@ -69,9 +71,9 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] = j
val response = resourceResolutionService.resolveResources(bluePrintRuntimeService,
- nodeTemplateName,
- artifactPrefixNames,
- properties)
+ nodeTemplateName,
+ artifactPrefixNames,
+ properties)
// provide indexed result in output if we have multiple resolution
if (occurrence != 1) {
@@ -84,7 +86,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
// Set Output Attributes
bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, jsonResponse)
+ ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, jsonResponse)
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
index 6cf1c0be7..3bf0b359a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
@@ -88,7 +88,11 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
val response = restClientService.exchangeResource(verb, urlPath, payload)
val responseStatusCode = response.status
val responseBody = response.body
- if (responseStatusCode in 200..299 && !responseBody.isBlank()) {
+ val outputKeyMapping = sourceProperties.outputKeyMapping
+ if (responseStatusCode in 200..299 && outputKeyMapping.isNullOrEmpty()) {
+ logger.info("AS>> outputKeyMapping==null, will not populateResource")
+ }
+ else if (responseStatusCode in 200..299 && !responseBody.isBlank()) {
populateResource(resourceAssignment, sourceProperties, responseBody, path)
} else {
val errMsg =
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
index 39076b4f5..560bc4142 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
@@ -17,6 +17,8 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.MissingNode
+import com.fasterxml.jackson.databind.node.NullNode
import io.mockk.coEvery
import io.mockk.every
import io.mockk.mockk
@@ -29,7 +31,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import java.lang.RuntimeException
import kotlin.test.assertEquals
import kotlin.test.fail
@@ -79,7 +80,7 @@ class ResourceResolutionComponentTest {
resourceResolutionComponent.processNB(executionRequest)
} catch (e: BluePrintProcessorException) {
assertEquals("Can't proceed with the resolution: either provide resolution-key OR combination of resource-id and resource-type.",
- e.message)
+ e.message)
return@runBlocking
}
fail()
@@ -88,15 +89,15 @@ class ResourceResolutionComponentTest {
@Test
fun processNBWithResourceIdTestException() {
- props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] = "".asJsonPrimitive()
- props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] = "".asJsonPrimitive()
+ props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] = NullNode.getInstance()
+ props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] = NullNode.getInstance()
runBlocking {
try {
resourceResolutionComponent.processNB(executionRequest)
} catch (e: BluePrintProcessorException) {
assertEquals("Can't proceed with the resolution: both resource-id and resource-type should be provided, one of them is missing.",
- e.message)
+ e.message)
return@runBlocking
}
fail()
@@ -105,9 +106,9 @@ class ResourceResolutionComponentTest {
@Test
fun processNBWithEmptyResourceTypeResourceIdResolutionKeyTestException() {
- props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] = "".asJsonPrimitive()
- props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] = "".asJsonPrimitive()
- props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] = "".asJsonPrimitive()
+ props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] = MissingNode.getInstance()
+ props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] = NullNode.getInstance()
+ props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] = NullNode.getInstance()
runBlocking {
try {
@@ -115,7 +116,7 @@ class ResourceResolutionComponentTest {
} catch (e: BluePrintProcessorException) {
assertEquals("Can't proceed with the resolution: can't persist resolution without a correlation key. " +
"Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false.",
- e.message)
+ e.message)
return@runBlocking
}
fail()
@@ -124,7 +125,7 @@ class ResourceResolutionComponentTest {
@Test
fun processNBTest() {
- props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] = "".asJsonPrimitive()
+ props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] = NullNode.getInstance()
val properties = mutableMapOf<String, Any>()
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = true
@@ -133,10 +134,10 @@ class ResourceResolutionComponentTest {
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] = occurrence
coEvery {
- resourceResolutionService.resolveResources(any<BluePrintRuntimeService<*>>(),
- any<String>(),
- any<List<String>>(),
- any<MutableMap<String, Any>>())
+ resourceResolutionService.resolveResources(any(),
+ any(),
+ any<List<String>>(),
+ any<MutableMap<String, Any>>())
} returns mutableMapOf()
every { bluePrintRuntimeService.setNodeTemplateAttributeValue(any(), any(), any()) } returns Unit
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
index 66fdd8ff8..4a4bcc026 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
@@ -31,7 +31,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
-import org.onap.ccsdk.cds.controllerblueprints.scripts.BluePrintScriptsServiceImpl
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
index edfa4e3f7..a48d4e0bb 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
@@ -38,10 +38,6 @@
<artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-scripts</artifactId>
- </dependency>
- <dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>processor-core</artifactId>
</dependency>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
index b2991be5e..49a2c62b1 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
@@ -21,6 +21,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintScriptsService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.slf4j.LoggerFactory
import org.springframework.context.ApplicationContext
@@ -28,15 +29,14 @@ import org.springframework.stereotype.Service
@Service
class ComponentFunctionScriptingService(private val applicationContext: ApplicationContext,
- private val bluePrintScriptsService: BluePrintScriptsService,
private val blueprintJythonService: BlueprintJythonService) {
private val log = LoggerFactory.getLogger(ComponentFunctionScriptingService::class.java)
suspend fun <T : AbstractScriptComponentFunction> scriptInstance(componentFunction: AbstractComponentFunction,
- scriptType: String,
- scriptClassReference: String,
- instanceDependencies: List<String>): T {
+ scriptType: String,
+ scriptClassReference: String,
+ instanceDependencies: List<String>): T {
log.info("creating component function of script type($scriptType), reference name($scriptClassReference) and " +
"instanceDependencies($instanceDependencies)")
@@ -66,14 +66,16 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat
suspend fun <T : BlueprintFunctionNode<*, *>> scriptInstance(bluePrintContext: BluePrintContext, scriptType: String,
- scriptClassReference: String): T {
+ scriptClassReference: String): T {
var scriptComponent: T? = null
when (scriptType) {
BluePrintConstants.SCRIPT_INTERNAL -> {
+ val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl()
scriptComponent = bluePrintScriptsService.scriptInstance<T>(scriptClassReference)
}
BluePrintConstants.SCRIPT_KOTLIN -> {
+ val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl()
scriptComponent = bluePrintScriptsService.scriptInstance<T>(bluePrintContext, scriptClassReference, false)
}
BluePrintConstants.SCRIPT_JYTHON -> {
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
index 224319c24..309db9df4 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
@@ -42,7 +42,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.cds.controllerblueprints.scripts.BluePrintScriptsServiceImpl
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
index 8ae128d4b..fcf0558c7 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
@@ -44,6 +44,10 @@ open class BluePrintWorkflowExecutionServiceImpl(
val workflowName = executionServiceInput.actionIdentifiers.actionName
// Assign Workflow inputs
+ //check if request structure exists
+ if (!executionServiceInput.payload.has("$workflowName-request")) {
+ throw BluePrintProcessorException("Input request missing the expected '$workflowName-request' block!")
+ }
val input = executionServiceInput.payload.get("$workflowName-request")
bluePrintRuntimeService.assignWorkflowInputs(workflowName, input)
@@ -80,4 +84,4 @@ open class BluePrintWorkflowExecutionServiceImpl(
return executionServiceOutput
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
index 59be9406e..c15c054db 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
@@ -22,6 +22,7 @@ import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -29,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertEquals
+import kotlin.test.assertFailsWith
import kotlin.test.assertNotNull
@@ -43,18 +45,33 @@ class BluePrintWorkflowExecutionServiceImplTest {
fun testBluePrintWorkflowExecutionService() {
runBlocking {
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json",
- ExecutionServiceInput::class.java)!!
-
+ ExecutionServiceInput::class.java)!!
val executionServiceOutput = bluePrintWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
assertNotNull(executionServiceOutput, "failed to get response")
assertEquals(BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
- "failed to get successful response")
+ "failed to get successful response")
+ }
+ }
+
+ @Test
+ fun `Blueprint fails on missing workflowName-parameters with a useful message`() {
+ assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+ runBlocking {
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ //service input will have a mislabeled input params, we are expecting to get an error when that happens with a useful error message
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input-missing-resource_assignment_request.json",
+ ExecutionServiceInput::class.java)!!
+
+ val executionServiceOutput = bluePrintWorkflowExecutionService
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ }
}
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input-missing-resource_assignment_request.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input-missing-resource_assignment_request.json
new file mode 100644
index 000000000..a44e171a3
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input-missing-resource_assignment_request.json
@@ -0,0 +1,23 @@
+{
+ "commonHeader": {
+ "originatorId": "System",
+ "requestId": "1234",
+ "subRequestId": "1234-12234"
+ },
+ "actionIdentifiers": {
+ "blueprintName": "baseconfiguration",
+ "blueprintVersion": "1.0.0",
+ "actionName": "resource-assignment",
+ "mode": "sync"
+ },
+ "payload": {
+ "resource-assignment-mislabeled-request": {
+ "resource-assignment-properties": {
+ "request-id": "1234",
+ "action-name": "resource-assignment",
+ "scope-type": "vnf-type",
+ "hostname": "localhost"
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index d0c923e58..dc689ece0 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -55,6 +55,7 @@
<jinja.version>2.5.1</jinja.version>
<velocity.version>1.7</velocity.version>
<mockkserver.version>5.5.1</mockkserver.version>
+ <jsoup.version>1.10.3</jsoup.version>
</properties>
<dependencyManagement>
<dependencies>
@@ -68,6 +69,12 @@
</dependency>
<dependency>
+ <groupId>org.jsoup</groupId>
+ <artifactId>jsoup</artifactId>
+ <version>${jsoup.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<version>${spring.kafka.version}</version>
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/filters/ApplicationLoggingFilter.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/filters/ApplicationLoggingFilter.java
index 60837e8a7..331a44d83 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/filters/ApplicationLoggingFilter.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/cds/controllerblueprints/filters/ApplicationLoggingFilter.java
@@ -79,7 +79,7 @@ public class ApplicationLoggingFilter implements WebFilter {
header.add(BluePrintConstants.RESPONSE_HEADER_PATCH_VERSION, tokens[2]);
header.add(BluePrintConstants.RESPONSE_HEADER_LATEST_VERSION, appVersion);
} catch (Exception e) {
- e.printStackTrace();
+ log.error("*** Error ***", e);
}
return webFilterChain.filter(serverWebExchange);
diff --git a/ms/controllerblueprints/modules/blueprint-core/pom.xml b/ms/controllerblueprints/modules/blueprint-core/pom.xml
index 9e22af637..d0710b238 100644
--- a/ms/controllerblueprints/modules/blueprint-core/pom.xml
+++ b/ms/controllerblueprints/modules/blueprint-core/pom.xml
@@ -15,7 +15,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.controllerblueprints</groupId>
@@ -26,6 +27,30 @@
<name>Controller Blueprints Core</name>
<dependencies>
+ <!-- Compiler Service -->
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compiler-embeddable</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-scripting-jvm-host</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compiler</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-script-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-script-runtime</artifactId>
+ </dependency>
+
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
index 596ac79b3..4832970f3 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
@@ -40,7 +40,7 @@ fun String.isJson(): Boolean {
}
fun Any.asJsonString(intend: Boolean? = false): String {
- return JacksonUtils.getJson(this, true)
+ return JacksonUtils.getJson(this, intend!!)
}
fun String.asJsonPrimitive(): TextNode {
@@ -130,6 +130,18 @@ fun JsonNode.returnNullIfMissing(): JsonNode? {
} else this
}
+fun <T : JsonNode> T?.isNull(): Boolean {
+ return if (this == null || this is NullNode || this is MissingNode) {
+ true
+ } else false
+}
+
+fun <T : JsonNode> T?.isNotNull(): Boolean {
+ return if (this == null || this is NullNode || this is MissingNode) {
+ false
+ } else true
+}
+
/**
* Convert Json to map of json node, the root fields will be map keys
*/
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt
index b822f00b8..18091e630 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt
@@ -84,7 +84,7 @@ fun normalizedFile(path: String, vararg more: String?): File {
}
fun normalizedPath(path: String, vararg more: String?): Path {
- return Paths.get(path, *more).normalize().toAbsolutePath()
+ return Paths.get(path, *more).toAbsolutePath().normalize()
}
fun normalizedPathName(path: String, vararg more: String?): String {
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintCompiledScript.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompiledScript.kt
index e926b9828..03258c252 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintCompiledScript.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompiledScript.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.scripts
+package org.onap.ccsdk.cds.controllerblueprints.core.scripts
import java.io.File
import java.io.Serializable
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintCompilerProxy.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerProxy.kt
index 6e88ba31a..df3302518 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintCompilerProxy.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerProxy.kt
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.scripts
+package org.onap.ccsdk.cds.controllerblueprints.core.scripts
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoots
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptingHost.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt
index fa1488463..4fcc33d46 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptingHost.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptingHost.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.scripts
+package org.onap.ccsdk.cds.controllerblueprints.core.scripts
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptsConfiguration.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsConfiguration.kt
index 96d459066..3ac790171 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptsConfiguration.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsConfiguration.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.scripts
+package org.onap.ccsdk.cds.controllerblueprints.core.scripts
import java.io.File
import kotlin.script.experimental.annotations.KotlinScript
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptsServiceImpl.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt
index 9438c1f4b..e2c02603a 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BluePrintScriptsServiceImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt
@@ -15,19 +15,17 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.scripts
+package org.onap.ccsdk.cds.controllerblueprints.core.scripts
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintScriptsService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
-import org.springframework.stereotype.Service
import java.io.File
import java.util.*
import kotlin.script.experimental.api.ResultValue
import kotlin.script.experimental.api.resultOrNull
import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
-@Service
open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
override suspend fun <T> scriptInstance(blueprintContext: BluePrintContext, scriptClassName: String,
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
index b48e446d3..a7ed72dfa 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -18,7 +18,6 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import com.fasterxml.jackson.databind.node.ObjectNode
@@ -28,6 +27,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.slf4j.LoggerFactory
import java.io.File
interface BluePrintRuntimeService<T> {
@@ -145,7 +145,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
* Load Blueprint Environments Properties
*/
val absoluteEnvFilePath = bluePrintContext.rootPath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
+ .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
loadEnvironments(BluePrintConstants.PROPERTY_BPP, absoluteEnvFilePath)
}
@@ -214,7 +214,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun loadEnvironments(type: String, fileName: String) {
BluePrintMetadataUtils.environmentFileProperties(fileName).forEach { key, value ->
setNodeTemplateAttributeValue(type, key.toString(), value.toString()
- .asJsonPrimitive())
+ .asJsonPrimitive())
}
}
@@ -237,7 +237,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
// Resolve the Expressing
val propertyAssignmentExpression = PropertyAssignmentService(this)
resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName,
- nodeTypePropertyName, propertyAssignment)
+ nodeTypePropertyName, propertyAssignment)
}
// Set default value if null
@@ -260,7 +260,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val expression = propertyDefinition.value ?: propertyDefinition.defaultValue
if (expression != null) {
propertyAssignmentValue[propertyName] = propertyAssignmentExpression.resolveAssignmentExpression(name,
- propertyName, expression)
+ propertyName, expression)
}
}
return propertyAssignmentValue
@@ -274,7 +274,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
propertyAssignments.forEach { propertyName, propertyExpression ->
val propertyAssignmentExpression = PropertyAssignmentService(this)
propertyAssignmentValue[propertyName] = propertyAssignmentExpression.resolveAssignmentExpression(name,
- propertyName, propertyExpression)
+ propertyName, propertyExpression)
}
return propertyAssignmentValue
}
@@ -288,13 +288,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
// Get the Node Type Definitions
val nodeTypePropertieDefinitions: MutableMap<String, PropertyDefinition> = bluePrintContext
- .nodeTypeChainedProperties(nodeTemplate.type)!!
+ .nodeTypeChainedProperties(nodeTemplate.type)!!
/**
* Resolve the NodeTemplate Property Assignment Values.
*/
return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypePropertieDefinitions,
- propertyAssignments)
+ propertyAssignments)
}
override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String):
@@ -306,13 +306,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val propertyAssignments = nodeTemplate.capabilities?.get(capabilityName)?.properties ?: hashMapOf()
val propertyDefinitions = bluePrintContext.nodeTemplateNodeType(nodeTemplateName)
- .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
+ .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
/**
* Resolve the Capability Property Assignment Values.
*/
return resolveNodeTemplatePropertyAssignments(nodeTemplateName, propertyDefinitions,
- propertyAssignments)
+ propertyAssignments)
}
override fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
@@ -322,14 +322,14 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
"($interfaceName), operationName($operationName)")
val propertyAssignments: MutableMap<String, JsonNode> =
- bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
- ?: hashMapOf()
+ bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
+ ?: hashMapOf()
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
val nodeTypeInterfaceOperationInputs: MutableMap<String, PropertyDefinition> =
- bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
- ?: hashMapOf()
+ bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
+ ?: hashMapOf()
log.info("input definition for node template ($nodeTemplateName), values ($propertyAssignments)")
@@ -337,7 +337,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
* Resolve the Property Input Assignment Values.
*/
return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationInputs,
- propertyAssignments)
+ propertyAssignments)
}
@@ -349,19 +349,19 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
"($interfaceName), operationName($operationName)")
val propertyAssignments: MutableMap<String, JsonNode> =
- bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
- ?: hashMapOf()
+ bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
+ ?: hashMapOf()
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
- bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
- ?: hashMapOf()
+ bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
+ ?: hashMapOf()
/**
* Resolve the Property Output Assignment Values.
*/
val propertyAssignmentValue = resolveNodeTemplatePropertyAssignments(nodeTemplateName,
- nodeTypeInterfaceOperationOutputs, propertyAssignments)
+ nodeTypeInterfaceOperationOutputs, propertyAssignments)
// Store operation output values into context
propertyAssignmentValue.forEach { key, value ->
@@ -372,7 +372,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun resolveNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): String {
val artifactDefinition: ArtifactDefinition =
- resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
+ resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
val propertyAssignmentExpression = PropertyAssignmentService(this)
return propertyAssignmentExpression.artifactContent(artifactDefinition)
}
@@ -382,8 +382,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
return nodeTemplate.artifacts?.get(artifactName)
- ?: throw BluePrintProcessorException("failed to get artifat definition($artifactName) from the node " +
- "template")
+ ?: throw BluePrintProcessorException("failed to get artifat definition($artifactName) from the node " +
+ "template")
}
@@ -394,14 +394,14 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun resolveDSLExpression(dslPropertyName: String): JsonNode {
val propertyAssignments = bluePrintContext.dslPropertiesByName(dslPropertyName)
return if (BluePrintExpressionService.checkContainsExpression(propertyAssignments)
- && propertyAssignments is ObjectNode) {
+ && propertyAssignments is ObjectNode) {
val rootKeyMap = propertyAssignments.rootFieldsToMap()
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
rootKeyMap.forEach { propertyName, propertyValue ->
val propertyAssignmentExpression = PropertyAssignmentService(this)
propertyAssignmentValue[propertyName] = propertyAssignmentExpression
- .resolveAssignmentExpression("DSL", propertyName, propertyValue)
+ .resolveAssignmentExpression("DSL", propertyName, propertyValue)
}
propertyAssignmentValue.asJsonNode()
} else {
@@ -411,7 +411,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) {
val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
log.trace("setting input path ({}), values ({})", path, value)
put(path, value)
}
@@ -419,28 +419,28 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setWorkflowInputValue(workflowName: String, propertyName: String,
propertyDefinition: PropertyDefinition, value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS)
- .append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
override fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
override fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
put(path, value)
}
@@ -448,13 +448,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
operationName: String, propertyName: String,
value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
log.trace("setting operation property path ({}), values ({})", path, value)
put(path, value)
}
@@ -463,14 +463,14 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
operationName: String, propertyName: String,
value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
@@ -478,51 +478,51 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
operationName: String, propertyName: String,
value: JsonNode) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
override fun getInputValue(propertyName: String): JsonNode {
val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
operationName: String, propertyName: String): JsonNode {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
- .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
- .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
return getJsonNode(path)
}
@@ -530,7 +530,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
log.info("assignInputs from input JSON ({})", jsonNode.toString())
bluePrintContext.inputs()?.forEach { propertyName, property ->
val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
- ?: NullNode.getInstance()
+ ?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
}
}
@@ -542,8 +542,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
bluePrintContext.workflowByName(workflowName).inputs?.forEach { propertyName, property ->
if (propertyName != dynamicInputPropertiesName) {
- val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
- ?: NullNode.getInstance()
+ val valueNode: JsonNode = jsonNode
+ .at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
+ ?: property.defaultValue
+ ?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
}
}
@@ -552,11 +554,12 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
workflowDynamicInputs?.let {
bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")
- ?.properties?.forEach { propertyName, property ->
+ ?.properties?.forEach { propertyName, property ->
val valueNode: JsonNode =
- workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
- ?: property.defaultValue
- ?: NullNode.getInstance()
+ workflowDynamicInputs
+ .at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
+ ?: property.defaultValue
+ ?: NullNode.getInstance()
setInputValue(propertyName, property, valueNode)
}
@@ -573,9 +576,9 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val jsonNode: ObjectNode = jacksonObjectMapper().createObjectNode()
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
- .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
- .append(BluePrintConstants.PATH_DIVIDER).toString()
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
+ .append(BluePrintConstants.PATH_DIVIDER).toString()
store.keys.filter {
it.startsWith(path)
}.map {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
index 60ed6343a..ef5cb81d9 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
@@ -18,24 +18,21 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.data.ToscaMetaData
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
-import org.onap.ccsdk.cds.controllerblueprints.core.readNBLines
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintImportService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
+import org.slf4j.LoggerFactory
import java.io.File
import java.util.*
class BluePrintMetadataUtils {
companion object {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
suspend fun toscaMetaData(basePath: String): ToscaMetaData {
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript b/ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript
index e69de29bb..e69de29bb 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BlueprintScriptingHostTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintScriptingHostTest.kt
index 2c597ea2b..2288d62c8 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/scripts/BlueprintScriptingHostTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BlueprintScriptingHostTest.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.scripts
+package org.onap.ccsdk.cds.controllerblueprints.core.scripts
import org.apache.commons.io.FileUtils
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts1/simple.cba.kts
index 4fffda051..4fffda051 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts1/simple.cba.kts
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts2/simple.cba.kts
index 4ba56c491..4ba56c491 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/scripts2/simple.cba.kts
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/pom.xml b/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
deleted file mode 100644
index 2f4b0472d..000000000
--- a/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ 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">
- <parent>
- <artifactId>modules</artifactId>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <version>0.5.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>blueprint-scripts</artifactId>
- <name>Controller Blueprints Scripts</name>
-
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler-embeddable</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm-host</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-runtime</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
index 3310c3824..0a7e82c2b 100644
--- a/ms/controllerblueprints/modules/pom.xml
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -31,7 +31,6 @@
<module>blueprint-core</module>
<module>resource-dict</module>
<module>db-resources</module>
- <module>blueprint-scripts</module>
<module>blueprint-validation</module>
<module>service</module>
</modules>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
index 983e2772e..27babe118 100644
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -45,10 +45,6 @@
<artifactId>blueprint-validation</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-scripts</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java
index abf774981..38216a616 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/cds/controllerblueprints/service/common/SwaggerGenerator.java
@@ -155,19 +155,16 @@ public class SwaggerGenerator {
defProperty = new StringProperty();
}
} else if (BluePrintTypes.validCollectionTypes().contains(propertyDefinition.getType())) {
- ArrayProperty arrayProperty = new ArrayProperty();
+ Optional<Property> innerType = Optional.empty();
if (propertyDefinition.getEntrySchema() != null) {
String entrySchema = propertyDefinition.getEntrySchema().getType();
if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema)) {
- Property innerType = new RefProperty("#/definitions/" + entrySchema);
- arrayProperty.setItems(innerType);
- } else {
- Property innerType = new StringProperty();
- arrayProperty.setItems(innerType);
+ innerType = Optional.of(new RefProperty("#/definitions/" + entrySchema));
}
- defProperty = arrayProperty;
}
-
+ ArrayProperty arrayProperty = new ArrayProperty();
+ arrayProperty.setItems(innerType.orElseGet(StringProperty::new));
+ defProperty = arrayProperty;
} else {
defProperty = new RefProperty("#/definitions/" + propertyDefinition.getType());
}
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 3defd74db..6ff76e944 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -246,11 +246,6 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-scripts</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>service</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
index 148d0c028..77f3ea536 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
@@ -119,7 +119,9 @@ public class ListenerServiceImpl implements ListenerService {
File targetZipFile = new File(targetLocation.toString());
try {
- targetZipFile.createNewFile();
+ if (! targetZipFile.createNewFile()) {
+ LOGGER.warn("Overwriting zip file {}", targetLocation);
+ }
} catch (IOException e) {
LOGGER.error("Could not able to create file {}", targetZipFile, e);
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java
index 7a959692a..4f31003b0 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java
@@ -21,17 +21,17 @@ import org.onap.sdc.utils.DistributionStatusEnum;
public class ComponentStatusMessage implements IComponentDoneStatusMessage, IDistributionStatusMessage {
- public String componentName;
+ private String componentName;
- public String consumerID;
+ private String consumerID;
- public String distributionID;
+ private String distributionID;
- public DistributionStatusEnum status;
+ private DistributionStatusEnum status;
- public long timeStamp;
+ private long timeStamp;
- public String artifactUrl;
+ private String artifactUrl;
@Override
public String getDistributionID() {
@@ -55,11 +55,43 @@ public class ComponentStatusMessage implements IComponentDoneStatusMessage, IDi
@Override
public String getArtifactURL() {
- return artifactUrl;
+ return getArtifactUrl();
}
@Override
public long getTimestamp() {
+ return getTimeStamp();
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ public void setConsumerID(String consumerID) {
+ this.consumerID = consumerID;
+ }
+
+ public void setDistributionID(String distributionID) {
+ this.distributionID = distributionID;
+ }
+
+ public void setStatus(DistributionStatusEnum status) {
+ this.status = status;
+ }
+
+ public long getTimeStamp() {
return timeStamp;
}
+
+ public void setTimeStamp(long timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+ public String getArtifactUrl() {
+ return artifactUrl;
+ }
+
+ public void setArtifactUrl(String artifactUrl) {
+ this.artifactUrl = artifactUrl;
+ }
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
index 446fdc068..a8e60c29a 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
@@ -93,12 +93,12 @@ public class SdcListenerStatus {
private ComponentStatusMessage buildStatusMessage(String distributionId, DistributionStatusEnum status, String url,
String componentName) {
return new BuilderUtil<>(new ComponentStatusMessage()).build(builder -> {
- builder.distributionID = distributionId;
- builder.status = status;
- builder.consumerID = consumerId;
- builder.componentName = componentName;
- builder.timeStamp = System.currentTimeMillis();
- builder.artifactUrl = url;
+ builder.setDistributionID(distributionId);
+ builder.setStatus(status);
+ builder.setConsumerID(consumerId);
+ builder.setComponentName(componentName);
+ builder.setTimeStamp(System.currentTimeMillis());
+ builder.setArtifactUrl(url);
}).create();
}