summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml9
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt88
-rwxr-xr-xms/blueprintsprocessor/modules/commons/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt22
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/outbounds/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt59
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt27
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt42
-rwxr-xr-xms/blueprintsprocessor/modules/services/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/pom.xml2
20 files changed, 246 insertions, 29 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
index faf5578c9..df66ff391 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>db-lib</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
index 5f302993a..3261489ee 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>dmaap-lib</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
index e50b1915f..c7933a7ff 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
@@ -14,14 +14,11 @@
~ 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">
<parent>
<artifactId>commons</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -45,4 +42,4 @@
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
index a459d5fe2..8df218fe9 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
@@ -16,17 +16,22 @@
package org.onap.ccsdk.cds.blueprintsprocessor.grpc.service
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.BasicAuthGrpcClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.BluePrintGrpcLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TokenAuthGrpcClientProperties
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
+import kotlin.test.assertEquals
import kotlin.test.assertNotNull
+import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [BluePrintGrpcLibConfiguration::class,
@@ -36,21 +41,92 @@ import kotlin.test.assertNotNull
"blueprintsprocessor.grpcclient.sample.host=127.0.0.1",
"blueprintsprocessor.grpcclient.sample.port=50505",
"blueprintsprocessor.grpcclient.sample.username=sampleuser",
- "blueprintsprocessor.grpcclient.sample.password=sampleuser"
+ "blueprintsprocessor.grpcclient.sample.password=sampleuser",
+ "blueprintsprocessor.grpcclient.token.type=token-auth",
+ "blueprintsprocessor.grpcclient.token.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.token.port=50505",
+ "blueprintsprocessor.grpcclient.token.username=sampleuser",
+ "blueprintsprocessor.grpcclient.token.password=sampleuser"
])
class BluePrintGrpcLibPropertyServiceTest {
@Autowired
lateinit var bluePrintGrpcLibPropertyService: BluePrintGrpcLibPropertyService
+ /**
+ * Tests the GRPC client properties with selector for basic auth.
+ */
@Test
fun testGrpcClientProperties() {
val properties = bluePrintGrpcLibPropertyService.grpcClientProperties(
- "blueprintsprocessor.grpcclient.sample") as BasicAuthGrpcClientProperties
+ "blueprintsprocessor.grpcclient.sample")
+ as BasicAuthGrpcClientProperties
assertNotNull(properties, "failed to create property bean")
- assertNotNull(properties.host, "failed to get host property in property bean")
- assertNotNull(properties.port, "failed to get host property in property bean")
- assertNotNull(properties.username, "failed to get host property in property bean")
- assertNotNull(properties.password, "failed to get host property in property bean")
+ assertNotNull(properties.host, "failed to get host property" +
+ " in property bean")
+ assertNotNull(properties.port, "failed to get host property" +
+ " in property bean")
+ assertNotNull(properties.username, "failed to get host pro" +
+ "perty in property bean")
+ assertNotNull(properties.password, "failed to get host pr" +
+ "operty in property bean")
+ }
+
+ /**
+ * Tests the GRPC client properties with JSON node for token auth.
+ */
+ @Test
+ fun testGrpcClientPropertiesWithJson() {
+ val json: String = "{\n" +
+ " \"type\" : \"token-auth\",\n" +
+ " \"host\" : \"127.0.0.1\",\n" +
+ " \"port\" : \"50505\"\n" +
+ "}"
+ val mapper = ObjectMapper()
+ val actualObj: JsonNode = mapper.readTree(json)
+ val properties = bluePrintGrpcLibPropertyService.grpcClientProperties(
+ actualObj) as TokenAuthGrpcClientProperties
+ assertNotNull(properties, "failed to create property bean")
+ assertEquals(properties.host, "127.0.0.1")
+ assertNotNull(properties.port, "50505")
+ }
+
+ /**
+ * Tests the GRPC client service with selector for basic auth.
+ */
+ @Test
+ fun testGrpcClientServiceBasic() {
+ val svc = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(
+ "sample")
+ assertTrue(svc is BasicAuthGrpcClientService)
+ }
+
+ /**
+ * Tests the GRPC client service with selector for token auth.
+ */
+ @Test
+ fun testGrpcClientServiceToken() {
+ val svc = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(
+ "token")
+ assertTrue(svc is TokenAuthGrpcClientService)
+ }
+
+ /**
+ * Tests the GRPC client service with JSON node for basic auth.
+ */
+ @Test
+ fun testGrpcClientServiceWithJson() {
+ val json: String = "{\n" +
+ " \"type\" : \"basic-auth\",\n" +
+ " \"host\" : \"127.0.0.1\",\n" +
+ " \"port\" : \"50505\",\n" +
+ " \"username\" : \"sampleuser\",\n" +
+ " \"password\" : \"samplepwd\"\n" +
+ "}"
+ val mapper = ObjectMapper()
+ val actualObj: JsonNode = mapper.readTree(json)
+ val svc = bluePrintGrpcLibPropertyService
+ .blueprintGrpcClientService(actualObj)
+ assertTrue(svc is BasicAuthGrpcClientService)
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml
index 9b52565c1..5fdfb5064 100755
--- a/ms/blueprintsprocessor/modules/commons/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>commons</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
index 93a9b793a..31feff177 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>processor-core</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
index 6809e7968..0cae94690 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>rest-lib</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
index a85dc9ad7..37a797f78 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
@@ -20,7 +20,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
-import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
@@ -63,7 +62,6 @@ import kotlin.test.assertNotNull
"blueprintsprocessor.restclient.ssl.sslKey=src/test/resources/keystore.p12",
"blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
])
-@Ignore
class BluePrintRestLibPropertyServiceTest {
@Autowired
@@ -215,5 +213,25 @@ class BluePrintRestLibPropertyServiceTest {
"eprintWebClientService")
}
+ @Test
+ fun testBlueprintWebClientServiceWithJsonNode() {
+ val json: String = "{\n" +
+ " \"type\" : \"ssl-basic-auth\",\n" +
+ " \"url\" : \"https://localhost:8443\",\n" +
+ " \"keyStoreInstance\" : \"PKCS12\",\n" +
+ " \"sslTrust\" : \"src/test/resources/keystore.p12\",\n" +
+ " \"sslTrustPassword\" : \"changeit\",\n" +
+ " \"basicAuth\" : {\n" +
+ " \"username\" : \"admin\",\n" +
+ " \"password\" : \"cds\"\n" +
+ " }\n" +
+ "}"
+ val mapper = ObjectMapper()
+ val actualObj: JsonNode = mapper.readTree(json)
+ val blueprintWebClientService = bluePrintRestLibPropertyService
+ .blueprintWebClientService(actualObj)
+ assertNotNull(blueprintWebClientService, "failed to create blu" +
+ "eprintWebClientService")
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml
index c8f6b9e42..17b630fdd 100644
--- a/ms/blueprintsprocessor/modules/inbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>inbounds</artifactId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
index 4d5857651..d5acf4f93 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>inbounds</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>resource-api</artifactId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
index d3f8b4616..340f2c618 100755
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>inbounds</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>selfservice-api</artifactId>
diff --git a/ms/blueprintsprocessor/modules/outbounds/pom.xml b/ms/blueprintsprocessor/modules/outbounds/pom.xml
index d406462db..7512990c1 100644
--- a/ms/blueprintsprocessor/modules/outbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/outbounds/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>outbounds</artifactId>
diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml
index c67c97882..3bdd13d58 100644
--- a/ms/blueprintsprocessor/modules/pom.xml
+++ b/ms/blueprintsprocessor/modules/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
index d366f740d..edfa4e3f7 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>services</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>execution-service</artifactId>
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 c5fbea80f..b404fbed6 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
@@ -21,6 +21,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts;
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
import io.mockk.every
import io.mockk.mockk
@@ -32,12 +33,16 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
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.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
@@ -47,10 +52,16 @@ import kotlin.test.assertNotNull
* Unit test cases for abstract component function.
*/
@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [ComponentFunctionScriptingService::class,
+ BluePrintScriptsServiceImpl::class,PythonExecutorProperty::class,
+ BlueprintJythonService::class])
class AbstractComponentFunctionTest {
lateinit var blueprintContext: BluePrintContext
+ @Autowired
+ lateinit var compSvc: ComponentFunctionScriptingService
+
@BeforeTest
fun init() {
blueprintContext = mockk<BluePrintContext>()
@@ -82,12 +93,56 @@ class AbstractComponentFunctionTest {
}
}
+ /**
+ * Tests the abstract script component functionality.
+ */
+ @Test
+ fun testAbstractScriptComponent() {
+ runBlocking {
+ val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
+ val samp = SampleRestconfComponent(compSvc)
+ val comp = samp as AbstractComponentFunction
+
+ comp.bluePrintRuntimeService = bluePrintRuntime
+ comp.stepName = "sample-step"
+ assertNotNull(comp, "failed to get kotlin instance")
+
+ val input = getMockedInput(bluePrintRuntime)
+ val inp = getMockedContext()
+
+ val output = comp.applyNB(input)
+
+ assertEquals(output.actionIdentifiers.actionName, "activate")
+ assertEquals(output.commonHeader.requestId, "1234")
+ assertEquals(output.stepData!!.name, "activate-restconf")
+ assertEquals(output.status.message, "success")
+ }
+ }
+
+ /**
+ * Mocked input for abstract function test.
+ */
+ private fun getMockedContext() {
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ blueprintContext.name()
+ } returns "SampleTest"
+ every {
+ blueprintContext.version()
+ } returns "SampleScriptComponent"
+ }
/**
* Mocked input for abstract function test.
*/
private fun getMockedInput(bluePrintRuntime: DefaultBluePrintRuntimeService):
ExecutionServiceInput {
+
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
val operationInputs = hashMapOf<String, JsonNode>()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] =
"activate-restconf".asJsonPrimitive()
@@ -95,6 +150,8 @@ class AbstractComponentFunctionTest {
"interfaceName".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] =
"operationName".asJsonPrimitive()
+ operationInputs["dynamic-properties"] = rootNode
+
val stepInputData = StepData().apply {
name = "activate-restconf"
@@ -125,4 +182,6 @@ class AbstractComponentFunctionTest {
return executionServiceInput
}
+
}
+
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
index dd417e56d..ae7b7b2ef 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
@@ -28,8 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
import kotlin.test.BeforeTest
+import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [BlueprintJythonService::class, PythonExecutorProperty::class])
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
index e09cbfb66..000d8c09b 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
@@ -23,6 +23,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
+
import org.slf4j.LoggerFactory
open class SampleComponent : AbstractComponentFunction() {
@@ -37,12 +40,34 @@ open class SampleComponent : AbstractComponentFunction() {
}
}
-open class SampleScriptComponent : AbstractComponentFunction() {
+open class SampleRestconfComponent (private var componentFunctionScriptingService: ComponentFunctionScriptingService)
+ : AbstractComponentFunction() {
val log = LoggerFactory.getLogger(SampleScriptComponent::class.java)!!
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ var scriptComponent: AbstractScriptComponentFunction
+ scriptComponent = componentFunctionScriptingService
+ .scriptInstance<AbstractScriptComponentFunction>(this,
+ "internal",
+ "org.onap.ccsdk.cds.blueprintsprocessor.services" +
+ ".execution.scripts.SampleTest",
+ mutableListOf())
+ scriptComponent.executeScript(executionServiceInput)
+ }
+
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ }
+}
+
+open class SampleScriptComponent : AbstractScriptComponentFunction() {
+
+ val log = LoggerFactory.getLogger(SampleScriptComponent::class.java)!!
+
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt
new file mode 100644
index 000000000..6a95e29e7
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt
@@ -0,0 +1,42 @@
+package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - CDS
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.slf4j.LoggerFactory
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+open class SampleTest : AbstractScriptComponentFunction() {
+
+ val log = LoggerFactory.getLogger(SampleTest::class.java)!!
+
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ val isPresent = checkDynamicProperties("type")
+ assertTrue(isPresent)
+ val prop = getDynamicProperties("ip-address").toString()
+ assertEquals(prop, "\"0.0.0.0\"")
+ }
+
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml
index 751ad94d4..d2f1219e9 100755
--- a/ms/blueprintsprocessor/modules/services/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>services</artifactId>
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
index c48ff250f..d7f87aeff 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>services</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>