2 * Copyright © 2019 IBM.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.ccsdk.cds.controllerblueprints.core.dsl
20 import kotlin.test.assertNotNull
22 class BluePrintDSLTest {
24 fun testServiceTemplate() {
25 val serviceTemplate = serviceTemplate("sample-bp", "1.0.0",
26 "brindasanth@onap.com", "sample") {
27 metadata("release", "1806")
29 nodeTemplateOperation(nodeTemplateName = "activate", type = "sample-node-type", interfaceName = "RestconfExecutor",
30 operationName = "process", description = "sample activation") {
32 property("json-content", """{ "name" : "cds"}""")
33 property("array-content", """["controller", "blueprints"]""")
34 property("int-value", 234)
35 property("boolean-value", true)
36 property("string-value", "sample")
37 property("input-expression", getInput("key-1"))
38 property("self-property-expression", getProperty("key-1"))
39 property("self-attribute-expression", getAttribute("key-1"))
40 property("self-artifact-expression", getArtifact("key-1"))
41 property("other-artifact-expression", getNodeTemplateArtifact("node-1", "key-1"))
47 assertNotNull(serviceTemplate.topologyTemplate, "failed to get topology template")
48 assertNotNull(serviceTemplate.topologyTemplate?.nodeTemplates, "failed to get nodeTypes")
49 assertNotNull(serviceTemplate.topologyTemplate?.nodeTemplates!!["activate"], "failed to get nodeTypes(activate)")
50 //println(JacksonUtils.getJson(serviceTemplate, true))