aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-13 14:25:49 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-13 14:25:49 +0000
commit1f9a8648b139281fdd8391949e0a54a2be2added (patch)
tree4e0253a4b29afeffa32ec5985a56fa3c9a5b5952
parent5eebfaa6ac0d4cb4fdf20d19ead7cd0303fc6f29 (diff)
Controller Blueprints Microservice
Optimise dictionary dummy data creation reusability and property usage optimisation. Change-Id: Ibbd56d514f437f29943cebc0e607becb6798e4b6 Issue-ID: CCSDK-491 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt6
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt2
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt2
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt10
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt2
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt8
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt5
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt4
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt30
-rw-r--r--components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt9
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt8
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java8
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java7
13 files changed, 71 insertions, 30 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
index 875cbea6..46da9d95 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
@@ -71,7 +71,7 @@ class BluePrintContext(serviceTemplate: ServiceTemplate) {
}
fun nodeTypeInterface(nodeTypeName: String, interfaceName: String): InterfaceDefinition? {
- return nodeTypeByName(nodeTypeName).interfaces?.values?.first()
+ return nodeTypeByName(nodeTypeName).interfaces?.get(interfaceName)
}
fun nodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, operationName: String): OperationDefinition? {
@@ -155,9 +155,9 @@ class BluePrintContext(serviceTemplate: ServiceTemplate) {
}
fun nodeTemplateRequirementNode(nodeTemplateName: String, requirementName: String): NodeTemplate {
- val nodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node
+ val requirementNodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node
?: throw BluePrintException(String.format("failed to get node name for node template's (%s) requirement's (%s) " + nodeTemplateName, requirementName))
- return nodeTemplateByName(nodeTemplateName)
+ return nodeTemplateByName(requirementNodeTemplateName)
}
fun nodeTemplateCapabilityProperty(nodeTemplateName: String, capabilityName: String, propertyName: String): Any? {
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
index 82e232d0..6a50680e 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
@@ -99,7 +99,7 @@ object BluePrintExpressionService {
arrayNode.size() > 3 -> {
reqOrCapEntityName = arrayNode[1].textValue()
propertyName = arrayNode[2].textValue()
- val propertyPaths: List<String> = arrayNode.filterIndexed { index, obj ->
+ val propertyPaths: List<String> = arrayNode.filterIndexed { index, _ ->
index >= 3
}.map { it.textValue() }
subProperty = propertyPaths.joinToString("/")
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index 1fdb6c3c..2485abdb 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -308,7 +308,7 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c
open fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode) {
log.info("assign workflow {} input value ({})", workflowName, jsonNode.toString())
- bluePrintContext.workflowByName(workflowName)?.inputs?.forEach { propertyName, property ->
+ bluePrintContext.workflowByName(workflowName)?.inputs?.forEach { propertyName, _ ->
val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
?: NullNode.getInstance()
setWorkflowInputValue(workflowName, propertyName, valueNode)
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
index 3bea59f9..7ad38332 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
@@ -236,7 +236,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
message.appendln("---> Workflow :" + paths.joinToString(separator))
// Step Validation Start
paths.add("steps")
- workflow.steps?.forEach { stepName, step ->
+ workflow.steps?.forEach { stepName, _ ->
paths.add(stepName)
message.appendln("----> Steps :" + paths.joinToString(separator))
paths.removeAt(paths.lastIndex)
@@ -583,10 +583,10 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
}
- private fun checkPropertyDataType(dataType: String, propertyName: String) {
+ private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
- val dataType = serviceTemplate.dataTypes?.get(dataType)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataType, propertyName))
+ val dataType = serviceTemplate.dataTypes?.get(dataTypeName)
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
@@ -596,7 +596,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
return true
} else {
- throw BluePrintException(format("DataType ({}) for the property ({}) is not valid", dataType))
+ throw BluePrintException(format("DataType({}) for the property({}) is not valid", dataType, propertyName))
}
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
index 07b819ff..0e4c3e3e 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
@@ -43,7 +43,7 @@ object BluePrintRuntimeUtils {
fun assignInputs(bluePrintContext: BluePrintContext, jsonNode: JsonNode, context: MutableMap<String, Any>) {
log.info("assignInputs from input JSON ({})", jsonNode.toString())
- bluePrintContext.inputs?.forEach { propertyName, property ->
+ bluePrintContext.inputs?.forEach { propertyName, _ ->
val valueNode: JsonNode = jsonNode.at("/".plus(propertyName)) ?: NullNode.getInstance()
val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(propertyName)
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
index 88aea919..b8cfdd40 100644
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
+++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
@@ -33,25 +33,25 @@ class BluePrintRepoFileServiceTest {
@Test
fun testGetDataType() {
- val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")?.block()
+ val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate").block()
assertNotNull(dataType, "Failed to get DataType from repo")
}
@Test
fun testGetNodeType() {
- val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")?.block()
+ val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment").block()
assertNotNull(nodeType, "Failed to get NodeType from repo")
}
@Test
fun testGetArtifactType() {
- val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")?.block()
+ val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity").block()
assertNotNull(nodeType, "Failed to get ArtifactType from repo")
}
@Test(expected = FileNotFoundException::class)
fun testModelNotFound() {
- val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found")?.block()
+ val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found").block()
assertNotNull(dataType, "Failed to get DataType from repo")
}
} \ No newline at end of file
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
index 089fce0b..fc7f1092 100644
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
@@ -67,6 +67,7 @@ open class ResourceAssignmentValidationDefaultService : ResourceAssignmentValida
open fun validateSources(resourceAssignments: List<ResourceAssignment>) {
log.info("validating resource assignment sources")
+ // Check the Resource Assignment Source(Dynamic Instance) is valid.
resourceAssignments.forEach { resourceAssignment ->
try {
ResourceSourceMappingFactory.getRegisterSourceMapping(resourceAssignment.dictionarySource!!)
@@ -80,6 +81,7 @@ open class ResourceAssignmentValidationDefaultService : ResourceAssignmentValida
resourceAssignmentMap = resourceAssignments.map { it.name to it }.toMap()
+ // Check the Resource Assignment has Duplicate Key Names
val duplicateKeyNames = resourceAssignments.groupBy { it.name }
.filter { it.value.size > 1 }
.map { it.key }
@@ -88,6 +90,7 @@ open class ResourceAssignmentValidationDefaultService : ResourceAssignmentValida
validationMessage.appendln(String.format("Duplicate Assignment Template Keys (%s) is Present", duplicateKeyNames))
}
+ // Check the Resource Assignment has Duplicate Dictionary Names
val duplicateDictionaryKeyNames = resourceAssignments.groupBy { it.dictionaryName }
.filter { it.value.size > 1 }
.map { it.key }
@@ -95,8 +98,10 @@ open class ResourceAssignmentValidationDefaultService : ResourceAssignmentValida
validationMessage.appendln(String.format("Duplicate Assignment Dictionary Keys (%s) is Present", duplicateDictionaryKeyNames))
}
+ // Collect all the dependencies as a single list
val dependenciesNames = resourceAssignments.mapNotNull { it.dependencies }.flatten()
+ // Check all the dependencies keys have Resource Assignment mappings.
val notPresentDictionaries = dependenciesNames.filter { !resourceAssignmentMap.containsKey(it) }.distinct()
if (notPresentDictionaries.isNotEmpty()) {
validationMessage.appendln(String.format("No assignments for Dictionary Keys (%s)", notPresentDictionaries))
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
index 14855d4b..9f45d166 100644
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
@@ -59,7 +59,7 @@ open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoS
resourceDefinition.sources.forEach { (name, nodeTemplate) ->
val sourceType = nodeTemplate.type
- val sourceNodeType = bluePrintRepoService.getNodeType(sourceType)?.block()
+ val sourceNodeType = bluePrintRepoService.getNodeType(sourceType).block()
?: throw BluePrintException(format("Failed to get source({}) node type definition({})", name, sourceType))
// Validate Property Name, expression, values and Data Type
@@ -100,7 +100,7 @@ open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoS
isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment)
} else {
- bluePrintRepoService.getDataType(propertyType)
+ bluePrintRepoService.getDataType(propertyType).block()
?: throw BluePrintException(format("property({}) defined of data type({}) is not in repository",
propertyName, propertyType))
isValid = true
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
new file mode 100644
index 00000000..bebe27d8
--- /dev/null
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
@@ -0,0 +1,30 @@
+/*
+ * 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.resource.dict.utils
+
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
+
+object ResourceDictionaryTestUtils {
+
+ @JvmStatic
+ fun setUpResourceSourceMapping() {
+ ResourceSourceMappingFactory.registerSourceMapping("db", "source-db")
+ ResourceSourceMappingFactory.registerSourceMapping("input", "source-input")
+ ResourceSourceMappingFactory.registerSourceMapping("default", "source-default")
+ ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest")
+ }
+} \ No newline at end of file
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
index 6216d5bf..87ebb700 100644
--- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
+++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
@@ -23,6 +23,9 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
import com.att.eelf.configuration.EELFManager
+import org.junit.Before
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils
+
/**
* ResourceAssignmentValidationServiceTest.
*
@@ -30,6 +33,12 @@ import com.att.eelf.configuration.EELFManager
*/
class ResourceAssignmentValidationServiceTest {
private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceTest::class.java)
+ @Before
+ fun setUp() {
+ // Setup dummy Source Instance Mapping
+ ResourceDictionaryTestUtils.setUpResourceSourceMapping()
+ }
+
@Test
fun testValidateSuccess() {
log.info("**************** testValidateSuccess *****************")
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt
index cf9e96e7..46709c5f 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt
@@ -171,7 +171,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe
}
open fun enrichNodeTypeCapabilityProperties(nodeTypeName: String, nodeType: NodeType) {
- nodeType.capabilities?.forEach { capabilityDefinitionName, capabilityDefinition ->
+ nodeType.capabilities?.forEach { _, capabilityDefinition ->
capabilityDefinition.properties?.let { properties ->
enrichPropertyDefinitions(properties)
}
@@ -246,7 +246,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe
open fun populateNodeType(nodeTypeName: String): NodeType {
val nodeType = serviceTemplate.nodeTypes?.get(nodeTypeName)
- ?: bluePrintRepoService.getNodeType(nodeTypeName)?.block()
+ ?: bluePrintRepoService.getNodeType(nodeTypeName).block()
?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))
serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
return nodeType
@@ -254,7 +254,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe
open fun populateArtifactType(artifactTypeName: String): ArtifactType {
val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: bluePrintRepoService.getArtifactType(artifactTypeName)?.block()
+ ?: bluePrintRepoService.getArtifactType(artifactTypeName).block()
?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))
serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
return artifactType
@@ -262,7 +262,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe
open fun populateDataTypes(dataTypeName: String): DataType {
val dataType = serviceTemplate.dataTypes?.get(dataTypeName)
- ?: bluePrintRepoService.getDataType(dataTypeName)?.block()
+ ?: bluePrintRepoService.getDataType(dataTypeName).block()
?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))
serviceTemplate.dataTypes?.put(dataTypeName, dataType)
return dataType
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
index e279ec9c..a5d1e417 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
@@ -26,9 +26,9 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionFileRepoService;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils;
import java.util.List;
@@ -42,10 +42,8 @@ public class ResourceAssignmentEnhancerServiceTest {
@Before
public void setUp(){
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("db", "source-db");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");
+ // Setup dummy Source Instance Mapping
+ ResourceDictionaryTestUtils.setUpResourceSourceMapping();
}
@Test
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
index 5f34b551..26fb1d32 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils;
import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -37,10 +38,8 @@ public class ServiceTemplateValidationTest {
@Before
public void setUp(){
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("db", "source-db");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");
+ // Setup dummy Source Instance Mapping
+ ResourceDictionaryTestUtils.setUpResourceSourceMapping();
}
@Test