aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints
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
commit1393e526211aa64852ff27d322af411e205c35a4 (patch)
tree97e49aa7f53d0b52d6c7a26644f08e1f24fd4703 /ms/controllerblueprints
parent0422a6ba90cf01d5c5100ed9b100638605eb7f98 (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')
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java151
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt5
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt132
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.kt83
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java73
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java56
-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
8 files changed, 264 insertions, 351 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
deleted file mode 100644
index 9641f8973..000000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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.apps.controllerblueprints.service.validator;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.CapabilityDefinition;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * ModelTypeValidation.java Purpose: Provide Validation Service for Model Type ModelTypeValidation
- *
- * @author Brinda Santh
- * @version 1.0
- */
-
-public class ModelTypeValidator {
-
- private ModelTypeValidator() {
-
- }
-
- private static List<String> getValidModelDefinitionType() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE);
- validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
- validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE);
- validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE);
- return validTypes;
- }
-
- /**
- * This is a validateModelTypeDefinition
- *
- * @param definitionType definitionType
- * @param definitionContent definitionContent
- * @return boolean
- * @throws BluePrintException BluePrintException
- */
- public static boolean validateModelTypeDefinition(String definitionType, JsonNode definitionContent)
- throws BluePrintException {
- if (definitionContent != null) {
- if (BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE.equalsIgnoreCase(definitionType)) {
- DataType dataType = JacksonUtils.readValue(definitionContent, DataType.class);
- if (dataType == null) {
- throw new BluePrintException(
- "Model type definition is not DataType valid content " + definitionContent);
- }
- } else if (BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE.equalsIgnoreCase(definitionType)) {
- NodeType nodeType = JacksonUtils.readValue(definitionContent, NodeType.class);
- if (nodeType == null) {
- throw new BluePrintException(
- "Model type definition is not NodeType valid content " + definitionContent);
- }
- } else if (BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE.equalsIgnoreCase(definitionType)) {
- ArtifactType artifactType = JacksonUtils.readValue(definitionContent, ArtifactType.class);
- if (artifactType == null) {
- throw new BluePrintException(
- "Model type definition is not ArtifactType valid content " + definitionContent);
- }
- }else if (BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE.equalsIgnoreCase(definitionType)) {
- CapabilityDefinition capabilityDefinition =
- JacksonUtils.readValue(definitionContent, CapabilityDefinition.class);
- if (capabilityDefinition == null) {
- throw new BluePrintException(
- "Model type definition is not CapabilityDefinition valid content " + definitionContent);
- }
- }
-
- }
- return true;
- }
-
- /**
- * This is a validateModelType method
- *
- * @param modelType modelType
- * @return boolean
- * @throws BluePrintException BluePrintException
- */
- public static boolean validateModelType(ModelType modelType) throws BluePrintException {
- if (modelType != null) {
-
- if (StringUtils.isBlank(modelType.getModelName())) {
- throw new BluePrintException("Model Name Information is missing.");
- }
-
- if (StringUtils.isBlank(modelType.getDefinitionType())) {
- throw new BluePrintException("Model Root Type Information is missing.");
- }
- if (StringUtils.isBlank(modelType.getDerivedFrom())) {
- throw new BluePrintException("Model Type Information is missing.");
- }
-
- if (modelType.getDefinition() == null) {
- throw new BluePrintException("Model Definition Information is missing.");
- }
- if (StringUtils.isBlank(modelType.getDescription())) {
- throw new BluePrintException("Model Description Information is missing.");
- }
-
- if (StringUtils.isBlank(modelType.getVersion())) {
- throw new BluePrintException("Model Version Information is missing.");
- }
-
- if (StringUtils.isBlank(modelType.getUpdatedBy())) {
- throw new BluePrintException("Model Updated By Information is missing.");
- }
-
- List<String> validRootTypes = getValidModelDefinitionType();
- if (!validRootTypes.contains(modelType.getDefinitionType())) {
- throw new BluePrintException("Not Valid Model Root Type(" + modelType.getDefinitionType()
- + "), It should be " + validRootTypes);
- }
-
- validateModelTypeDefinition(modelType.getDefinitionType(), modelType.getDefinition());
-
- } else {
- throw new BluePrintException("Model Type Information is missing.");
- }
-
- return true;
-
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt
index 8b6e54af9..8144a1e79 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/BluePrintDatabaseLoadService.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.apps.controllerblueprints.service.load
import com.att.eelf.configuration.EELFManager
+import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.springframework.boot.context.event.ApplicationReadyEvent
import org.springframework.context.event.EventListener
@@ -49,7 +50,9 @@ open class BluePrintDatabaseLoadService(private val bluePrintLoadConfiguration:
if (bluePrintLoadConfiguration.loadModelType) {
val paths = bluePrintLoadConfiguration.loadModeTypePaths?.split(",")
paths?.let {
- modelTypeLoadService.loadPathsModelType(paths)
+ runBlocking {
+ modelTypeLoadService.loadPathsModelType(paths)
+ }
}
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt
index 51bbca7d2..061ef88ef 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ModelTypeLoadService.kt
@@ -21,9 +21,8 @@ import kotlinx.coroutines.*
import org.apache.commons.io.FilenameUtils
import org.apache.commons.lang3.text.StrBuilder
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType
-import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
import org.onap.ccsdk.apps.controllerblueprints.service.handler.ModelTypeHandler
@@ -37,11 +36,14 @@ open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler)
private val log = EELFManager.getInstance().getLogger(ModelTypeLoadService::class.java)
private val updateBySystem = "System"
- open fun loadPathsModelType(modelTypePaths: List<String>) {
- modelTypePaths.forEach { loadPathModelType(it) }
+ open suspend fun loadPathsModelType(modelTypePaths: List<String>) {
+ modelTypePaths.forEach { runBlocking { loadPathModelType(it) } }
}
- open fun loadPathModelType(modelTypePath: String) = runBlocking {
+ /**
+ * Load the Model Type file content from the defined path, Load of sequencing should be maintained.
+ */
+ open suspend fun loadPathModelType(modelTypePath: String) = runBlocking {
log.info(" *************************** loadModelType **********************")
try {
val errorBuilder = StrBuilder()
@@ -51,17 +53,35 @@ open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler)
val deferredResults = mutableListOf<Deferred<Unit>>()
- for (file in dataTypeFiles) deferredResults += async { loadDataType(file, errorBuilder) }
+ for (file in dataTypeFiles) deferredResults += async {
+ loadModelType(file, DataType::class.java, errorBuilder)
+ }
deferredResults.awaitAll()
}
coroutineScope {
- val artifactTypefiles = File("$modelTypePath/artifact_type").listFiles()
+ val artifactTypeFiles = File("$modelTypePath/artifact_type").listFiles()
val deferredResults = mutableListOf<Deferred<Unit>>()
- for (file in artifactTypefiles) deferredResults += async { loadArtifactType(file, errorBuilder) }
+ for (file in artifactTypeFiles) deferredResults += async {
+ loadModelType(file,
+ ArtifactType::class.java, errorBuilder)
+ }
+
+ deferredResults.awaitAll()
+ }
+
+ coroutineScope {
+ val relationshipTypeFiles = File("$modelTypePath/relationship_type").listFiles()
+
+ val deferredResults = mutableListOf<Deferred<Unit>>()
+
+ for (file in relationshipTypeFiles) deferredResults += async {
+ loadModelType(file,
+ RelationshipType::class.java, errorBuilder)
+ }
deferredResults.awaitAll()
}
@@ -71,7 +91,10 @@ open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler)
val deferredResults = mutableListOf<Deferred<Unit>>()
- for (file in nodeTypeFiles) deferredResults += async { loadNodeType(file, errorBuilder) }
+ for (file in nodeTypeFiles) deferredResults += async {
+ loadModelType(file,
+ NodeType::class.java, errorBuilder)
+ }
deferredResults.awaitAll()
}
@@ -83,76 +106,45 @@ open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler)
}
}
- private fun loadDataType(file: File, errorBuilder: StrBuilder) {
- try {
- log.trace("Loading DataType(${file.name}")
- val dataKey = FilenameUtils.getBaseName(file.name)
- val definitionContent = file.readText(Charset.defaultCharset())
- val dataType = JacksonUtils.readValue(definitionContent, DataType::class.java)
- checkNotNull(dataType) { "failed to get data type from file : ${file.name}" }
-
- val modelType = ModelType()
- modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
- modelType.derivedFrom = dataType.derivedFrom
- modelType.description = dataType.description
- modelType.definition = JacksonUtils.jsonNode(definitionContent)
- modelType.modelName = dataKey
- modelType.version = dataType.version
- modelType.updatedBy = updateBySystem
- modelType.tags = (dataKey + "," + dataType.derivedFrom + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
- modelTypeHandler.saveModel(modelType)
- log.trace("DataType(${file.name}) loaded successfully ")
- } catch (e: Exception) {
- errorBuilder.appendln("Couldn't load DataType(${file.name}: ${e.message}")
- }
- }
-
- private fun loadArtifactType(file: File, errorBuilder: StrBuilder) {
+ private inline fun <reified T> loadModelType(file: File, classType: Class<T>, errorBuilder: StrBuilder) {
try {
- log.trace("Loading ArtifactType(${file.name}")
+ log.trace("Loading ${classType.name} (${file.name})")
val dataKey = FilenameUtils.getBaseName(file.name)
val definitionContent = file.readText(Charset.defaultCharset())
- val artifactType = JacksonUtils.readValue(definitionContent, ArtifactType::class.java)
- checkNotNull(artifactType) { "failed to get artifact type from file : ${file.name}" }
+ val definition = JacksonUtils.readValue(definitionContent, classType) as EntityType
+ //checkNotNull(definition) { "failed to get data type from file : ${file.name}" }
val modelType = ModelType()
- modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE
- modelType.derivedFrom = artifactType.derivedFrom
- modelType.description = artifactType.description
+ val definitionType: String?
+ when (T::class) {
+ DataType::class -> {
+ definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ }
+ RelationshipType::class -> {
+ definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE
+ }
+ ArtifactType::class -> {
+ definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE
+ }
+ NodeType::class -> {
+ definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE
+ }
+ else -> {
+ throw BluePrintException("couldn't process model type($classType) definition")
+ }
+ }
+ modelType.definitionType = definitionType
+ modelType.derivedFrom = definition.derivedFrom
+ modelType.description = definition.description
modelType.definition = JacksonUtils.jsonNode(definitionContent)
modelType.modelName = dataKey
- modelType.version = artifactType.version
+ modelType.version = definition.version
modelType.updatedBy = updateBySystem
- modelType.tags = (dataKey + "," + artifactType.derivedFrom + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE)
+ modelType.tags = (dataKey + "," + definition.derivedFrom + "," + definitionType)
modelTypeHandler.saveModel(modelType)
- log.trace("ArtifactType(${file.name}) loaded successfully ")
+ log.trace("${classType.name}(${file.name}) loaded successfully ")
} catch (e: Exception) {
- errorBuilder.appendln("Couldn't load ArtifactType(${file.name}: ${e.message}")
+ errorBuilder.appendln("Couldn't load ${classType.name}(${file.name}: ${e.message}")
}
}
-
- private fun loadNodeType(file: File, errorBuilder: StrBuilder) {
- try {
- log.trace("Loading NodeType(${file.name}")
- val nodeKey = FilenameUtils.getBaseName(file.name)
- val definitionContent = file.readText(Charset.defaultCharset())
- val nodeType = JacksonUtils.readValue(definitionContent, NodeType::class.java)
- checkNotNull(nodeType) { "failed to get node type from file : ${file.name}" }
-
- val modelType = ModelType()
- modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE
- modelType.derivedFrom = nodeType.derivedFrom
- modelType.description = nodeType.description
- modelType.definition = JacksonUtils.jsonNode(definitionContent)
- modelType.modelName = nodeKey
- modelType.version = nodeType.version
- modelType.updatedBy = updateBySystem
- modelType.tags = (nodeKey + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE + "," + nodeType.derivedFrom)
- modelTypeHandler.saveModel(modelType)
- log.trace("NodeType(${file.name}) loaded successfully ")
- } catch (e: Exception) {
- errorBuilder.appendln("Couldn't load NodeType(${file.name}: ${e.message}")
- }
- }
-
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.kt
new file mode 100644
index 000000000..1428c81d6
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.kt
@@ -0,0 +1,83 @@
+/*
+ * 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.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType
+
+class ModelTypeValidator {
+ companion object {
+ /**
+ * This is a validateModelTypeDefinition
+ *
+ * @param definitionType definitionType
+ * @param definitionContent definitionContent
+ * @return boolean
+ */
+ fun validateModelTypeDefinition(definitionType: String, definitionContent: JsonNode): Boolean {
+
+ when (definitionType) {
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE -> {
+ JacksonUtils.readValue(definitionContent, DataType::class.java)
+ ?: throw BluePrintException("Model type definition is not DataType valid content $definitionContent")
+ }
+ BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE -> {
+ JacksonUtils.readValue(definitionContent, NodeType::class.java)
+ ?: throw BluePrintException("Model type definition is not NodeType valid content $definitionContent")
+ }
+ BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE -> {
+ JacksonUtils.readValue(definitionContent, ArtifactType::class.java)
+ ?: throw BluePrintException("Model type definition is not ArtifactType valid content $definitionContent")
+ }
+ BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE -> {
+ JacksonUtils.readValue(definitionContent, CapabilityDefinition::class.java)
+ ?: throw BluePrintException("Model type definition is not CapabilityDefinition valid content $definitionContent")
+ }
+ BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE -> {
+ JacksonUtils.readValue(definitionContent, RelationshipType::class.java)
+ ?: throw BluePrintException("Model type definition is not RelationshipType valid content $definitionContent")
+ }
+ }
+ return true
+ }
+
+ /**
+ * This is a validateModelType method
+ *
+ * @param modelType modelType
+ * @return boolean
+ */
+ fun validateModelType(modelType: ModelType?): Boolean {
+ checkNotNull(modelType) { "Model Type Information is missing." }
+
+ val validRootTypes = BluePrintTypes.validModelTypes()
+
+ check(validRootTypes.contains(modelType.definitionType)) {
+ "Not Valid Model Root Type(${modelType.definitionType}), It should be $validRootTypes"
+ }
+
+ validateModelTypeDefinition(modelType.definitionType, modelType.definition)
+ return true
+ }
+ }
+
+}
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java
deleted file mode 100644
index 23e5294fd..000000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 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.core.service.BluePrintContext;
-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 = {TestApplication.class})
-@TestPropertySource(locations = {"classpath:application.properties"})
-public class BluePrintEnhancerServiceImplTest {
-
- @Autowired
- private ModelTypeLoadService modelTypeLoadService;
-
- @Autowired
- private ResourceDictionaryLoadService resourceDictionaryLoadService;
-
- @Autowired
- private BluePrintEnhancerService bluePrintEnhancerService;
-
- @Autowired
- private BluePrintValidatorService bluePrintValidatorService;
-
- @Before
- public void init() {
- modelTypeLoadService.loadPathModelType("./../../../../components/model-catalog/definition-type/starter-type");
- resourceDictionaryLoadService.loadPathResourceDictionary("./../../../../components/model-catalog/resource-dictionary/starter-dictionary");
- }
-
- @Test
- public void testEnhancementAndValidation() throws Exception {
-
- String basePath = "./../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration";
-
- String targetPath = Paths.get("target", "bp-enhance").toUri().getPath();
-
- BluePrintContext bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath);
- Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext);
-
- // Validate the Generated BluePrints
- Boolean 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/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java
deleted file mode 100644
index 16b2bc815..000000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidatorTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.apps.controllerblueprints.service.validator;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
-
-public class ModelTypeValidatorTest {
-
- @Before
- public void setup(){
- ModelTypeValidator modelTypeValidator;
- }
-
- @Test
- public void testGetValidModelDefinitionType_definitionContentNULL() throws Exception{
- String definitionType=null;
- JsonNode definitionContent=null;
- boolean valid= ModelTypeValidator.validateModelTypeDefinition(definitionType, definitionContent);
- Assert.assertTrue(valid);
-
- }
-
- @Test(expected=BluePrintException.class)
- public void testvalidateModelType() throws Exception{
- ModelType modelType = new ModelType();
- modelType.setDefinitionType("");
- modelType.setDerivedFrom("");
- modelType.setDescription("");
- JsonNode definitionContent=null;
- modelType.setDefinition(definitionContent);
- modelType.setModelName("");
- modelType.setVersion("");
- modelType.setTags("");
- modelType.setUpdatedBy("");
- ModelTypeValidator.validateModelType(modelType);
- }
-}
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 000000000..4ab67084a
--- /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 000000000..db4ee5c98
--- /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)
+ }
+}