aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/service/src/test/kotlin/org
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <bs2796@att.com>2019-01-08 11:17:05 -0500
committerBrinda Santh Muthuramalingam <bs2796@att.com>2019-01-10 19:59:36 +0000
commit8bec4a04cffac2ba03af3078d090c0b9466d78d7 (patch)
tree8581d954431f7c7e30a958e7b6cd122872d1f3f5 /ms/controllerblueprints/modules/service/src/test/kotlin/org
parent404a3c2babcf581806340e314b77379f7047f8f9 (diff)
Add relationships type files load structure.
Change-Id: I1be3ba493956674b476058094e05d681ce358711 Issue-ID: CCSDK-746 Signed-off-by: Muthuramalingam, Brinda Santh <bs2796@att.com>
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/test/kotlin/org')
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt75
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.kt40
2 files changed, 115 insertions, 0 deletions
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
new file mode 100644
index 00000000..4ab67084
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
@@ -0,0 +1,75 @@
+/*
+ * 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.apps.controllerblueprints.service.enhancer
+
+import kotlinx.coroutines.runBlocking
+import org.junit.Assert
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.apps.controllerblueprints.service.load.ModelTypeLoadService
+import org.onap.ccsdk.apps.controllerblueprints.service.load.ResourceDictionaryLoadService
+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 java.nio.file.Paths
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = arrayOf(TestApplication::class))
+@TestPropertySource(locations = arrayOf("classpath:application.properties"))
+class BluePrintEnhancerServiceImplTest {
+
+ @Autowired
+ private val modelTypeLoadService: ModelTypeLoadService? = null
+
+ @Autowired
+ private val resourceDictionaryLoadService: ResourceDictionaryLoadService? = null
+
+ @Autowired
+ private val bluePrintEnhancerService: BluePrintEnhancerService? = null
+
+ @Autowired
+ private val bluePrintValidatorService: BluePrintValidatorService? = null
+
+ @Before
+ fun init() {
+ runBlocking {
+ modelTypeLoadService!!.loadPathModelType("./../../../../components/model-catalog/definition-type/starter-type")
+ resourceDictionaryLoadService!!.loadPathResourceDictionary("./../../../../components/model-catalog/resource-dictionary/starter-dictionary")
+ }
+ }
+
+ @Test
+ @Throws(Exception::class)
+ fun testEnhancementAndValidation() {
+
+ val basePath = "./../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration"
+
+ val targetPath = Paths.get("target", "bp-enhance").toUri().path
+
+ 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 validation failed ", valid)
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.kt
new file mode 100644
index 00000000..db4ee5c9
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.kt
@@ -0,0 +1,40 @@
+/*
+ * 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.apps.controllerblueprints.service.validator
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
+
+class ModelTypeValidatorTest {
+
+ @Test(expected = IllegalStateException::class)
+ @Throws(Exception::class)
+ fun testvalidateModelType() {
+ val modelType = ModelType()
+ modelType.definitionType = ""
+ modelType.derivedFrom = ""
+ modelType.description = ""
+ val definitionContent: JsonNode? = null
+ modelType.definition = definitionContent
+ modelType.modelName = ""
+ modelType.version = ""
+ modelType.tags = ""
+ modelType.updatedBy = ""
+ ModelTypeValidator.validateModelType(modelType)
+ }
+}