summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds/designer-api/src/test')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt223
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt27
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt123
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt49
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt126
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt138
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt53
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt110
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt99
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt66
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt39
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties41
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-resource-assignment.json62
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-template.json351
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhanced-template.json327
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml39
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/model_type/data_type/datatype-property.json27
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/automap.json14
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/default_definition.json17
19 files changed, 1931 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
new file mode 100644
index 000000000..877584ed6
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
@@ -0,0 +1,223 @@
+/*
+ * Copyright © 2019 Bell Canada Intellectual Property.
+ * Modifications 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.designer.api
+
+import kotlinx.coroutines.reactive.awaitSingle
+import kotlinx.coroutines.runBlocking
+import org.json.JSONException
+import org.junit.After
+import org.junit.Before
+import org.junit.FixMethodOrder
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.MethodSorters
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
+import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.core.io.ByteArrayResource
+import org.springframework.http.HttpMethod
+import org.springframework.http.HttpStatus
+import org.springframework.http.client.MultipartBodyBuilder
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+import org.springframework.test.web.reactive.server.WebTestClient
+import org.springframework.test.web.reactive.server.returnResult
+import org.springframework.util.Base64Utils
+import org.springframework.web.reactive.function.BodyInserters
+import java.io.File
+import java.nio.charset.StandardCharsets.UTF_8
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+import kotlin.test.assertTrue
+
+/**
+ * BlueprintModelControllerTest Purpose: Integration test at API level
+ *
+ * @author Vinal Patel
+ * @version 1.0
+ */
+
+@RunWith(SpringRunner::class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+class BlueprintModelControllerTest {
+
+ private val log = LoggerFactory.getLogger(BlueprintModelControllerTest::class.java)!!
+
+ companion object {
+ private var bp: BlueprintModelSearch? = null
+ }
+
+ @Autowired
+ lateinit var webTestClient: WebTestClient
+
+ private var bluePrintLoadConfiguration: BluePrintLoadConfiguration? = null
+
+ private val blueprintDir = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ private var zipBlueprintFileName: String? = null
+
+ private var testZipFile: File? = null
+
+
+ @Before
+ fun setUp() {
+ assertNotNull(webTestClient, " Failed to create WebTestClient")
+
+ bluePrintLoadConfiguration = BluePrintLoadConfiguration().apply {
+ blueprintArchivePath = "./target/blueprints/archive"
+ blueprintWorkingPath = "./target/blueprints/work"
+ blueprintDeployPath = "./target/blueprints/deploy"
+ }
+ zipBlueprintFileName = normalizedPathName(bluePrintLoadConfiguration!!.blueprintArchivePath, "test.zip")
+
+ val archiveDir = normalizedFile(bluePrintLoadConfiguration!!.blueprintArchivePath).reCreateDirs()
+ assertTrue(archiveDir.exists(), "failed to create archiveDir(${archiveDir.absolutePath}")
+
+ val blueprintFile = normalizedFile(blueprintDir)
+ testZipFile = blueprintFile.compress(zipBlueprintFileName!!)
+ assertNotNull(testZipFile, "test zip is null")
+ assertTrue(testZipFile!!.exists(), "Failed to create blueprint test zip(${testZipFile!!.absolutePath}")
+ }
+
+ @After
+ fun tearDown() {
+ deleteDir(bluePrintLoadConfiguration!!.blueprintArchivePath)
+ deleteDir(bluePrintLoadConfiguration!!.blueprintWorkingPath)
+ }
+
+ @Test
+ fun test01_saveBluePrint() {
+ bp = runBlocking {
+ val body = MultipartBodyBuilder().apply {
+ part("file", object : ByteArrayResource(testZipFile!!.readBytes()) {
+ override fun getFilename(): String {
+ return "test.zip"
+ }
+ })
+ }.build()
+
+ val saveBP = webTestClient
+ .post()
+ .uri("/api/v1/blueprint-model")
+ .body(BodyInserters.fromMultipartData(body))
+ .exchange()
+ .expectStatus().isOk
+ .returnResult<BlueprintModelSearch>()
+ .responseBody
+ .awaitSingle()
+
+ assertNotNull(saveBP, "failed to get response")
+ assertEquals("baseconfiguration", saveBP.artifactName, "mismatch artifact name")
+ assertEquals("1.0.0", saveBP.artifactVersion, "mismatch artifact version")
+ assertEquals("N", saveBP.published, "mismatch publish")
+ saveBP
+ }
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test02_getBluePrintByNameAndVersion() {
+ webTestClient(HttpMethod.GET, null,
+ "/api/v1/blueprint-model/by-name/${bp!!.artifactName}/version/${bp!!.artifactVersion}",
+ HttpStatus.OK, false)
+ }
+
+
+ @Test
+ @Throws(JSONException::class)
+ fun test03_getBlueprintModel() {
+ webTestClient(HttpMethod.GET, null,
+ "/api/v1/blueprint-model/${bp!!.id}",
+ HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test04_getAllBlueprintModel() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model", HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test05_downloadBluePrint() {
+ webTestClient(HttpMethod.GET, null,
+ "/api/v1/blueprint-model/download/${bp!!.id}",
+ HttpStatus.OK, false)
+ }
+
+ @Test
+ fun test06_enrichBlueprintModel() {
+ }
+
+ @Test
+ fun test07_publishBlueprintModel() {
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test08_searchBlueprintModels() {
+ webTestClient(HttpMethod.GET, null,
+ "/api/v1/blueprint-model/search/${bp!!.artifactName}",
+ HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test09_downloadBlueprintByNameAndVersion() {
+ webTestClient(HttpMethod.GET, null,
+ "/api/v1/blueprint-model/download/by-name/${bp!!.artifactName}/version/${bp!!.artifactVersion}",
+ HttpStatus.OK, false)
+ }
+
+ @Test
+ fun test10_deleteBluePrint() {
+ webTestClient.delete().uri("/api/v1/blueprint-model/${bp!!.id}")
+ .header("Authorization", "Basic " + Base64Utils
+ .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
+ .exchange()
+ .expectStatus().is2xxSuccessful
+ }
+
+ @Throws(JSONException::class)
+ private fun webTestClient(requestMethod: HttpMethod, body: BodyInserters.MultipartInserter?, uri: String,
+ expectedResponceStatus: HttpStatus, setParam: Boolean) {
+
+ log.info("Requesting($uri): Method(${requestMethod.name})")
+
+ webTestClient.method(requestMethod).uri(uri)
+ .header("Authorization", "Basic " + Base64Utils
+ .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
+ .body(body)
+ .exchange()
+ .expectStatus().isEqualTo(expectedResponceStatus)
+ .expectBody()
+ .returnResult().responseBody!!
+
+ }
+
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
new file mode 100644
index 000000000..03e016b8e
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
@@ -0,0 +1,27 @@
+/*
+ * 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.designer.api
+
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
+ "org.onap.ccsdk.cds.blueprintsprocessor"])
+@EnableAutoConfiguration
+open class DesignerApiTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
new file mode 100644
index 000000000..6fe7097e5
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
@@ -0,0 +1,123 @@
+/*
+ * 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.designer.api
+
+import org.junit.Assert
+import org.junit.FixMethodOrder
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.MethodSorters
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.annotation.Commit
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+class ModelTypeControllerTest {
+
+ private val log = LoggerFactory.getLogger(ModelTypeControllerTest::class.java)!!
+
+ @Autowired
+ internal var modelTypeController: ModelTypeController? = null
+
+ private var modelName = "test-datatype"
+
+ @Test
+ @Commit
+ @Throws(Exception::class)
+ fun test01SaveModelType() {
+ log.info("**************** test01SaveModelType ********************")
+
+ val content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json")
+ var modelType = ModelType()
+ modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ modelType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT
+ modelType.description = "Definition for Sample Datatype "
+ modelType.definition = JacksonUtils.jsonNode(content)
+ modelType.modelName = modelName
+ modelType.version = "1.0.0"
+ modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.updatedBy = "xxxxxx@xxx.com"
+ modelType = modelTypeController!!.saveModelType(modelType)
+ log.info("Saved Mode {}", modelType.toString())
+ Assert.assertNotNull("Failed to get Saved ModelType", modelType)
+ Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.modelName)
+
+ val dbModelType = modelTypeController!!.getModelTypeByName(modelType.modelName)
+ Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType!!.modelName + ")",
+ dbModelType)
+
+ // Model Update
+ modelType.updatedBy = "bs2796@xxx.com"
+ modelType = modelTypeController!!.saveModelType(modelType)
+ Assert.assertNotNull("Failed to get Saved ModelType", modelType)
+ Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.updatedBy)
+
+ }
+
+ @Test
+ @Throws(Exception::class)
+ fun test02SearchModelTypes() {
+ log.info("*********************** test02SearchModelTypes ***************************")
+
+ val tags = "test-datatype"
+
+ val dbModelTypes = modelTypeController!!.searchModelTypes(tags)
+ Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes)
+ Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.isNotEmpty())
+
+ }
+
+ @Test
+ @Throws(Exception::class)
+ fun test03GetModelType() {
+ log.info("************************* test03GetModelType *********************************")
+ val dbModelType = modelTypeController!!.getModelTypeByName(modelName)
+ Assert.assertNotNull("Failed to get response for api call getModelByName $modelName", dbModelType)
+ Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbModelType!!.modelName)
+
+ val dbDatatypeModelTypes = modelTypeController!!.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes)
+ Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.isNotEmpty())
+ }
+
+ @Test
+ @Commit
+ @Throws(Exception::class)
+ fun test04DeleteModelType() {
+ log.info(
+ "************************ test03DeleteModelType ***********************")
+ val dbResourceMapping = modelTypeController!!.getModelTypeByName(modelName)
+ Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping)
+ Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping!!.modelName)
+
+ modelTypeController!!.deleteModelTypeByName(dbResourceMapping.modelName)
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt
new file mode 100644
index 000000000..893622308
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt
@@ -0,0 +1,49 @@
+/*
+ * 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.designer.api
+
+import org.junit.FixMethodOrder
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.MethodSorters
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+import kotlin.test.assertNotNull
+
+@RunWith(SpringRunner::class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+class ResourceDictionaryControllerTest {
+
+ @Autowired
+ lateinit var resourceDictionaryController: ResourceDictionaryController
+
+ @Test
+ fun testResourceDictionaryControllerPresence() {
+ assertNotNull(resourceDictionaryController, "failed to initialise ResourceDictionaryController")
+ }
+
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt
new file mode 100644
index 000000000..974a3b9b7
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt
@@ -0,0 +1,126 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 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.designer.api.enhancer
+
+import kotlinx.coroutines.runBlocking
+import org.junit.Assert
+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.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.ModelTypeLoadService
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.ResourceDictionaryLoadService
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
+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
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+class BluePrintEnhancerServiceImplTest {
+
+ @Autowired
+ lateinit var modelTypeLoadService: ModelTypeLoadService
+
+ @Autowired
+ lateinit var resourceDictionaryLoadService: ResourceDictionaryLoadService
+
+ @Autowired
+ lateinit var bluePrintEnhancerService: BluePrintEnhancerService
+
+ @Autowired
+ lateinit var bluePrintValidatorService: BluePrintValidatorService
+
+
+ @Test
+ @Throws(Exception::class)
+ fun testEnhancementAndValidation() {
+
+ runBlocking {
+ modelTypeLoadService.loadPathModelType("./../../../../../components/model-catalog/definition-type/starter-type")
+
+ val dictPaths: MutableList<String> = arrayListOf()
+ dictPaths.add("./../../../../../components/model-catalog/resource-dictionary/starter-dictionary")
+ dictPaths.add("./../../../../../components/model-catalog/resource-dictionary/test-dictionary")
+ resourceDictionaryLoadService.loadPathsResourceDictionary(dictPaths)
+
+ testBaseConfigEnhancementAndValidation()
+ testVFWEnhancementAndValidation()
+ testGoldenEnhancementAndValidation()
+ testRemoteScriptsEnhancementAndValidation()
+ testCapabilityCliEnhancementAndValidation()
+ }
+ }
+
+ fun testBaseConfigEnhancementAndValidation() {
+ val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ testComponentInvokeEnhancementAndValidation(basePath, "base-enhance")
+ }
+
+ fun testVFWEnhancementAndValidation() {
+ val basePath = "./../../../../../components/model-catalog/blueprint-model/service-blueprint/vFW"
+ testComponentInvokeEnhancementAndValidation(basePath, "vFW-enhance")
+ }
+
+ fun testGoldenEnhancementAndValidation() {
+ val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/golden"
+ testComponentInvokeEnhancementAndValidation(basePath, "golden-enhance")
+ }
+
+ fun testRemoteScriptsEnhancementAndValidation() {
+ val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts"
+ testComponentInvokeEnhancementAndValidation(basePath, "remote_scripts-enhance")
+
+ }
+
+ fun testCapabilityCliEnhancementAndValidation() {
+ val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/capability_cli"
+ testComponentInvokeEnhancementAndValidation(basePath, "capability_cli-enhance")
+ }
+
+ private fun testComponentInvokeEnhancementAndValidation(basePath: String, targetDirName: String) {
+ runBlocking {
+ val targetPath = normalizedPathName("target/blueprints/enrichment", targetDirName)
+
+ deleteDir(targetPath)
+
+ val bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath)
+ Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext)
+
+ // Validate the Generated BluePrints
+ val valid = bluePrintValidatorService.validateBluePrints(targetPath)
+ Assert.assertTrue("blueprint($basePath) validation failed ", valid)
+
+ // Enable this to get the enhanced zip file
+// val compressFile = normalizedFile("target/blueprints/enrichment", "$targetDirName.zip")
+// normalizedFile(targetPath).compress(compressFile)
+
+ deleteDir(targetPath)
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
new file mode 100644
index 000000000..00e78d247
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
@@ -0,0 +1,138 @@
+/*
+ * 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.designer.api.handler
+
+import kotlinx.coroutines.runBlocking
+import org.junit.Assert
+import org.junit.FixMethodOrder
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.MethodSorters
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.annotation.Commit
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+class ModelTypeServiceTest {
+ @Autowired
+ private val modelTypeHandler: ModelTypeHandler? = null
+
+ internal var modelName = "test-datatype"
+
+ private val log = LoggerFactory.getLogger(ModelTypeServiceTest::class.java)
+
+ @Test
+ @Commit
+ @Throws(Exception::class)
+ fun test01SaveModelType() {
+ runBlocking {
+ log.info("**************** test01SaveModelType ********************")
+
+ val content = JacksonUtils.getClassPathFileContent("model_type/data_type/datatype-property.json")
+ var modelType = ModelType()
+ modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ modelType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT
+ modelType.description = "Definition for Sample Datatype "
+ modelType.definition = JacksonUtils.jsonNode(content)
+ modelType.modelName = modelName
+ modelType.version = "1.0.0"
+ modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.updatedBy = "xxxxxx@xxx.com"
+ modelType = modelTypeHandler!!.saveModel(modelType)
+ log.info("Saved Mode {}", modelType.toString())
+ Assert.assertNotNull("Failed to get Saved ModelType", modelType)
+ Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.modelName)
+
+ val dbModelType = modelTypeHandler.getModelTypeByName(modelType.modelName)
+ Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType!!.modelName + ")",
+ dbModelType)
+
+ // Model Update
+ modelType.updatedBy = "bs2796@xxx.com"
+ modelType = modelTypeHandler.saveModel(modelType)
+ Assert.assertNotNull("Failed to get Saved ModelType", modelType)
+ Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.updatedBy)
+ }
+
+ }
+
+ @Test
+ @Throws(Exception::class)
+ fun test02SearchModelTypes() {
+ runBlocking {
+ log.info("*********************** test02SearchModelTypes ***************************")
+
+ val tags = "test-datatype"
+
+ val dbModelTypes = modelTypeHandler!!.searchModelTypes(tags)
+ Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes)
+ Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.size > 0)
+ }
+
+ }
+
+ @Test
+ @Throws(Exception::class)
+ fun test03GetModelType() {
+ runBlocking {
+ log.info("************************* test03GetModelType *********************************")
+ val dbModelType = modelTypeHandler!!.getModelTypeByName(modelName)
+ Assert.assertNotNull("Failed to get response for api call getModelByName ", dbModelType)
+ Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbModelType!!.modelName)
+
+ val dbDatatypeModelTypes = modelTypeHandler.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes)
+ Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.size > 0)
+
+ val dbModelTypeByDerivedFroms = modelTypeHandler.getModelTypeByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)
+ Assert.assertNotNull("Failed to find getModelTypeByDerivedFrom by tags", dbModelTypeByDerivedFroms)
+ Assert.assertTrue("Failed to find getModelTypeByDerivedFrom by count", dbModelTypeByDerivedFroms.size > 0)
+ }
+
+ }
+
+ @Test
+ @Throws(Exception::class)
+ fun test04DeleteModelType() {
+ runBlocking {
+ log.info(
+ "************************ test03DeleteModelType ***********************")
+ val dbResourceMapping = modelTypeHandler!!.getModelTypeByName(modelName)
+ Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping)
+ Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping!!.modelName)
+
+ modelTypeHandler.deleteByModelName(dbResourceMapping.modelName)
+ }
+ }
+
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
new file mode 100644
index 000000000..3165a6e2f
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
@@ -0,0 +1,53 @@
+/*
+ * 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.designer.api.mock
+
+import org.apache.commons.io.FilenameUtils
+import org.slf4j.LoggerFactory
+import org.springframework.core.io.buffer.DataBuffer
+import org.springframework.http.HttpHeaders
+import org.springframework.http.codec.multipart.FilePart
+import org.springframework.util.FileCopyUtils
+import reactor.core.publisher.Flux
+import reactor.core.publisher.Mono
+import java.io.File
+import java.nio.file.Path
+
+class MockFilePart(private val fileName: String) : FilePart {
+ val log = LoggerFactory.getLogger(MockFilePart::class.java)!!
+ override fun content(): Flux<DataBuffer> {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun headers(): HttpHeaders {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun filename(): String {
+ return FilenameUtils.getName(fileName)
+ }
+
+ override fun name(): String {
+ return FilenameUtils.getBaseName(fileName)
+ }
+
+ override fun transferTo(path: Path): Mono<Void> {
+ log.info("Copying file($fileName to ${path}")
+ FileCopyUtils.copy(File(fileName), path.toFile())
+ return Mono.empty()
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
new file mode 100644
index 000000000..55bc1e4af
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
@@ -0,0 +1,110 @@
+/*
+ * 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.designer.api.repository
+
+import org.junit.Assert
+import org.junit.FixMethodOrder
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.MethodSorters
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.annotation.Commit
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+import java.nio.charset.Charset
+import java.util.*
+
+/**
+ * ModelTypeReactRepositoryTest.
+ *
+ * @author Brinda Santh
+ */
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+class ModelTypeReactRepositoryTest {
+
+ @Autowired
+ private val modelTypeReactRepository: ModelTypeReactRepository? = null
+
+ internal var modelName = "test-datatype"
+
+ @Test
+ @Commit
+ fun test01Save() {
+ val content = normalizedFile("./src/test/resources/model_type/data_type/datatype-property.json")
+ .readText(Charset.defaultCharset())
+ val modelType = ModelType()
+ modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ modelType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT
+ modelType.description = "Definition for Sample Datatype "
+ modelType.definition = JacksonUtils.jsonNode(content)
+ modelType.modelName = modelName
+ modelType.version = "1.0.0"
+ modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.updatedBy = "xxxxxx@xxx.com"
+
+ val dbModelType = modelTypeReactRepository!!.save(modelType).block()
+ Assert.assertNotNull("Failed to get Saved ModelType", dbModelType)
+ }
+
+ @Test
+ fun test02Finds() {
+ val dbFindByModelName = modelTypeReactRepository!!.findByModelName(modelName).block()
+ Assert.assertNotNull("Failed to findByModelName ", dbFindByModelName)
+
+ val dbFindByDefinitionType = modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block()
+ Assert.assertNotNull("Failed to findByDefinitionType ", dbFindByDefinitionType)
+ Assert.assertTrue("Failed to findByDefinitionType count", dbFindByDefinitionType!!.size > 0)
+
+ val dbFindByDerivedFrom = modelTypeReactRepository.findByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT).collectList().block()
+ Assert.assertNotNull("Failed to find findByDerivedFrom", dbFindByDerivedFrom)
+ Assert.assertTrue("Failed to find findByDerivedFrom by count", dbFindByDerivedFrom!!.size > 0)
+
+ val dbFindByModelNameIn = modelTypeReactRepository.findByModelNameIn(Arrays.asList(modelName)).collectList().block()
+ Assert.assertNotNull("Failed to findByModelNameIn ", dbFindByModelNameIn)
+ Assert.assertTrue("Failed to findByModelNameIn by count", dbFindByModelNameIn!!.size > 0)
+
+ val dbFindByDefinitionTypeIn = modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block()
+ Assert.assertNotNull("Failed to findByDefinitionTypeIn", dbFindByDefinitionTypeIn)
+ Assert.assertTrue("Failed to findByDefinitionTypeIn by count", dbFindByDefinitionTypeIn!!.size > 0)
+
+ val dbFindByDerivedFromIn = modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block()
+ Assert.assertNotNull("Failed to find findByDerivedFromIn", dbFindByDerivedFromIn)
+ Assert.assertTrue("Failed to find findByDerivedFromIn by count", dbFindByDerivedFromIn!!.size > 0)
+ }
+
+ @Test
+ @Commit
+ fun test03Delete() {
+ modelTypeReactRepository!!.deleteByModelName(modelName).block()
+ }
+
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt
new file mode 100644
index 000000000..70e1b8ed2
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt
@@ -0,0 +1,99 @@
+/*
+ * 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.designer.api.repository
+
+import org.junit.Assert
+import org.junit.FixMethodOrder
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.MethodSorters
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.annotation.Commit
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+import org.springframework.transaction.annotation.Transactional
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+class ResourceDictionaryReactRepositoryTest {
+
+ private val sourceName = "test-source"
+
+ @Autowired
+ lateinit var resourceDictionaryRepository: ResourceDictionaryRepository
+
+ @Test
+ @Commit
+ fun test01Save() {
+ val resourceDefinition = JacksonUtils
+ .readValueFromFile("./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json",
+ ResourceDefinition::class.java)
+ Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition)
+ resourceDefinition!!.name = sourceName
+
+ val resourceDictionary = transformResourceDictionary(resourceDefinition)
+ val dbResourceDictionary = resourceDictionaryRepository.save(resourceDictionary)
+ Assert.assertNotNull("Failed to save ResourceDictionary", dbResourceDictionary)
+ }
+
+ @Test
+ fun test02FindByNameReact() {
+ val dbResourceDictionary = resourceDictionaryRepository.findByName(sourceName)
+ Assert.assertNotNull("Failed to query React Resource Dictionary by Name", dbResourceDictionary)
+ }
+
+ @Test
+ fun test03FindByNameInReact() {
+ val dbResourceDictionaries = resourceDictionaryRepository.findByNameIn(arrayListOf(sourceName))
+ Assert.assertNotNull("Failed to query React Resource Dictionary by Names", dbResourceDictionaries)
+ }
+
+ @Test
+ fun test04FindByTagsContainingIgnoreCaseReact() {
+ val dbTagsResourceDictionaries = resourceDictionaryRepository.findByTagsContainingIgnoreCase(sourceName)
+ Assert.assertNotNull("Failed to query React Resource Dictionary by Tags", dbTagsResourceDictionaries)
+ }
+
+ @Test
+ @Transactional
+ @Commit
+ fun test05Delete() {
+ resourceDictionaryRepository.deleteByName(sourceName)
+ }
+
+ private fun transformResourceDictionary(resourceDefinition: ResourceDefinition): ResourceDictionary {
+ val resourceDictionary = ResourceDictionary()
+ resourceDictionary.name = resourceDefinition.name
+ resourceDictionary.dataType = resourceDefinition.property.type
+ resourceDictionary.description = resourceDefinition.property.description!!
+ resourceDictionary.tags = resourceDefinition.tags!!
+ resourceDictionary.updatedBy = resourceDefinition.updatedBy
+ resourceDictionary.definition = resourceDefinition
+ return resourceDictionary
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt
new file mode 100644
index 000000000..e34238eb9
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt
@@ -0,0 +1,66 @@
+/*
+ * 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.designer.api.utils
+
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Test
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.mock.MockFilePart
+import org.onap.ccsdk.cds.controllerblueprints.core.*
+import java.nio.file.Paths
+import java.util.*
+import kotlin.test.assertTrue
+
+class BluePrintEnhancerUtilsTest {
+
+ private val blueprintDir = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ private val blueprintArchivePath: String = "./target/blueprints/archive"
+ private val blueprintEnrichmentPath: String = "./target/blueprints/enrichment"
+ private var zipBlueprintFileName = normalizedPathName(blueprintArchivePath, "test.zip")
+
+ @Before
+ fun setUp() {
+ val archiveDir = normalizedFile(blueprintArchivePath).reCreateDirs()
+ assertTrue(archiveDir.exists(), "failed to create archiveDir(${archiveDir.absolutePath}")
+ val enhancerDir = normalizedFile(blueprintEnrichmentPath).reCreateDirs()
+ assertTrue(enhancerDir.exists(), "failed to create enhancerDir(${enhancerDir.absolutePath}")
+ val blueprintFile = Paths.get(blueprintDir).toFile().normalize()
+ val testZipFile = blueprintFile.compress(zipBlueprintFileName)
+ assertTrue(testZipFile.exists(), "Failed to create blueprint test zip(${testZipFile.absolutePath}")
+ }
+
+ @After
+ fun tearDown() {
+ deleteDir(blueprintArchivePath)
+ deleteDir(blueprintEnrichmentPath)
+ }
+
+ @Test
+ fun testFilePartCompressionNDeCompression() {
+ val filePart = MockFilePart(zipBlueprintFileName)
+
+ runBlocking {
+ val enhanceId = UUID.randomUUID().toString()
+ val blueprintArchiveLocation = normalizedPathName(blueprintArchivePath, enhanceId)
+ val blueprintEnrichmentLocation = normalizedPathName(blueprintEnrichmentPath, enhanceId)
+ BluePrintEnhancerUtils.decompressFilePart(filePart, blueprintArchiveLocation, blueprintEnrichmentLocation)
+ BluePrintEnhancerUtils.compressToFilePart(blueprintEnrichmentLocation, blueprintArchiveLocation)
+ }
+ }
+}
+
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt
new file mode 100644
index 000000000..3c263b349
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidatorTest.kt
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
+
+import org.junit.Test
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+
+class ModelTypeValidatorTest {
+
+ @Test(expected = IllegalStateException::class)
+ @Throws(Exception::class)
+ fun testvalidateModelType() {
+ val modelType = ModelType()
+ modelType.definitionType = ""
+ modelType.derivedFrom = ""
+ modelType.description = ""
+ modelType.definition = JacksonUtils.objectMapper.createObjectNode()
+ modelType.modelName = ""
+ modelType.version = ""
+ modelType.tags = ""
+ modelType.updatedBy = ""
+ ModelTypeValidator.validateModelType(modelType)
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties
new file mode 100755
index 000000000..e22e522ee
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+spring.main.banner-mode=off
+spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
+logging.level.org.springframework.web=INFO
+logging.level.org.hibernate.SQL=warn
+logging.level.org.hibernate.type.descriptor.sql=debug
+
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
+
+# Load Resource Source Mappings
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability
+# Controller Blueprints Core Configuration
+blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
+blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
+blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
+
+# Python executor
+blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
+blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-resource-assignment.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-resource-assignment.json
new file mode 100644
index 000000000..fdf76ab44
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-resource-assignment.json
@@ -0,0 +1,62 @@
+[
+ {
+ "name": "rs-db-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "sample-db-source",
+ "dictionary-source": "processor-db",
+ "dependencies": [
+ "input-source"
+ ]
+ },
+ {
+ "name": "ra-default-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "sample-default-source",
+ "dictionary-source": "default",
+ "dependencies": []
+ },
+ {
+ "name": "ra-input-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "sample-input-source",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "ra-list-input-source",
+ "input-param": true,
+ "property": {
+ "type": "list",
+ "required": true,
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "dictionary-name": "ra-list-input-source",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "ra-complex-input-source",
+ "input-param": true,
+ "property": {
+ "type": "dt-v4-aggregate",
+ "required": true
+ },
+ "dictionary-name": "sample-mdsal-source",
+ "dictionary-source": "sdnc",
+ "dependencies": []
+ }
+]
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-template.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-template.json
new file mode 100644
index 000000000..3692b7dcd
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhance-template.json
@@ -0,0 +1,351 @@
+{
+ "metadata": {
+ "template_author": "Brinda Santh",
+ "template_name": "enhance-template",
+ "template_version": "1.0.0",
+ "template_tags": "brinda, VPE",
+ "service-type": "Sample Service",
+ "release": "1806",
+ "vnf-type": "VPE"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "vpe-netconf-device": {
+ "capabilities": {
+ "netconf": {
+ "properties": {
+ "login-key": "sdnc",
+ "login-account": "sndc-local",
+ "source": "local",
+ "target-ip-address": {
+ "get_attribute": [
+ "SELF",
+ "lo0-local-ipv4-address"
+ ]
+ },
+ "port-number": 22,
+ "connection-time-out": 30
+ }
+ }
+ },
+ "type": "vnf-netconf-device"
+ },
+ "activate-netconf-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vpe-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "NetconfExecutorComponent": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": {
+ "get_input": "action-name"
+ },
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template_version"
+ },
+ "resource-type": "vnf-type",
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "hostname"
+ },
+ "execution-script": "execution-script"
+ },
+ "outputs": {
+ "response-data": {
+ "get_attribute": [
+ "SELF",
+ "netconf-executor-baseconfig.response-data"
+ ]
+ },
+ "status": {
+ "get_attribute": [
+ "SELF",
+ "netconf-executor-baseconfig.status"
+ ]
+ }
+ },
+ "implementation": {
+ "primary": "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-netconf-executor"
+ },
+ "resource-assignment-ra-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "interfaces": {
+ "ResourceAssignmentComponent": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "action-name": {
+ "get_input": "action-name"
+ },
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template-version"
+ },
+ "resource-type": "vnf-type",
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "hostname"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": "success",
+ "status": "status"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-resource-assignment"
+ },
+ "resource-assignment-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": false
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "resource-assignment-ra-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {}
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-resource-assignment"
+ },
+ "activate-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": false
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "activate-netconf-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {}
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-activate-netconf"
+ },
+ "base-config-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://base-config-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "rs-db-source",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "input-param": false,
+ "dictionary-name": "sample-db-source",
+ "dictionary-source": "processor-db",
+ "dependencies": [
+ "hostname"
+ ],
+ "version": 0
+ },
+ {
+ "name": "mdsal-source",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "dt-v4-aggregate"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "sample-mdsal-source",
+ "dictionary-source": "sdnc",
+ "dependencies": [
+ "service-instance-id"
+ ],
+ "version": 0
+ },
+ {
+ "name": "hostname",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "hostname",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ },
+ "licence-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://licence-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "licenses",
+ "property": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "dt-license-key"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "sample-licenses",
+ "dictionary-source": "sdnc",
+ "dependencies": [
+ "service-instance-id"
+ ],
+ "version": 0
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ }
+ }
+ },
+ "node_types": {
+ },
+ "data_types": {
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhanced-template.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhanced-template.json
new file mode 100644
index 000000000..d71293259
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/enhance/enhanced-template.json
@@ -0,0 +1,327 @@
+{
+ "metadata" : {
+ "template_author" : "Brinda Santh",
+ "template_name" : "enhance-template",
+ "template_version" : "1.0.0",
+ "template_tags" : "brinda, VPE",
+ "service-type" : "Sample Service",
+ "release" : "1806",
+ "vnf-type" : "VPE"
+ },
+ "tosca_definitions_version" : "controller_blueprint_1_0_0",
+ "artifact_types" : { },
+ "data_types" : {
+ },
+ "node_types" : {
+ },
+ "topology_template" : {
+ "inputs" : {
+ "request-id" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "service-instance-id" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "scope-type" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "action-name" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "hostname" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "resource-assignment-request" : {
+ "description" : "This is Dynamic Data type for the receipe resource-assignment-action.",
+ "required" : false,
+ "type" : "dt-resource-assignment-request"
+ }
+ },
+ "node_templates" : {
+ "vpe-netconf-device" : {
+ "type" : "vnf-netconf-device",
+ "capabilities" : {
+ "netconf" : {
+ "properties" : {
+ "login-key" : "sdnc",
+ "login-account" : "sndc-local",
+ "source" : "local",
+ "target-ip-address" : {
+ "get_attribute" : [ "SELF", "lo0-local-ipv4-address" ]
+ },
+ "port-number" : 22,
+ "connection-time-out" : 30
+ }
+ }
+ }
+ },
+ "activate-netconf-component" : {
+ "type" : "component-netconf-executor",
+ "capabilities" : {
+ "component-node" : { }
+ },
+ "requirements" : {
+ "netconf-connection" : {
+ "capability" : "netconf",
+ "node" : "vpe-netconf-device",
+ "relationship" : "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces" : {
+ "NetconfExecutorComponent" : {
+ "operations" : {
+ "process" : {
+ "implementation" : {
+ "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ },
+ "inputs" : {
+ "action-name" : {
+ "get_input" : "action-name"
+ },
+ "template-name" : {
+ "get_input" : "template_name"
+ },
+ "template-version" : {
+ "get_input" : "template_version"
+ },
+ "resource-type" : "vnf-type",
+ "request-id" : {
+ "get_input" : "request-id"
+ },
+ "resource-id" : {
+ "get_input" : "hostname"
+ },
+ "execution-script" : "execution-script"
+ },
+ "outputs" : {
+ "response-data" : {
+ "get_attribute" : [ "SELF", "netconf-executor-baseconfig.response-data" ]
+ },
+ "status" : {
+ "get_attribute" : [ "SELF", "netconf-executor-baseconfig.status" ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "resource-assignment-ra-component" : {
+ "type" : "component-resource-assignment",
+ "capabilities" : {
+ "component-node" : { }
+ },
+ "interfaces" : {
+ "ResourceAssignmentComponent" : {
+ "operations" : {
+ "process" : {
+ "inputs" : {
+ "template-names" : [ "base-config-template", "licence-template" ],
+ "action-name" : {
+ "get_input" : "action-name"
+ },
+ "template-name" : {
+ "get_input" : "template_name"
+ },
+ "template-version" : {
+ "get_input" : "template-version"
+ },
+ "resource-type" : "vnf-type",
+ "request-id" : {
+ "get_input" : "request-id"
+ },
+ "resource-id" : {
+ "get_input" : "hostname"
+ }
+ },
+ "outputs" : {
+ "resource-assignment-params" : "success",
+ "status" : "status"
+ }
+ }
+ }
+ }
+ }
+ },
+ "resource-assignment-action" : {
+ "type" : "dg-resource-assignment",
+ "properties" : {
+ "mode" : "sync",
+ "version" : "LATEST",
+ "is-start-flow" : false
+ },
+ "capabilities" : {
+ "dg-node" : { }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "resource-assignment-ra-component",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ResourceAssignment" : {
+ "inputs" : {
+ "params" : [ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "activate-action" : {
+ "type" : "dg-activate-netconf",
+ "properties" : {
+ "mode" : "sync",
+ "version" : "LATEST",
+ "is-start-flow" : false
+ },
+ "capabilities" : {
+ "dg-node" : { }
+ },
+ "requirements" : {
+ "component-dependency" : {
+ "capability" : "component-node",
+ "node" : "activate-netconf-component",
+ "relationship" : "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces" : {
+ "CONFIG" : {
+ "operations" : {
+ "ActivateNetconf" : {
+ "inputs" : {
+ "params" : [ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "base-config-template" : {
+ "type" : "artifact-config-template",
+ "properties" : {
+ "action-names" : [ "resource-assignment-action" ]
+ },
+ "capabilities" : {
+ "content" : {
+ "properties" : {
+ "content" : "db://base-config-template"
+ }
+ },
+ "mapping" : {
+ "properties" : {
+ "mapping" : [ {
+ "name" : "rs-db-source",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "input-param" : false,
+ "dictionary-name" : "sample-db-source",
+ "dictionary-source" : "processor-db",
+ "dependencies" : [ "hostname" ],
+ "version" : 0
+ }, {
+ "name" : "mdsal-source",
+ "property" : {
+ "description" : "",
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "dt-v4-aggregate"
+ }
+ },
+ "input-param" : false,
+ "dictionary-name" : "sample-mdsal-source",
+ "dictionary-source" : "sdnc",
+ "dependencies" : [ "service-instance-id" ],
+ "version" : 0
+ }, {
+ "name" : "hostname",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "hostname",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ }, {
+ "name" : "service",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ }, {
+ "name" : "service-instance-id",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service-instance-id",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ } ]
+ }
+ }
+ }
+ },
+ "licence-template" : {
+ "type" : "artifact-config-template",
+ "properties" : {
+ "action-names" : [ "resource-assignment-action" ]
+ },
+ "capabilities" : {
+ "content" : {
+ "properties" : {
+ "content" : "db://licence-template"
+ }
+ },
+ "mapping" : {
+ "properties" : {
+ "mapping" : [ {
+ "name" : "licenses",
+ "property" : {
+ "required" : true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "dt-license-key"
+ }
+ },
+ "input-param" : false,
+ "dictionary-name" : "sample-licenses",
+ "dictionary-source" : "sdnc",
+ "dependencies" : [ "service-instance-id" ],
+ "version" : 0
+ }, {
+ "name" : "service-instance-id",
+ "property" : {
+ "required" : true,
+ "type" : "string"
+ },
+ "dictionary-name" : "service-instance-id",
+ "dictionary-source" : "input",
+ "version" : 0,
+ "input-param" : false
+ } ]
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..feb4514d6
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml
@@ -0,0 +1,39 @@
+<!--
+ ~ Copyright © 2018 IBM.
+ ~ Modifications 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.
+ -->
+
+<configuration>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="warn"/>
+ <logger name="org.springframework.web" level="warn"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.cds.controllerblueprints.core" level="warn"/>
+ <logger name="org.onap.ccsdk.cds.controllerblueprints" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/model_type/data_type/datatype-property.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/model_type/data_type/datatype-property.json
new file mode 100644
index 000000000..d3ecffd17
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/model_type/data_type/datatype-property.json
@@ -0,0 +1,27 @@
+{
+ "version": "1.0.0",
+ "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
+ "required": false,
+ "type": "string"
+ },
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
+ "required": false,
+ "type": "string"
+ },
+ "entry_schema": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/automap.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/automap.json
new file mode 100644
index 000000000..820c59804
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/automap.json
@@ -0,0 +1,14 @@
+[
+ {
+ "name": "sample-input-source"
+ },
+ {
+ "name": "sample-default-source"
+ },
+ {
+ "name": "sample-db-source"
+ },
+ {
+ "name": "sample-mdsal-source"
+ }
+] \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/default_definition.json b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/default_definition.json
new file mode 100644
index 000000000..d2fa29918
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/resourcedictionary/default_definition.json
@@ -0,0 +1,17 @@
+{
+ "name": "ipaddress",
+ "property": {
+ "description": "name of the ",
+ "type": "list",
+ "entry_schema": {
+ "type": "dt-v4-aggregate"
+ }
+ },
+ "updated-by": "Brinda Santh (bs2796)",
+ "tags": "ipaddress",
+ "sources": {
+ "input": {
+ "type": "source-input"
+ }
+ }
+} \ No newline at end of file