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>
}\r
\r
open fun enrichNodeTypeCapabilityProperties(nodeTypeName: String, nodeType: NodeType) {\r
- nodeType.capabilities?.forEach { capabilityDefinitionName, capabilityDefinition ->\r
+ nodeType.capabilities?.forEach { _, capabilityDefinition ->\r
capabilityDefinition.properties?.let { properties ->\r
enrichPropertyDefinitions(properties)\r
}\r
open fun populateNodeType(nodeTypeName: String): NodeType {\r
\r
val nodeType = serviceTemplate.nodeTypes?.get(nodeTypeName)\r
- ?: bluePrintRepoService.getNodeType(nodeTypeName)?.block()\r
+ ?: bluePrintRepoService.getNodeType(nodeTypeName).block()\r
?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))\r
serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)\r
return nodeType\r
\r
open fun populateArtifactType(artifactTypeName: String): ArtifactType {\r
val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)\r
- ?: bluePrintRepoService.getArtifactType(artifactTypeName)?.block()\r
+ ?: bluePrintRepoService.getArtifactType(artifactTypeName).block()\r
?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))\r
serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)\r
return artifactType\r
\r
open fun populateDataTypes(dataTypeName: String): DataType {\r
val dataType = serviceTemplate.dataTypes?.get(dataTypeName)\r
- ?: bluePrintRepoService.getDataType(dataTypeName)?.block()\r
+ ?: bluePrintRepoService.getDataType(dataTypeName).block()\r
?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))\r
serviceTemplate.dataTypes?.put(dataTypeName, dataType)\r
return dataType\r
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils;\r
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;\r
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionFileRepoService;\r
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils;\r
\r
import java.util.List;\r
\r
\r
@Before\r
public void setUp(){\r
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("db", "source-db");\r
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");\r
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");\r
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");\r
+ // Setup dummy Source Instance Mapping\r
+ ResourceDictionaryTestUtils.setUpResourceSourceMapping();\r
}\r
\r
@Test\r
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\r
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils;\r
import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
@Before\r
public void setUp(){\r
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("db", "source-db");\r
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");\r
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");\r
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");\r
+ // Setup dummy Source Instance Mapping\r
+ ResourceDictionaryTestUtils.setUpResourceSourceMapping();\r
}\r
\r
@Test\r