summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/execution-service/src/test
diff options
context:
space:
mode:
authorBrinda Santh <bs2796@att.com>2019-12-31 10:53:59 -0500
committerBrinda Santh <bs2796@att.com>2019-12-31 10:53:59 -0500
commitba75d2fad2b0111a510f4ee4cc87e658fb32ac4b (patch)
tree92c50b5bea79bb6c424aab6b0ac2e805a9e36e07 /ms/blueprintsprocessor/modules/services/execution-service/src/test
parent1fdaf4953daf15970afe6ee10491dfa2d0a76753 (diff)
Flexible DSL Types and Templates definition.
Easy search definitions Types and Templates inside ServiceTemplate DSL builder. Unit test modifications to support this change. Issue-ID: CCSDK-1054 Signed-off-by: Brinda Santh <bs2796@att.com> Change-Id: Ie944ff5f75f80c852555306e1a4e0fa7f5b803d7
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/execution-service/src/test')
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt52
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSLTest.kt62
2 files changed, 96 insertions, 18 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
index 2091e0366..0125cd8d9 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
@@ -36,6 +36,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
@@ -54,26 +55,41 @@ class ComponentRemoteScriptExecutorTest {
@Test
fun testNodeTemplateComponentRemoteScriptExecutor() {
- val nodeTemplate = BluePrintTypes.nodeTemplateComponentRemoteScriptExecutor(
- "remote-sample",
- "This is sample node template"
- ) {
- definedOperation(" Sample Operation") {
- implementation(180, "SELF")
- inputs {
- selector("remote-script-executor")
- blueprintName("sample")
- blueprintVersion("1.0.0")
- blueprintAction("sample-action")
- timeout(120)
- requestData("""{"key" :"value"}""")
- }
- outputs {
- status("success")
+ val serviceTemplate = serviceTemplate("remote-script-dsl", "1.0.0", "xx@xx.com", "remote-script-ds") {
+ topologyTemplate {
+ nodeTemplateComponentRemoteScriptExecutor(
+ "remote-sample",
+ "This is sample node template"
+ ) {
+ definedOperation(" Sample Operation") {
+ implementation(180, "SELF")
+ inputs {
+ selector("remote-script-executor")
+ blueprintName("sample")
+ blueprintVersion("1.0.0")
+ blueprintAction("sample-action")
+ timeout(120)
+ requestData("""{"key" :"value"}""")
+ }
+ outputs {
+ status("success")
+ }
+ }
}
}
+ nodeTypeComponentRemoteScriptExecutor()
}
- assertNotNull(nodeTemplate, "failed to generate nodeTemplate Component Remote Script Executor")
+ // println(serviceTemplate.asJsonString(true))
+ assertNotNull(serviceTemplate, "failed to service template")
+ assertNotNull(serviceTemplate.nodeTypes, "failed to service template node Types")
+ assertNotNull(
+ serviceTemplate.nodeTypes!!["component-remote-script-executor"],
+ "failed to service template nodeType(component-remote-script-executor)"
+ )
+ assertNotNull(
+ serviceTemplate.topologyTemplate?.nodeTemplates?.get("remote-sample"),
+ "failed to nodeTemplate(remote-sample)"
+ )
}
@Test
@@ -95,7 +111,7 @@ class ComponentRemoteScriptExecutorTest {
val mockStreamingRemoteExecutionService = mockk<StreamingRemoteExecutionService<
org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput,
- org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput>>()
+ ExecutionServiceOutput>>()
coEvery {
mockStreamingRemoteExecutionService.sendNonInteractive(
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSLTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSLTest.kt
new file mode 100644
index 000000000..6f957e666
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSLTest.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2018-2019 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.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.services.execution
+
+import org.junit.Test
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
+import kotlin.test.assertNotNull
+
+class ComponentScriptExecutorDSLTest {
+
+ @Test
+ fun nodeTemplateComponentScriptExecutor() {
+
+ val serviceTemplate = serviceTemplate("remote-script-dsl", "1.0.0", "xx@xx.com", "remote-script-ds") {
+ topologyTemplate {
+ nodeTemplateComponentScriptExecutor(
+ "script-sample",
+ "This is sample node template"
+ ) {
+ definedOperation(" Sample Operation") {
+ implementation(180, "SELF")
+ inputs {
+ type("kotlin")
+ scriptClassReference("cba.sample.Processor")
+ dynamicProperties("*dynamic-inputs")
+ }
+ outputs {
+ status("success")
+ }
+ }
+ }
+ }
+ nodeTypeComponentScriptExecutor()
+ }
+
+ // println(serviceTemplate.asJsonString(true))
+ assertNotNull(serviceTemplate, "failed to service template")
+ assertNotNull(serviceTemplate.nodeTypes, "failed to service template node Types")
+ assertNotNull(
+ serviceTemplate.nodeTypes!!["component-script-executor"],
+ "failed to service template nodeType(component-script-executor)"
+ )
+ assertNotNull(
+ serviceTemplate.topologyTemplate?.nodeTemplates?.get("script-sample"),
+ "failed to nodeTemplate(script-sample)"
+ )
+ }
+}