From bcc6c4dfe9db06e0dab22472b11a4939255091e5 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Fri, 17 May 2019 10:07:14 -0400 Subject: Add cli test blueprints Change-Id: Ieab385f5e4ae60cca3d86f22c4304e4867e6fa96 Issue-ID: CCSDK-1335 Signed-off-by: Brinda Santh --- .../Definitions/capability-cli-blueprint.json | 83 ++++++++++++++++++++++ .../Scripts/kotlin/CapabilityCli.cba.kts | 34 +++++++++ .../capability_cli/TOSCA-Metadata/TOSCA.meta | 5 ++ 3 files changed, 122 insertions(+) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.cba.kts create mode 100644 components/model-catalog/blueprint-model/test-blueprint/capability_cli/TOSCA-Metadata/TOSCA.meta (limited to 'components') diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json new file mode 100644 index 000000000..c66bb6ef2 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json @@ -0,0 +1,83 @@ +{ + "tosca_definitions_version": "controller_blueprint_1_0_0", + "metadata": { + "template_author": "Brinda Santh Muthuramalingam", + "author-email": "brindasanth@in.ibm.com", + "user-groups": "ADMIN, OPERATION", + "template_name": "capability-cli", + "template_version": "1.0.0", + "template_tags": "brinda, tosca" + }, + "imports": [ + { + "file": "Definitions/data_types.json" + }, + { + "file": "Definitions/relationship_types.json" + }, + { + "file": "Definitions/artifact_types.json" + }, + { + "file": "Definitions/node_types.json" + }, + { + "file": "Definitions/policy_types.json" + } + ], + "dsl_definitions": { + "config-deploy-properties": { + "resolution-key": { + "get_input": "resolution-key" + } + } + }, + "topology_template": { + "workflows": { + "check": { + "steps": { + "activate-process": { + "description": "Check CLI", + "target": "check", + "activities": [ + { + "call_operation": "ComponentCliExecutor.process" + } + ] + } + } + } + }, + "node_templates": { + "check": { + "type": "component-cli-executor", + "interfaces": { + "ComponentCliExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "script-type": "kotlin", + "script-class-reference": "InternalSimpleCli_cba$TestCliScriptFunction", + "instance-dependencies": [] + }, + "outputs": { + "response-data": "", + "status": "success" + } + } + } + } + }, + "artifacts": { + "command-template": { + "type": "artifact-template-velocity", + "file": "Templates/check-command-template.vtl" + } + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.cba.kts new file mode 100644 index 000000000..e22fd7ef0 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCli.cba.kts @@ -0,0 +1,34 @@ +/* + * 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. + */ + + + +open class Check : CliComponentFunction() { + + private val log = LoggerFactory.getLogger(CliComponentFunction::class.java)!! + + override fun getName(): String { + return "SimpleCliConfigure" + } + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + log.info("Executing process") + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + log.info("Executing Recovery") + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..001889672 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,5 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Brinda Santh +Entry-Definitions: Definitions/capability-cli-blueprint.json +Template-Tags: capability-cli-blueprint -- cgit 1.2.3-korg