Merge "added test case to PropertyOperatorTest.java"
authorDan Timoney <dt5972@att.com>
Fri, 14 Sep 2018 19:44:43 +0000 (19:44 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 14 Sep 2018 19:44:43 +0000 (19:44 +0000)
73 files changed:
.gitignore
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintEnhancerFactory.kt [deleted file]
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt [deleted file]
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt [new file with mode: 0644]
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt [new file with mode: 0644]
components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java [new file with mode: 0644]
components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
components/resource-dict/src/test/resources/enrich/simple-enrich.json [deleted file]
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt
ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/JavaScriptExecuteComponent.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/PythonExecuteComponent.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/DefaultResourceAssignmentProcessor.kt
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/InputResourceAssignmentProcessor.kt
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/MDSALResourceAssignmentProcessor.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/SdncResourceAssignmentProcessor.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/resolution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.java
ms/blueprintsprocessor/modules/services/resolution-service/src/test/resources/mapping/db/resource-assignments-simple.json
ms/controllerblueprints/.gitignore
ms/controllerblueprints/application/load/resource_dictionary/sample-db-source.json [moved from ms/controllerblueprints/application/load/resource_dictionary/db-source.json with 91% similarity]
ms/controllerblueprints/application/load/resource_dictionary/sample-default-source.json [new file with mode: 0644]
ms/controllerblueprints/application/load/resource_dictionary/sample-input-source.json [moved from ms/controllerblueprints/application/load/resource_dictionary/input-source.json with 64% similarity]
ms/controllerblueprints/application/load/resource_dictionary/sample-licenses.json [new file with mode: 0644]
ms/controllerblueprints/application/load/resource_dictionary/sample-mdsal-source.json [new file with mode: 0644]
ms/controllerblueprints/application/load/resource_dictionary/sample-v4-ip-type.json [moved from ms/controllerblueprints/application/load/resource_dictionary/v4-ip-type.json with 54% similarity]
ms/controllerblueprints/application/opt/app/onap/config/application.properties
ms/controllerblueprints/application/pom.xml
ms/controllerblueprints/application/src/test/resources/application.properties
ms/controllerblueprints/distribution/pom.xml
ms/controllerblueprints/modules/service/pom.xml
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionRepoDBService.java [moved from ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java with 71% similarity]
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt [moved from components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt with 95% similarity]
ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt [moved from components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentEnhancerService.kt with 52% similarity]
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java [moved from components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentEnhancerServiceTest.java with 60% similarity]
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
ms/controllerblueprints/modules/service/src/test/resources/application.properties
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json [new file with mode: 0644]
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
ms/controllerblueprints/modules/service/src/test/resources/logback.xml
ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json
ms/controllerblueprints/pom.xml
ms/neng/.classpath
ms/neng/pom.xml
ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/JerseyConfiguration.java
ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceImpl.java
ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java
ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/TestExternalInterface.java [new file with mode: 0644]
ms/pom.xml
ms/vlantag-api/pom.xml
ms/vlantag-api/src/main/java/org/onap/ccsdk/apps/ms/vlantagapi/core/Application.java
version.properties

index c47edf3..82cae9e 100644 (file)
 \r
 **/*versionsBackup\r
 **/blackDuckHub*\r
-**/*.jsonld
\ No newline at end of file
+**/*.jsonld\r
+**/.checkstyle\r
+**/.gitignore\r
+**/.gitignore\r
+**/.gitignore\r
+**/.gitignore\r
+**/.gitignore\r
+**/.gitignore\r
+**/.gitignore\r
+**/.gitignore\r
+\r
index e25b3ee..a971898 100644 (file)
@@ -16,6 +16,8 @@
 \r
 package org.onap.ccsdk.apps.controllerblueprints.core\r
 \r
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition\r
+\r
 /**\r
  *\r
  *\r
@@ -104,6 +106,7 @@ object BluePrintTypes {
         validTypes.add(BluePrintConstants.DATA_TYPE_TIMESTAMP)\r
         validTypes.add(BluePrintConstants.DATA_TYPE_NULL)\r
         validTypes.add(BluePrintConstants.DATA_TYPE_LIST)\r
+        validTypes.add(BluePrintConstants.DATA_TYPE_MAP)\r
         return validTypes\r
     }\r
 \r
@@ -127,6 +130,13 @@ object BluePrintTypes {
         return validTypes\r
     }\r
 \r
+    @JvmStatic\r
+    fun validPrimitiveOrCollectionPrimitive(propertyDefinition: PropertyDefinition): Boolean {\r
+        val entrySchema = propertyDefinition.entrySchema?.type ?: BluePrintConstants.DATA_TYPE_NULL\r
+        return BluePrintTypes.validPropertyTypes().contains(propertyDefinition.type)\r
+                && BluePrintTypes.validPrimitiveTypes().contains(entrySchema)\r
+    }\r
+\r
     @JvmStatic\r
     fun validCommands(): List<String> {\r
         return listOf(BluePrintConstants.EXPRESSION_GET_INPUT,\r
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintEnhancerFactory.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/factory/BluePrintEnhancerFactory.kt
deleted file mode 100644 (file)
index d796597..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
- * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.core.factory\r
-\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerService\r
-import com.att.eelf.configuration.EELFLogger\r
-import com.att.eelf.configuration.EELFManager\r
-\r
-\r
-/**\r
- * BluePrintEnhancerFactory\r
- * @author Brinda Santh\r
- *\r
- */\r
-\r
-object BluePrintEnhancerFactory {\r
-    private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())\r
-\r
-    var bluePrintEnhancerServices: MutableMap<String, BluePrintEnhancerService> = HashMap()\r
-\r
-    fun register(key: String, bluePrintEnhancerService: BluePrintEnhancerService) {\r
-        bluePrintEnhancerServices[key] = bluePrintEnhancerService\r
-    }\r
-\r
-    /**\r
-     * Called by clients to get a Blueprint Parser for the Blueprint parser type\r
-     */\r
-    fun instance(key: String): BluePrintEnhancerService? {\r
-        return bluePrintEnhancerServices.get(key)\r
-    }\r
-}\r
index 875cbea..46da9d9 100644 (file)
@@ -71,7 +71,7 @@ class BluePrintContext(serviceTemplate: ServiceTemplate) {
     }\r
 \r
     fun nodeTypeInterface(nodeTypeName: String, interfaceName: String): InterfaceDefinition? {\r
-        return nodeTypeByName(nodeTypeName).interfaces?.values?.first()\r
+        return nodeTypeByName(nodeTypeName).interfaces?.get(interfaceName)\r
     }\r
 \r
     fun nodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, operationName: String): OperationDefinition? {\r
@@ -155,9 +155,9 @@ class BluePrintContext(serviceTemplate: ServiceTemplate) {
     }\r
 \r
     fun nodeTemplateRequirementNode(nodeTemplateName: String, requirementName: String): NodeTemplate {\r
-        val nodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node\r
+        val requirementNodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node\r
                 ?: throw BluePrintException(String.format("failed to get node name for node template's (%s) requirement's (%s) " + nodeTemplateName, requirementName))\r
-        return nodeTemplateByName(nodeTemplateName)\r
+        return nodeTemplateByName(requirementNodeTemplateName)\r
     }\r
 \r
     fun nodeTemplateCapabilityProperty(nodeTemplateName: String, capabilityName: String, propertyName: String): Any? {\r
index 82e232d..6a50680 100644 (file)
@@ -99,7 +99,7 @@ object BluePrintExpressionService {
             arrayNode.size() > 3 -> {\r
                 reqOrCapEntityName = arrayNode[1].textValue()\r
                 propertyName = arrayNode[2].textValue()\r
-                val propertyPaths: List<String> = arrayNode.filterIndexed { index, obj ->\r
+                val propertyPaths: List<String> = arrayNode.filterIndexed { index, _ ->\r
                     index >= 3\r
                 }.map { it.textValue() }\r
                 subProperty = propertyPaths.joinToString("/")\r
index a7c14ad..dec7a50 100644 (file)
@@ -35,19 +35,19 @@ import java.io.Serializable
 interface BluePrintRepoService : Serializable {\r
 \r
     @Throws(BluePrintException::class)\r
-    fun getNodeType(nodeTypeName: String): Mono<NodeType>?\r
+    fun getNodeType(nodeTypeName: String): Mono<NodeType>\r
 \r
     @Throws(BluePrintException::class)\r
-    fun getDataType(dataTypeName: String): Mono<DataType>?\r
+    fun getDataType(dataTypeName: String): Mono<DataType>\r
 \r
     @Throws(BluePrintException::class)\r
-    fun getArtifactType(artifactTypeName: String): Mono<ArtifactType>?\r
+    fun getArtifactType(artifactTypeName: String): Mono<ArtifactType>\r
 \r
     @Throws(BluePrintException::class)\r
-    fun getRelationshipType(relationshipTypeName: String): Mono<RelationshipType>?\r
+    fun getRelationshipType(relationshipTypeName: String): Mono<RelationshipType>\r
 \r
     @Throws(BluePrintException::class)\r
-    fun getCapabilityDefinition(capabilityDefinitionName: String): Mono<CapabilityDefinition>?\r
+    fun getCapabilityDefinition(capabilityDefinitionName: String): Mono<CapabilityDefinition>\r
 \r
 }\r
 \r
@@ -63,30 +63,30 @@ open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoServic
     private val relationshipTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE)\r
     private val extension = ".json"\r
 \r
-    override fun getDataType(dataTypeName: String): Mono<DataType>? {\r
+    override fun getDataType(dataTypeName: String): Mono<DataType> {\r
         val fileName = dataTypePath.plus(BluePrintConstants.PATH_DIVIDER)\r
                 .plus(dataTypeName).plus(extension)\r
         return getModelType(fileName, DataType::class.java)\r
     }\r
 \r
-    override fun getNodeType(nodeTypeName: String): Mono<NodeType>? {\r
+    override fun getNodeType(nodeTypeName: String): Mono<NodeType> {\r
         val fileName = nodeTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(nodeTypeName).plus(extension)\r
         return getModelType(fileName, NodeType::class.java)\r
     }\r
 \r
-    override fun getArtifactType(artifactTypeName: String): Mono<ArtifactType>? {\r
+    override fun getArtifactType(artifactTypeName: String): Mono<ArtifactType> {\r
         val fileName = artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER)\r
                 .plus(artifactTypeName).plus(extension)\r
         return getModelType(fileName, ArtifactType::class.java)\r
     }\r
 \r
-    override fun getRelationshipType(relationshipTypeName: String): Mono<RelationshipType>? {\r
+    override fun getRelationshipType(relationshipTypeName: String): Mono<RelationshipType> {\r
         val fileName = relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER)\r
                 .plus(relationshipTypeName).plus(extension)\r
         return getModelType(fileName, RelationshipType::class.java)\r
     }\r
 \r
-    override fun getCapabilityDefinition(capabilityDefinitionName: String): Mono<CapabilityDefinition>? {\r
+    override fun getCapabilityDefinition(capabilityDefinitionName: String): Mono<CapabilityDefinition> {\r
         val fileName = capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER)\r
                 .plus(capabilityDefinitionName).plus(extension)\r
         return getModelType(fileName, CapabilityDefinition::class.java)\r
index 1fdb6c3..2485abd 100644 (file)
@@ -308,7 +308,7 @@ open class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var c
 \r
     open fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode) {\r
         log.info("assign workflow {} input value ({})", workflowName, jsonNode.toString())\r
-        bluePrintContext.workflowByName(workflowName)?.inputs?.forEach { propertyName, property ->\r
+        bluePrintContext.workflowByName(workflowName)?.inputs?.forEach { propertyName, _ ->\r
             val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)\r
                     ?: NullNode.getInstance()\r
             setWorkflowInputValue(workflowName, propertyName, valueNode)\r
index 3bea59f..7ad3833 100644 (file)
@@ -236,7 +236,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
         message.appendln("---> Workflow :" + paths.joinToString(separator))\r
         // Step Validation Start\r
         paths.add("steps")\r
-        workflow.steps?.forEach { stepName, step ->\r
+        workflow.steps?.forEach { stepName, _ ->\r
             paths.add(stepName)\r
             message.appendln("----> Steps :" + paths.joinToString(separator))\r
             paths.removeAt(paths.lastIndex)\r
@@ -583,10 +583,10 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
         }\r
     }\r
 \r
-    private fun checkPropertyDataType(dataType: String, propertyName: String) {\r
+    private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {\r
 \r
-        val dataType = serviceTemplate.dataTypes?.get(dataType)\r
-                ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataType, propertyName))\r
+        val dataType = serviceTemplate.dataTypes?.get(dataTypeName)\r
+                ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))\r
 \r
         checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)\r
 \r
@@ -596,7 +596,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
         if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {\r
             return true\r
         } else {\r
-            throw BluePrintException(format("DataType ({}) for the property ({}) is not valid", dataType))\r
+            throw BluePrintException(format("DataType({}) for the property({}) is not valid", dataType, propertyName))\r
         }\r
     }\r
 \r
index 07b819f..0e4c3e3 100644 (file)
@@ -43,7 +43,7 @@ object BluePrintRuntimeUtils {
 \r
     fun assignInputs(bluePrintContext: BluePrintContext, jsonNode: JsonNode, context: MutableMap<String, Any>) {\r
         log.info("assignInputs from input JSON ({})", jsonNode.toString())\r
-        bluePrintContext.inputs?.forEach { propertyName, property ->\r
+        bluePrintContext.inputs?.forEach { propertyName, _ ->\r
             val valueNode: JsonNode = jsonNode.at("/".plus(propertyName)) ?: NullNode.getInstance()\r
 \r
             val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(propertyName)\r
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt
deleted file mode 100644 (file)
index 8e6d5ef..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*\r
- * Copyright Â© 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright Â© 2018 IBM.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.core.service\r
-\r
-import org.junit.Test\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.ServiceTemplateUtils\r
-\r
-/**\r
- * BluePrintEnhancerServiceTest\r
- * @author Brinda Santh\r
- *\r
- */\r
-\r
-class BluePrintEnhancerServiceTest {\r
-    val basePath = "load/model_type"\r
-\r
-    @Test\r
-    fun testEnrichBlueprint() {\r
-        val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath)\r
-        val bluePrintEnhancerService: BluePrintEnhancerService = BluePrintEnhancerDefaultService(bluePrintEnhancerRepoFileService)\r
-\r
-        val serviceTemplate = ServiceTemplateUtils.getServiceTemplate("load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json")\r
-        bluePrintEnhancerService.enhance(serviceTemplate)\r
-\r
-    }\r
-}
\ No newline at end of file
index 88aea91..b8cfdd4 100644 (file)
@@ -33,25 +33,25 @@ class BluePrintRepoFileServiceTest {
 \r
     @Test\r
     fun testGetDataType() {\r
-        val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")?.block()\r
+        val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate").block()\r
         assertNotNull(dataType, "Failed to get DataType from repo")\r
     }\r
 \r
     @Test\r
     fun testGetNodeType() {\r
-        val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")?.block()\r
+        val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment").block()\r
         assertNotNull(nodeType, "Failed to get NodeType from repo")\r
     }\r
 \r
     @Test\r
     fun testGetArtifactType() {\r
-        val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")?.block()\r
+        val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity").block()\r
         assertNotNull(nodeType, "Failed to get ArtifactType from repo")\r
     }\r
 \r
     @Test(expected = FileNotFoundException::class)\r
     fun testModelNotFound() {\r
-        val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found")?.block()\r
+        val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found").block()\r
         assertNotNull(dataType, "Failed to get DataType from repo")\r
     }\r
 }
\ No newline at end of file
index ff26087..d141ed0 100644 (file)
@@ -1,5 +1,6 @@
 /*
  *  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.
@@ -92,3 +93,8 @@ open class ResourceAssignment {
  * Default Source, Database Source, Rest Sources, etc)
  */
 interface ResourceSource : Serializable
+
+
+open class ResourceSourceMapping {
+    lateinit var resourceSourceMappings: MutableMap<String, String>
+}
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
new file mode 100644 (file)
index 0000000..2911ab2
--- /dev/null
@@ -0,0 +1,47 @@
+/*\r
+ *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory\r
+\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
+import org.onap.ccsdk.apps.controllerblueprints.core.format\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping\r
+\r
+/**\r
+ * ResourceSourceMappingFactory.\r
+ *\r
+ * @author Brinda Santh\r
+ */\r
+object ResourceSourceMappingFactory {\r
+\r
+    private val resourceSourceMappings: MutableMap<String, String> = hashMapOf()\r
+\r
+    fun registerSourceMapping(sourceInstance: String, nodeTypeName: String) {\r
+        resourceSourceMappings[sourceInstance] = nodeTypeName\r
+    }\r
+\r
+    fun getRegisterSourceMapping(sourceInstance: String): String {\r
+        return resourceSourceMappings[sourceInstance]\r
+                ?: throw BluePrintException(format("failed to get source({}) mapping", sourceInstance))\r
+    }\r
+\r
+    fun getRegisterSourceMapping(): ResourceSourceMapping {\r
+        val resourceSourceMapping = ResourceSourceMapping()\r
+        resourceSourceMapping.resourceSourceMappings = resourceSourceMappings\r
+        return resourceSourceMapping\r
+    }\r
+}\r
+\r
index fae509d..fc7f109 100644 (file)
@@ -25,6 +25,8 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
 import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
 import java.io.Serializable
 
 /**
@@ -65,12 +67,21 @@ 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!!)
+            } catch (e: BluePrintException) {
+                validationMessage.appendln(e.message + format(" for resource assignment({})", resourceAssignment.name))
+            }
+        }
     }
 
     open fun validateTemplateNDictionaryKeys(resourceAssignments: List<ResourceAssignment>) {
 
         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 }
@@ -79,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 }
@@ -86,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))
index 370e1ec..6c83e5f 100644 (file)
 package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service\r
 \r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
 import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileService\r
 import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition\r
 import reactor.core.publisher.Mono\r
+\r
 /**\r
  * ResourceDefinitionRepoService.\r
  *\r
@@ -30,6 +32,7 @@ import reactor.core.publisher.Mono
  */\r
 interface ResourceDefinitionRepoService : BluePrintRepoService {\r
 \r
+    @Throws(BluePrintException::class)\r
     fun getResourceDefinition(resourceDefinitionName: String): Mono<ResourceDefinition>\r
 }\r
 \r
index 14855d4..9f45d16 100644 (file)
@@ -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 (file)
index 0000000..bebe27d
--- /dev/null
@@ -0,0 +1,30 @@
+/*\r
+ *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils\r
+\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory\r
+\r
+object ResourceDictionaryTestUtils {\r
+\r
+    @JvmStatic\r
+    fun setUpResourceSourceMapping() {\r
+        ResourceSourceMappingFactory.registerSourceMapping("db", "source-db")\r
+        ResourceSourceMappingFactory.registerSourceMapping("input", "source-input")\r
+        ResourceSourceMappingFactory.registerSourceMapping("default", "source-default")\r
+        ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest")\r
+    }\r
+}
\ No newline at end of file
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
new file mode 100644 (file)
index 0000000..b67aa79
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+ *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory;\r
+\r
+import org.junit.Test;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping;\r
+import org.springframework.util.Assert;\r
+\r
+public class ResourceSourceMappingFactoryTest {\r
+\r
+    @Test\r
+    public void testRegisterResourceMapping() {\r
+\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
+\r
+        String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("db");\r
+        Assert.notNull(nodeTypeName, "Failed to get db mapping");\r
+\r
+        ResourceSourceMapping resourceSourceMapping = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping();\r
+        Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping");\r
+        Assert.notNull(resourceSourceMapping.getResourceSourceMappings(), "Failed to get resource source mappings");\r
+\r
+    }\r
+\r
+}\r
index 6216d5b..87ebb70 100644 (file)
@@ -23,6 +23,9 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
 import com.att.eelf.configuration.EELFManager\r
+import org.junit.Before\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils\r
+\r
 /**\r
  * ResourceAssignmentValidationServiceTest.\r
  *\r
@@ -30,6 +33,12 @@ import com.att.eelf.configuration.EELFManager
  */\r
 class ResourceAssignmentValidationServiceTest {\r
     private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceTest::class.java)\r
+    @Before\r
+    fun setUp() {\r
+        // Setup dummy Source Instance Mapping\r
+        ResourceDictionaryTestUtils.setUpResourceSourceMapping()\r
+    }\r
+\r
     @Test\r
     fun testValidateSuccess() {\r
         log.info("**************** testValidateSuccess *****************")\r
diff --git a/components/resource-dict/src/test/resources/enrich/simple-enrich.json b/components/resource-dict/src/test/resources/enrich/simple-enrich.json
deleted file mode 100644 (file)
index 641da80..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-[\r
-  {\r
-    "name": "rs-db-source",\r
-    "input-param": true,\r
-    "property": {\r
-      "type": "string",\r
-      "required": true\r
-    },\r
-    "dictionary-name": "db-source",\r
-    "dictionary-source": "db",\r
-    "dependencies": [\r
-      "input-source"\r
-    ]\r
-  },\r
-  {\r
-    "name": "ra-default-source",\r
-    "input-param": true,\r
-    "property": {\r
-      "type": "string",\r
-      "required": true\r
-    },\r
-    "dictionary-name": "default-source",\r
-    "dictionary-source": "default",\r
-    "dependencies": []\r
-  },\r
-  {\r
-    "name": "ra-input-source",\r
-    "input-param": true,\r
-    "property": {\r
-      "type": "string",\r
-      "required": true\r
-    },\r
-    "dictionary-name": "input-source",\r
-    "dictionary-source": "input",\r
-    "dependencies": []\r
-  }\r
-]\r
index 4836cd2..6fed53e 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *  Modifications Copyright Â© 2018 IBM.\r
  *\r
  *  Licensed under the Apache License, Version 2.0 (the "License");\r
  *  you may not use this file except in compliance with the License.\r
@@ -21,22 +22,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode
 import io.swagger.annotations.ApiModelProperty\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
 \r
-/*\r
- *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- */\r
-\r
 /**\r
  * BlueprintProcessorData\r
  * @author Brinda Santh\r
@@ -49,7 +34,7 @@ open class ResourceResolutionInput {
     @get:ApiModelProperty(required=true)\r
     lateinit var actionIdentifiers: ActionIdentifiers\r
     @get:ApiModelProperty(required=true)\r
-    lateinit var resourceAssignments: List<ResourceAssignment>\r
+    lateinit var resourceAssignments: MutableList<ResourceAssignment>\r
     @get:ApiModelProperty(required=true )\r
     lateinit var payload: ObjectNode\r
 }\r
@@ -62,7 +47,7 @@ open class ResourceResolutionOutput {
     @get:ApiModelProperty(required=true)\r
     lateinit var status: Status\r
     @get:ApiModelProperty(required=true)\r
-    lateinit var resourceAssignments: List<ResourceAssignment>\r
+    lateinit var resourceAssignments: MutableList<ResourceAssignment>\r
 }\r
 \r
 open class ExecutionServiceInput {\r
index f42613c..feacbca 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *  Modifications Copyright Â© 2018 IBM.\r
  *\r
  *  Licensed under the Apache License, Version 2.0 (the "License");\r
  *  you may not use this file except in compliance with the License.\r
@@ -18,12 +19,15 @@ package org.onap.ccsdk.apps.blueprintsprocessor.core.factory
 \r
 import com.att.eelf.configuration.EELFManager\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException\r
-import org.slf4j.Logger\r
-import org.slf4j.LoggerFactory\r
 import org.springframework.context.ApplicationContext\r
 import org.springframework.context.ApplicationContextAware\r
 import org.springframework.stereotype.Service\r
 \r
+/**\r
+ * ComponentNode\r
+ *\r
+ * @author Brinda Santh\r
+ */\r
 interface ComponentNode {\r
 \r
     @Throws(BluePrintProcessorException::class)\r
@@ -39,8 +43,13 @@ interface ComponentNode {
     fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>)\r
 }\r
 \r
+/**\r
+ * ComponentNodeFactory\r
+ *\r
+ * @author Brinda Santh\r
+ */\r
 @Service\r
-class ComponentNodeFactory : ApplicationContextAware {\r
+open class ComponentNodeFactory : ApplicationContextAware {\r
     private val log = EELFManager.getInstance().getLogger(ComponentNodeFactory::class.java)\r
 \r
     var componentNodes: MutableMap<String, ComponentNode> = hashMapOf()\r
index 8104c10..01a110d 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *  Modifications Copyright Â© 2018 IBM.\r
  *\r
  *  Licensed under the Apache License, Version 2.0 (the "License");\r
  *  you may not use this file except in compliance with the License.\r
@@ -18,14 +19,17 @@ package org.onap.ccsdk.apps.blueprintsprocessor.core.factory
 \r
 import com.att.eelf.configuration.EELFManager\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor\r
-import org.slf4j.Logger\r
-import org.slf4j.LoggerFactory\r
 import org.springframework.context.ApplicationContext\r
 import org.springframework.context.ApplicationContextAware\r
 import org.springframework.stereotype.Service\r
 \r
+/**\r
+ * ResourceAssignmentProcessorFactory\r
+ *\r
+ * @author Brinda Santh\r
+ */\r
 @Service\r
-class ResourceAssignmentProcessorFactory : ApplicationContextAware {\r
+open class ResourceAssignmentProcessorFactory : ApplicationContextAware {\r
 \r
     private val log = EELFManager.getInstance().getLogger(ResourceAssignmentProcessorFactory::class.java)\r
 \r
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/JavaScriptExecuteComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/JavaScriptExecuteComponent.kt
new file mode 100644 (file)
index 0000000..427dc87
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *  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.blueprintsprocessor.services.execution
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ComponentNode
+import org.springframework.stereotype.Component
+
+/**
+ * JavaScriptExecuteComponent
+ *
+ * @author Brinda Santh
+ */
+@Component("component-javascript-executor")
+class JavaScriptExecuteComponent : ComponentNode {
+
+    override fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/PythonExecuteComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/PythonExecuteComponent.kt
new file mode 100644 (file)
index 0000000..59be1f5
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ *  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.blueprintsprocessor.services.execution
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ComponentNode
+import org.springframework.stereotype.Component
+
+/**
+ * PythonExecuteComponent
+ *
+ * @author Brinda Santh
+ */
+@Component("component-python-executor")
+class PythonExecuteComponent : ComponentNode {
+    override fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+
+    override fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+    }
+}
\ No newline at end of file
index 14ab784..d442c96 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *  Modifications Copyright Â© 2018 IBM.\r
  *\r
  *  Licensed under the Apache License, Version 2.0 (the "License");\r
  *  you may not use this file except in compliance with the License.\r
 \r
 package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution\r
 \r
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.BlueprintProcessorException\r
+import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status\r
+import org.onap.ccsdk.apps.controllerblueprints.core.format\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.BulkResourceSequencingUtils\r
 import org.springframework.stereotype.Service\r
 \r
 /**\r
@@ -28,7 +34,7 @@ import org.springframework.stereotype.Service
  */\r
 \r
 @Service\r
-class ResourceResolutionService {\r
+class ResourceResolutionService(private val resourceAssignmentProcessorFactory: ResourceAssignmentProcessorFactory) {\r
 \r
     fun resolveResource(resourceResolutionInput: ResourceResolutionInput): ResourceResolutionOutput {\r
         val resourceResolutionOutput = ResourceResolutionOutput()\r
@@ -36,6 +42,10 @@ class ResourceResolutionService {
         resourceResolutionOutput.commonHeader = resourceResolutionInput.commonHeader\r
         resourceResolutionOutput.resourceAssignments = resourceResolutionInput.resourceAssignments\r
 \r
+        val context = hashMapOf<String, Any>()\r
+\r
+        process(resourceResolutionOutput.resourceAssignments, context)\r
+\r
         val status = Status()\r
         status.code = 200\r
         status.message = "Success"\r
@@ -43,4 +53,28 @@ class ResourceResolutionService {
 \r
         return resourceResolutionOutput\r
     }\r
+\r
+    fun process(resourceAssignments: MutableList<ResourceAssignment>, context: MutableMap<String, Any>): Unit {\r
+\r
+        val bulkSequenced = BulkResourceSequencingUtils.process(resourceAssignments)\r
+\r
+        bulkSequenced.map { batchResourceAssignments ->\r
+            batchResourceAssignments.filter { it.name != "*" && it.name != "start"}\r
+            .map { resourceAssignment ->\r
+                val dictionarySource = resourceAssignment.dictionarySource\r
+                val processorInstanceName = "resource-assignment-processor-".plus(dictionarySource)\r
+                val resourceAssignmentProcessor = resourceAssignmentProcessorFactory.getInstance(processorInstanceName)\r
+                        ?: throw BlueprintProcessorException(format("failed to get resource processor for instance name({}) " +\r
+                                "for resource assignment({})", processorInstanceName, resourceAssignment.name))\r
+                try {\r
+                    resourceAssignmentProcessor.validate(resourceAssignment, context)\r
+                    resourceAssignmentProcessor.process(resourceAssignment, context)\r
+                } catch (e: Exception) {\r
+                    resourceAssignmentProcessor.errorHandle(resourceAssignment, context)\r
+                    throw BlueprintProcessorException(e)\r
+                }\r
+\r
+            }\r
+        }\r
+    }\r
 }\r
index 396ca1d..9580ca4 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *  Modifications Copyright Â© 2018 IBM.\r
  *\r
  *  Licensed under the Apache License, Version 2.0 (the "License");\r
  *  you may not use this file except in compliance with the License.\r
 \r
 package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor\r
 \r
+import com.att.eelf.configuration.EELFManager\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor\r
 import org.springframework.stereotype.Service\r
 \r
+/**\r
+ * DefaultResourceAssignmentProcessor\r
+ *\r
+ * @author Brinda Santh\r
+ */\r
 @Service("resource-assignment-processor-default")\r
 open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor {\r
-    override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
-        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    private val log = EELFManager.getInstance().getLogger(DefaultResourceAssignmentProcessor::class.java)\r
+\r
+    override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        log.info("Validation Resource Assignments")\r
     }\r
 \r
     override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
-        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+        log.info("Processing Resource Assignments")\r
     }\r
 \r
-    override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
-        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        log.info("ErrorHandle Resource Assignments")\r
     }\r
 \r
-    override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
-        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        log.info("Re Trigger Resource Assignments")\r
     }\r
 }
\ No newline at end of file
index 9d0734e..05f7d5c 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *  Modifications Copyright Â© 2018 IBM.\r
  *\r
  *  Licensed under the Apache License, Version 2.0 (the "License");\r
  *  you may not use this file except in compliance with the License.\r
 \r
 package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor\r
 \r
+import com.att.eelf.configuration.EELFManager\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor\r
 import org.springframework.stereotype.Service\r
 \r
+/**\r
+ * InputResourceAssignmentProcessor\r
+ *\r
+ * @author Brinda Santh\r
+ */\r
 @Service("resource-assignment-processor-input")\r
 open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor {\r
-    override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
-        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    private val log = EELFManager.getInstance().getLogger(InputResourceAssignmentProcessor::class.java)\r
+\r
+    override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        log.info("Validation Resource Assignments")\r
     }\r
 \r
     override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
-        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+        log.info("Processing Resource Assignments")\r
     }\r
 \r
-    override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
-        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        log.info("ErrorHandle Resource Assignments")\r
     }\r
 \r
-    override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
-        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {\r
+        log.info("Re Trigger Resource Assignments")\r
     }\r
 }
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/MDSALResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/MDSALResourceAssignmentProcessor.kt
new file mode 100644 (file)
index 0000000..9d54cd4
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ *  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.blueprintsprocessor.services.resolution.processor
+
+import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor
+import org.springframework.stereotype.Service
+
+/**
+ * MDSALResourceAssignmentProcessor
+ *
+ * @author Brinda Santh
+ */
+@Service("resource-assignment-processor-mdsal")
+open class MDSALResourceAssignmentProcessor : ResourceAssignmentProcessor {
+    private val log = EELFManager.getInstance().getLogger(MDSALResourceAssignmentProcessor::class.java)
+
+    override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
+        log.info("Validation Resource Assignments")
+    }
+
+    override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
+        log.info("Processing Resource Assignments")
+    }
+
+    override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
+        log.info("ErrorHandle Resource Assignments")
+    }
+
+    override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
+        log.info("Re Trigger Resource Assignments")
+    }
+}
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/SdncResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/processor/SdncResourceAssignmentProcessor.kt
new file mode 100644 (file)
index 0000000..4b11f58
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ *  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.blueprintsprocessor.services.resolution.processor
+
+import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor
+import org.springframework.stereotype.Service
+
+/**
+ * SdncResourceAssignmentProcessor
+ *
+ * @author Brinda Santh
+ */
+@Service("resource-assignment-processor-db")
+open class SdncResourceAssignmentProcessor : ResourceAssignmentProcessor {
+
+    private val log = EELFManager.getInstance().getLogger(SdncResourceAssignmentProcessor::class.java)
+
+    override fun validate(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
+        log.info("Validation Resource Assignments")
+    }
+
+    override fun process(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
+        log.info("Processing Resource Assignments")
+    }
+
+    override fun errorHandle(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
+        log.info("ErrorHandle Resource Assignments")
+    }
+
+    override fun reTrigger(resourceAssignment: ResourceAssignment, context: MutableMap<String, Any>) {
+        log.info("Re Trigger Resource Assignments")
+    }
+
+}
\ No newline at end of file
index 6335990..0768c60 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
  *  Copyright Â© 2017-2018 AT&T Intellectual Property.\r
+ *  Modifications Copyright Â© 2018 IBM.\r
  *\r
  *  Licensed under the Apache License, Version 2.0 (the "License");\r
  *  you may not use this file except in compliance with the License.\r
@@ -24,6 +25,11 @@ import org.junit.Test;
 import org.junit.runner.RunWith;\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput;\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput;\r
+import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory;\r
+import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.DefaultResourceAssignmentProcessor;\r
+import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.InputResourceAssignmentProcessor;\r
+import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.MDSALResourceAssignmentProcessor;\r
+import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.SdncResourceAssignmentProcessor;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
 import org.slf4j.Logger;\r
@@ -42,7 +48,9 @@ import java.util.List;
  * @author Brinda Santh DATE : 8/15/2018\r
  */\r
 @RunWith(SpringRunner.class)\r
-@ContextConfiguration(classes = ResourceResolutionService.class)\r
+@ContextConfiguration(classes = {ResourceResolutionService.class, ResourceAssignmentProcessorFactory.class,\r
+        InputResourceAssignmentProcessor.class, DefaultResourceAssignmentProcessor.class,\r
+        SdncResourceAssignmentProcessor.class, MDSALResourceAssignmentProcessor.class})\r
 public class ResourceResolutionServiceTest {\r
     private static Logger log = LoggerFactory.getLogger(ResourceResolutionServiceTest.class);\r
 \r
@@ -57,8 +65,8 @@ public class ResourceResolutionServiceTest {
         String resourceResolutionInputContent = FileUtils.readFileToString(\r
                 new File("src/test/resources/payload/requests/sample-resourceresolution-request.json"), Charset.defaultCharset());\r
 \r
-        ResourceResolutionInput resourceResolutionInput = JacksonUtils.readValue(resourceResolutionInputContent, ResourceResolutionInput.class );\r
-        Assert.assertNotNull("failed to populate resourceResolutionInput request ",resourceResolutionInput);\r
+        ResourceResolutionInput resourceResolutionInput = JacksonUtils.readValue(resourceResolutionInputContent, ResourceResolutionInput.class);\r
+        Assert.assertNotNull("failed to populate resourceResolutionInput request ", resourceResolutionInput);\r
 \r
         String resourceAssignmentContent = FileUtils.readFileToString(\r
                 new File("src/test/resources/mapping/db/resource-assignments-simple.json"), Charset.defaultCharset());\r
@@ -68,13 +76,13 @@ public class ResourceResolutionServiceTest {
         Assert.assertTrue("failed to create ResourceAssignment from file", CollectionUtils.isNotEmpty(batchResourceAssignment));\r
         resourceResolutionInput.setResourceAssignments(batchResourceAssignment);\r
 \r
-        ObjectNode inputContent = (ObjectNode)JacksonUtils.jsonNodeFromFile("src/test/resources/payload/inputs/input.json");\r
-        Assert.assertNotNull("failed to populate input payload ",inputContent);\r
+        ObjectNode inputContent = (ObjectNode) JacksonUtils.jsonNodeFromFile("src/test/resources/payload/inputs/input.json");\r
+        Assert.assertNotNull("failed to populate input payload ", inputContent);\r
         resourceResolutionInput.setPayload(inputContent);\r
         log.info("ResourceResolutionInput : {}", JacksonUtils.getJson(resourceResolutionInput, true));\r
 \r
         ResourceResolutionOutput resourceResolutionOutput = resourceResolutionService.resolveResource(resourceResolutionInput);\r
-        Assert.assertNotNull("failed to populate output",resourceResolutionOutput);\r
+        Assert.assertNotNull("failed to populate output", resourceResolutionOutput);\r
 \r
     }\r
 }\r
index 02ce68b..ddcf32e 100644 (file)
@@ -1,12 +1,22 @@
 [\r
-       {\r
-               "name": "country",\r
-               "input-param": true,\r
-               "property": {\r
-                       "type": "string"\r
-               },\r
-               "dictionary-name": "country",\r
-               "dictionary-source": "db",\r
-               "dependencies": []\r
-       }\r
+  {\r
+    "name": "country",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "string"\r
+    },\r
+    "dictionary-name": "country",\r
+    "dictionary-source": "db",\r
+    "dependencies": ["state"]\r
+  },\r
+  {\r
+    "name": "state",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "string"\r
+    },\r
+    "dictionary-name": "state",\r
+    "dictionary-source": "input",\r
+    "dependencies": []\r
+  }\r
 ]\r
index 644e3b4..8cda363 100644 (file)
@@ -20,4 +20,5 @@
 \r
 **/*versionsBackup\r
 **/blackDuckHub*\r
-**/*.jsonld
\ No newline at end of file
+**/*.jsonld
+/target-ide/
diff --git a/ms/controllerblueprints/application/load/resource_dictionary/sample-default-source.json b/ms/controllerblueprints/application/load/resource_dictionary/sample-default-source.json
new file mode 100644 (file)
index 0000000..395b0dd
--- /dev/null
@@ -0,0 +1,16 @@
+{\r
+  "tags": "sample-default-source",\r
+  "name": "sample-default-source",\r
+  "property" :{\r
+    "description": "name of the ",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "brindasanth@onap.com",\r
+  "sources": {\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
@@ -1,16 +1,16 @@
 {\r
-       "name": "input-source",\r
+       "name": "sample-input-source",\r
        "property" :{\r
                "description": "name of the ",\r
                "type": "string"\r
        },\r
        "updated-by": "brindasanth@onap.com",\r
-       "tags": "action-name, brindasanth",\r
+       "tags": "sample-input-source",\r
        "sources": {\r
                "input": {\r
                        "type": "source-input",\r
                        "properties": {\r
-                               "key": "action-name"\r
+                               "key": "input-source"\r
                        }\r
                }\r
        }\r
diff --git a/ms/controllerblueprints/application/load/resource_dictionary/sample-licenses.json b/ms/controllerblueprints/application/load/resource_dictionary/sample-licenses.json
new file mode 100644 (file)
index 0000000..5834dd4
--- /dev/null
@@ -0,0 +1,29 @@
+{\r
+  "tags": "sample-licenses",\r
+  "name": "sample-licenses",\r
+  "property": {\r
+    "description" : " Sample Data for licences",\r
+    "required": true,\r
+    "type": "list",\r
+    "entry_schema": {\r
+      "type": "dt-license-key"\r
+    }\r
+  },\r
+  "updated-by": "brindasanth@onap.com",\r
+  "sources": {\r
+    "mdsal": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "url-path": "config/L3VNF-API:services/service-list/",\r
+        "path": "/licenses",\r
+        "input-key-mapping": {\r
+        },\r
+        "output-key-mapping": {\r
+          "licenses": "licenses"\r
+        },\r
+        "key-dependencies": []\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/application/load/resource_dictionary/sample-mdsal-source.json b/ms/controllerblueprints/application/load/resource_dictionary/sample-mdsal-source.json
new file mode 100644 (file)
index 0000000..25464d3
--- /dev/null
@@ -0,0 +1,25 @@
+{\r
+  "tags": "sample-mdsal-source",\r
+  "name": "sample-mdsal-source",\r
+  "property": {\r
+    "description": "Sample sample-mdsal-source",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "brindasanth@onap.com",\r
+  "sources": {\r
+    "mdsal": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type",\r
+        "path": "/v4-assigned-ip-list/0/v4-ip-prefix",\r
+        "input-key-mapping": {\r
+        },\r
+        "output-key-mapping": {\r
+          "mdsal-source": "v4-ip-prefix"\r
+        },\r
+        "key-dependencies": []\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
@@ -1,16 +1,16 @@
 {\r
-  "name": "v4-ip-type",\r
+  "name": "sample-v4-ip-type",\r
   "property": {\r
-    "description": "name of the ",\r
+    "description": "sample-v4-ip-type",\r
     "type": "string"\r
   },\r
   "updated-by": "brindasanth@onap.com",\r
-  "tags": "v4-ip-type, source-input, brindasanth",\r
+  "tags": "sample-v4-ip-type",\r
   "sources": {\r
     "input": {\r
       "type": "source-input",\r
       "properties": {\r
-        "key": "v4-ip-type"\r
+        "key": "sample-v4-ip-type"\r
       }\r
     }\r
   }\r
index b65d5bf..d281482 100644 (file)
@@ -53,4 +53,7 @@ load.dataTypePath=load/model_type/data_type
 load.nodeTypePath=load/model_type/node_type
 load.artifactTypePath=load/model_type/artifact_type
 load.resourceDictionaryPath=load/resource_dictionary
-load.blueprintsPath=load/blueprints
\ No newline at end of file
+load.blueprintsPath=load/blueprints
+
+# Load Resource Source Mappings
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest
\ No newline at end of file
index 38f81c1..24f4deb 100644 (file)
             </plugin>\r
         </plugins>\r
     </build>\r
+    \r
+    \r
 </project>\r
 \r
index 3bcbbd9..5c6acf9 100644 (file)
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and\r
 # limitations under the License.\r
 #\r
+spring.main.banner-mode=off\r
+\r
 appName=ControllerBluePrints\r
 ms_name=org.onap.ccsdk.apps.controllerblueprints\r
 appVersion=1.0.0\r
@@ -33,4 +35,7 @@ load.dataTypePath=load/model_type/data_type
 load.nodeTypePath=load/model_type/node_type\r
 load.artifactTypePath=load/model_type/artifact_type\r
 load.resourceDictionaryPath=load/resource_dictionary\r
-load.blueprintsPath=load/blueprints
\ No newline at end of file
+load.blueprintsPath=load/blueprints\r
+\r
+# Load Resource Source Mappings\r
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest
\ No newline at end of file
index 37c0b84..7a2c679 100644 (file)
         <name.space>org.onap.ccsdk.apps</name.space>     <!-- <name.space>${namespace}</name.space> -->\r
         <serviceArtifactName>controllerblueprints</serviceArtifactName>\r
         <image.name>onap/ccsdk-controllerblueprints</image.name>\r
-    </properties>\r
+               <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>\r
+               <docker.push.phase>deploy</docker.push.phase>\r
+               <docker.verbose>true</docker.verbose>\r
+       </properties>\r
 \r
     <dependencies>\r
         <dependency>\r
                     </execution>\r
                 </executions>\r
             </plugin>\r
-            <plugin>\r
-                <groupId>io.fabric8</groupId>\r
-                <artifactId>docker-maven-plugin</artifactId>\r
-                <version>0.26.1</version>\r
-                <inherited>false</inherited>\r
-                <configuration>\r
-                    <images>\r
-                        <image>\r
-                            <name>${image.name}</name>\r
-                            <build>\r
-                                <cleanup>try</cleanup>\r
-                                <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>\r
-                                <tags>\r
-                                    <tag>${project.version}</tag>\r
-                                    <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>\r
-                                    <tag>${project.docker.latesttag.version}</tag>\r
-                                </tags>\r
-                            </build>\r
-                        </image>\r
-                    </images>\r
-                    <verbose>true</verbose>\r
-                </configuration>\r
-                <executions>\r
-                    <!--<execution>-->\r
-                        <!--<id>build-images</id>-->\r
-                        <!--<phase>package</phase>-->\r
-                        <!--<goals>-->\r
-                            <!--<goal>build</goal>-->\r
-                        <!--</goals>-->\r
-                    <!--</execution>-->\r
-                    <execution>\r
-                        <id>push-images</id>\r
-                        <phase>deploy</phase>\r
-                        <goals>\r
-                            <goal>build</goal>\r
-                            <goal>push</goal>\r
-                        </goals>\r
-                    </execution>\r
-                </executions>\r
-            </plugin>\r
+\r
         </plugins>\r
     </build>\r
+\r
+       <profiles>\r
+               <profile>\r
+                       <id>docker</id>\r
+                       <build>\r
+                               <plugins>\r
+                                       <plugin>\r
+                                               <groupId>io.fabric8</groupId>\r
+                                               <artifactId>docker-maven-plugin</artifactId>\r
+                                               <version>0.26.1</version>\r
+                                               <inherited>false</inherited>\r
+                                               <configuration>\r
+                                                       <images>\r
+                                                               <image>\r
+                                                                       <name>${image.name}</name>\r
+                                                                       <build>\r
+                                                                               <cleanup>try</cleanup>\r
+                                                                               <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>\r
+                                                                               <tags>\r
+                                                                                       <tag>${project.version}</tag>\r
+                                                                                       <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>\r
+                                                                                       <tag>${project.docker.latesttag.version}</tag>\r
+                                                                               </tags>\r
+                                                                       </build>\r
+                                                               </image>\r
+                                                       </images>\r
+                                                       <verbose>true</verbose>\r
+                                               </configuration>\r
+                                               <executions>\r
+                                                       <execution>\r
+                                                               <id>push-images</id>\r
+                                                               <phase>${docker.build.phase}</phase>\r
+                                                               <goals>\r
+                                                                       <goal>build</goal>\r
+                                                                       <goal>push</goal>\r
+                                                               </goals>\r
+                                                       </execution>\r
+                                               </executions>\r
+                                       </plugin>\r
+                               </plugins>\r
+                       </build>\r
+               </profile>\r
+\r
+       </profiles>\r
 </project>\r
 \r
index 524e0eb..e95c1f7 100644 (file)
@@ -60,8 +60,8 @@
             <scope>runtime</scope>\r
         </dependency>\r
         <dependency>\r
-        <groupId>org.mariadb.jdbc</groupId>\r
-        <artifactId>mariadb-java-client</artifactId>\r
+            <groupId>org.mariadb.jdbc</groupId>\r
+            <artifactId>mariadb-java-client</artifactId>\r
         </dependency>\r
         <dependency>\r
             <groupId>org.powermock</groupId>\r
index 5a4a287..fc7410f 100644 (file)
 \r
 package org.onap.ccsdk.apps.controllerblueprints.service;\r
 \r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
+import org.apache.commons.collections.CollectionUtils;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;\r
+import org.springframework.beans.factory.annotation.Value;\r
 import org.springframework.stereotype.Component;\r
 \r
 import javax.annotation.PostConstruct;\r
+import java.util.List;\r
 \r
 @Component\r
 @SuppressWarnings("unused")\r
 public class ApplicationRegistrationService {\r
+    private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationRegistrationService.class);\r
+\r
+    @Value("#{'${resourceSourceMappings}'.split(',')}")\r
+    private List<String> resourceSourceMappings;\r
 \r
     @PostConstruct\r
-    public void register(){\r
+    public void register() {\r
         registerDictionarySources();\r
     }\r
 \r
-    public void registerDictionarySources(){\r
-\r
+    public void registerDictionarySources() {\r
+        log.info("Registering Dictionary Sources : {}", resourceSourceMappings);\r
+        if (CollectionUtils.isNotEmpty(resourceSourceMappings)) {\r
+            resourceSourceMappings.forEach(resourceSourceMapping -> {\r
+                String[] mappingKeyValue = resourceSourceMapping.split("=");\r
+                if (mappingKeyValue != null && mappingKeyValue.length == 2) {\r
+                    ResourceSourceMappingFactory.INSTANCE.registerSourceMapping(mappingKeyValue[0].trim(), mappingKeyValue[1].trim());\r
+                } else {\r
+                    log.warn("failed to get resource source mapping {}", resourceSourceMapping);\r
+                }\r
+            });\r
+        }\r
     }\r
 }\r
index 8e98f94..ef3b4a4 100644 (file)
@@ -25,12 +25,13 @@ import org.jetbrains.annotations.NotNull;
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.*;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerDefaultService;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.enhancer.BluePrintEnhancerDefaultService;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.enhancer.ResourceAssignmentEnhancerService;\r
 import org.springframework.stereotype.Service;\r
 \r
 import java.util.HashMap;\r
@@ -48,14 +49,18 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
 \r
     private static EELFLogger log = EELFManager.getInstance().getLogger(BluePrintEnhancerService.class);\r
 \r
+    private ResourceAssignmentEnhancerService resourceAssignmentEnhancerService;\r
+\r
     private Map<String, DataType> recipeDataTypes = new HashMap<>();\r
 \r
-    public BluePrintEnhancerService(BluePrintRepoService bluePrintEnhancerRepoDBService) {\r
-        super(bluePrintEnhancerRepoDBService);\r
+    public BluePrintEnhancerService(ResourceDefinitionRepoService resourceDefinitionRepoService,\r
+                                    ResourceAssignmentEnhancerService resourceAssignmentEnhancerService) {\r
+        super(resourceDefinitionRepoService);\r
+        this.resourceAssignmentEnhancerService = resourceAssignmentEnhancerService;\r
     }\r
 \r
     @Override\r
-    public void enrichTopologyTemplate(@NotNull ServiceTemplate serviceTemplate) throws BluePrintException{\r
+    public void enrichTopologyTemplate(@NotNull ServiceTemplate serviceTemplate) throws BluePrintException {\r
         super.enrichTopologyTemplate(serviceTemplate);\r
 \r
         // Update the Recipe Inputs and DataTypes\r
@@ -101,7 +106,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
             // Modified for ONAP converted Object to JsonNode\r
             JsonNode recipeNames = nodeTemplate.getProperties().get(ConfigModelConstant.PROPERTY_RECIPE_NAMES);\r
 \r
-            log.info("Processing Receipe Names : {} ", recipeNames);\r
+            log.info("Processing Recipe Names : {} ", recipeNames);\r
 \r
             if (recipeNames != null && recipeNames.isArray() && recipeNames.size() > 0) {\r
 \r
@@ -159,6 +164,9 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
                         JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment.class);\r
 \r
                 Preconditions.checkNotNull(resourceAssignments, "Failed to Processing Resource Mapping " + resourceAssignmentContent);\r
+                // Enhance Resource Assignment\r
+                resourceAssignmentEnhancerService.enhanceBluePrint(this, resourceAssignments);\r
+\r
                 dataTypeProperties = new HashMap<>();\r
 \r
                 for (ResourceAssignment resourceAssignment : resourceAssignments) {\r
@@ -167,9 +175,6 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
                             && resourceAssignment.getProperty() != null\r
                             && StringUtils.isNotBlank(resourceAssignment.getName())) {\r
 \r
-                        // Enrich the Property Definition\r
-                        super.enrichPropertyDefinition(resourceAssignment.getName(), resourceAssignment.getProperty());\r
-\r
                         dataTypeProperties.put(resourceAssignment.getName(), resourceAssignment.getProperty());\r
 \r
                     }\r
@@ -23,28 +23,35 @@ import org.apache.commons.lang3.StringUtils;
 import org.jetbrains.annotations.NotNull;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.*;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.repository.ModelTypeRepository;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository;\r
 import org.springframework.stereotype.Service;\r
 import reactor.core.publisher.Mono;\r
 \r
 import java.util.Optional;\r
 \r
 /**\r
- * BluePrintRepoDBService\r
+ * ResourceDefinitionRepoDBService\r
  *\r
  * @author Brinda Santh\r
  */\r
 @Service\r
 @SuppressWarnings("unused")\r
-public class BluePrintRepoDBService implements BluePrintRepoService {\r
+public class ResourceDefinitionRepoDBService implements ResourceDefinitionRepoService {\r
 \r
     private ModelTypeRepository modelTypeRepository;\r
+    private ResourceDictionaryRepository resourceDictionaryRepository;\r
+\r
     @SuppressWarnings("unused")\r
-    public BluePrintRepoDBService(ModelTypeRepository modelTypeRepository) {\r
+    public ResourceDefinitionRepoDBService(ModelTypeRepository modelTypeRepository,\r
+                                           ResourceDictionaryRepository resourceDictionaryRepository) {\r
         this.modelTypeRepository = modelTypeRepository;\r
+        this.resourceDictionaryRepository = resourceDictionaryRepository;\r
     }\r
 \r
     @Override\r
@@ -72,6 +79,17 @@ public class BluePrintRepoDBService implements BluePrintRepoService {
         return getModelType(capabilityDefinitionName, CapabilityDefinition.class);\r
     }\r
 \r
+    @NotNull\r
+    @Override\r
+    public Mono<ResourceDefinition> getResourceDefinition(@NotNull String resourceDefinitionName) throws BluePrintException{\r
+        Optional<ResourceDictionary> dbResourceDictionary = resourceDictionaryRepository.findByName(resourceDefinitionName);\r
+        if(dbResourceDictionary.isPresent()){\r
+            return Mono.just(dbResourceDictionary.get().getDefinition());\r
+        }else{\r
+            throw new BluePrintException(String.format("failed to get resource dictionary (%s) from repo", resourceDefinitionName));\r
+        }\r
+    }\r
+\r
     private <T> Mono<T> getModelType(String modelName, Class<T> valueClass) throws BluePrintException {\r
         Preconditions.checkArgument(StringUtils.isNotBlank(modelName),\r
                 "Failed to get model from repo, model name is missing");\r
index 62aa0e2..fd73db3 100644 (file)
@@ -22,8 +22,9 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.validator.ResourceDictionaryValidator;\r
@@ -105,7 +106,7 @@ public class ResourceDictionaryService {
      */\r
     public ResourceDictionary saveResourceDictionary(ResourceDictionary resourceDictionary) {\r
         Preconditions.checkNotNull(resourceDictionary, "Resource Dictionary information is missing");\r
-        Preconditions.checkNotNull(resourceDictionary.getDefinition(),"Resource Dictionary definition information is missing");\r
+        Preconditions.checkNotNull(resourceDictionary.getDefinition(), "Resource Dictionary definition information is missing");\r
 \r
         ResourceDefinition resourceDefinition = resourceDictionary.getDefinition();\r
         Preconditions.checkNotNull(resourceDefinition, "failed to get resource definition from content");\r
@@ -153,4 +154,12 @@ public class ResourceDictionaryService {
         Preconditions.checkArgument(StringUtils.isNotBlank(name), "Resource dictionary Name Information is missing.");\r
         resourceDictionaryRepository.deleteByName(name);\r
     }\r
+\r
+    /**\r
+     * This is a getResourceSourceMapping service\r
+     *\r
+     */\r
+    public ResourceSourceMapping getResourceSourceMapping() {\r
+        return ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping();\r
+    }\r
 }\r
index e0cf6c6..287d413 100644 (file)
@@ -18,6 +18,7 @@
 package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
 \r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
 import org.springframework.http.MediaType;\r
@@ -76,4 +77,10 @@ public class ResourceDictionaryRest {
 \r
     }\r
 \r
+    @GetMapping(path = "/source-mapping", produces = MediaType.APPLICATION_JSON_VALUE)\r
+    public @ResponseBody\r
+    ResourceSourceMapping getResourceSourceMapping() {\r
+        return resourceDictionaryService.getResourceSourceMapping();\r
+    }\r
+\r
 }\r
@@ -15,7 +15,7 @@
  * limitations under the License.\r
  */\r
 \r
-package org.onap.ccsdk.apps.controllerblueprints.core.service\r
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer\r
 \r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes\r
@@ -23,6 +23,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.*
 import org.onap.ccsdk.apps.controllerblueprints.core.format\r
 import com.att.eelf.configuration.EELFLogger\r
 import com.att.eelf.configuration.EELFManager\r
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils\r
 import java.io.Serializable\r
 \r
@@ -170,7 +171,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe
     }\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
@@ -245,7 +246,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe
     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
@@ -253,7 +254,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe
 \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
@@ -261,7 +262,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe
 \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
  *  limitations under the License.\r
  */\r
 \r
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service\r
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer\r
 \r
 import com.att.eelf.configuration.EELFLogger\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerDefaultService\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerService\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition\r
 import com.att.eelf.configuration.EELFManager\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes\r
+import org.onap.ccsdk.apps.controllerblueprints.core.format\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationDefaultService\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService\r
+import org.springframework.stereotype.Service\r
 \r
 /**\r
  * ResourceAssignmentEnhancerService.\r
@@ -45,6 +50,7 @@ interface ResourceAssignmentEnhancerService {
  *\r
  * @author Brinda Santh\r
  */\r
+@Service\r
 open class ResourceAssignmentEnhancerDefaultService(private val resourceDefinitionRepoService: ResourceDefinitionRepoService)\r
     : ResourceAssignmentEnhancerService {\r
     private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationDefaultService::class.java)\r
@@ -56,20 +62,41 @@ open class ResourceAssignmentEnhancerDefaultService(private val resourceDefiniti
     override fun enhanceBluePrint(bluePrintEnhancerService: BluePrintEnhancerService,\r
                                   resourceAssignments: List<ResourceAssignment>) {\r
 \r
+        val uniqueSourceNodeTypeNames = hashSetOf<String>()\r
+\r
         // Iterate the Resource Assignment and\r
         resourceAssignments.map { resourceAssignment ->\r
             val dictionaryName = resourceAssignment.dictionaryName!!\r
             val dictionarySource = resourceAssignment.dictionarySource!!\r
-            log.info("Enriching Assignment name({}), dictionary name({}), source({})", resourceAssignment.name,\r
+            log.debug("Enriching Assignment name({}), dictionary name({}), source({})", resourceAssignment.name,\r
                     dictionaryName, dictionarySource)\r
-            // Get the Resource Definition from Repo\r
-            val resourceDefinition: ResourceDefinition = getResourceDefinition(dictionaryName)\r
+            val sourceNodeTypeName = ResourceSourceMappingFactory.getRegisterSourceMapping(dictionarySource)\r
+\r
+            // Add Unique Node Types\r
+            uniqueSourceNodeTypeNames.add(sourceNodeTypeName)\r
+\r
+            // TODO("Candidate for Optimisation")\r
+            if (checkResourceDefinitionNeeded(resourceAssignment)) {\r
+\r
+                bluePrintEnhancerService.enrichPropertyDefinition(resourceAssignment.name, resourceAssignment.property!!);\r
+\r
+                // Get the Resource Definition from Repo\r
+                val resourceDefinition: ResourceDefinition = getResourceDefinition(dictionaryName)\r
 \r
-            val sourceNodeTemplate = resourceDefinition.sources.get(dictionarySource)\r
+                val sourceNodeTemplate = resourceDefinition.sources.get(dictionarySource)\r
+                        ?: throw BluePrintException(format("failed to get assigned dictionarySource({}) from resourceDefinition({})", dictionarySource, dictionaryName))\r
 \r
-            // Enrich as NodeTemplate\r
-            bluePrintEnhancerService.enrichNodeTemplate(dictionarySource, sourceNodeTemplate!!)\r
+                // Enrich as NodeTemplate\r
+                bluePrintEnhancerService.enrichNodeTemplate(dictionarySource, sourceNodeTemplate)\r
+            }\r
         }\r
+        // Enrich the ResourceSource NodeTypes\r
+        uniqueSourceNodeTypeNames.map { nodeTypeName ->\r
+            resourceDefinitionRepoService.getNodeType(nodeTypeName).subscribe { nodeType ->\r
+                bluePrintEnhancerService.enrichNodeType(nodeTypeName, nodeType)\r
+            }\r
+        }\r
+\r
     }\r
 \r
     override fun enhanceBluePrint(resourceAssignments: List<ResourceAssignment>): ServiceTemplate {\r
@@ -80,7 +107,14 @@ open class ResourceAssignmentEnhancerDefaultService(private val resourceDefiniti
         return bluePrintEnhancerService.serviceTemplate\r
     }\r
 \r
+    private fun checkResourceDefinitionNeeded(resourceAssignment: ResourceAssignment): Boolean {\r
+        return !((resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT)\r
+                || resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT))\r
+                && BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!))\r
+    }\r
+\r
     private fun getResourceDefinition(name: String): ResourceDefinition {\r
-        return resourceDefinitionRepoService.getResourceDefinition(name)!!.block()!!\r
+        return resourceDefinitionRepoService.getResourceDefinition(name).block()\r
+                ?: throw BluePrintException(format("failed to get dictionary definition({})", name))\r
     }\r
 }
\ No newline at end of file
  *  limitations under the License.\r
  */\r
 \r
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service;\r
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer;\r
 \r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\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.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
@@ -31,18 +38,26 @@ import java.util.List;
  * @author Brinda Santh\r
  */\r
 public class ResourceAssignmentEnhancerServiceTest {\r
+    private static EELFLogger log = EELFManager.getInstance().getLogger(ResourceAssignmentEnhancerServiceTest.class);\r
+\r
+    @Before\r
+    public void setUp(){\r
+        // Setup dummy Source Instance Mapping\r
+        ResourceDictionaryTestUtils.setUpResourceSourceMapping();\r
+    }\r
 \r
     @Test\r
     public void testEnhanceBluePrint() throws BluePrintException {\r
 \r
         List<ResourceAssignment> resourceAssignments = JacksonReactorUtils\r
-                .getListFromClassPathFile("enrich/simple-enrich.json", ResourceAssignment.class).block();\r
+                .getListFromClassPathFile("enhance/enhance-resource-assignment.json", ResourceAssignment.class).block();\r
         Assert.assertNotNull("Failed to get Resource Assignment", resourceAssignments);\r
-        ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("load");\r
+        ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("./../../application/load");\r
         ResourceAssignmentEnhancerService resourceAssignmentEnhancerService =\r
                 new ResourceAssignmentEnhancerDefaultService(resourceDefinitionRepoService);\r
         ServiceTemplate serviceTemplate = resourceAssignmentEnhancerService.enhanceBluePrint(resourceAssignments);\r
         Assert.assertNotNull("Failed to get Enriched service Template", serviceTemplate);\r
+        log.trace("Enhanced Service Template : {}", JacksonUtils.getJson(serviceTemplate, true));\r
     }\r
 }\r
 \r
index ab939ff..b2e2901 100644 (file)
@@ -1,5 +1,6 @@
 /*
  *  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.
@@ -17,7 +18,6 @@
 package org.onap.ccsdk.apps.controllerblueprints.service.repository;
 
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -55,7 +55,7 @@ public class ResourceDictionaryReactRepositoryTest {
     @Test
     @Commit
     public void test01Save() {
-        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("./../../application/load/resource_dictionary/db-source" +
+        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("./../../application/load/resource_dictionary/sample-db-source" +
                 ".json", ResourceDefinition.class);
         Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition);
         resourceDefinition.setName(sourceName);
@@ -88,7 +88,7 @@ public class ResourceDictionaryReactRepositoryTest {
     @Test
     @Commit
     public void test05Delete() {
-        resourceDictionaryReactRepository.deleteByName("db-source").block();
+        resourceDictionaryReactRepository.deleteByName(sourceName).block();
     }
 
     private ResourceDictionary transformResourceDictionary(ResourceDefinition resourceDefinition) {
index 5955ae1..272cdd0 100644 (file)
@@ -26,6 +26,7 @@ import org.junit.runners.MethodSorters;
 import org.onap.ccsdk.apps.controllerblueprints.TestApplication;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
@@ -41,7 +42,7 @@ import java.util.List;
 \r
 \r
 @RunWith(SpringRunner.class)\r
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"blueprints.load.initial-data=true"})\r
 @ContextConfiguration(classes = {TestApplication.class})\r
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
 public class ResourceDictionaryRestTest {\r
@@ -103,4 +104,11 @@ public class ResourceDictionaryRestTest {
 \r
     }\r
 \r
+    @Test\r
+    public void test03GetResourceSourceMapping() {\r
+        ResourceSourceMapping resourceSourceMapping = resourceDictionaryRest.getResourceSourceMapping();\r
+        org.springframework.util.Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping");\r
+        org.springframework.util.Assert.notNull(resourceSourceMapping.getResourceSourceMappings(), "Failed to get resource source mappings");\r
+    }\r
+\r
 }\r
index faa1082..37cc61d 100644 (file)
@@ -45,7 +45,7 @@ import java.util.List;
 \r
 \r
 @RunWith(SpringRunner.class)\r
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"blueprints.load.initial-data=true"})\r
 @ContextConfiguration(classes = {TestApplication.class})\r
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
 public class ServiceTemplateRestTest {\r
@@ -143,7 +143,7 @@ public class ServiceTemplateRestTest {
 \r
         List<ResourceAssignment> autoMappedResourceAssignment = autoMapResponse.getResourceAssignments();\r
         autoMappedResourceAssignment.forEach(resourceAssignment -> {\r
-            if ("bundle-id".equals(resourceAssignment.getName())) {\r
+            if ("sample-db-source".equals(resourceAssignment.getName())) {\r
                 Assert.assertEquals("Failed to assign default first source", "db",\r
                         resourceAssignment.getDictionarySource());\r
             }\r
index 46b725f..26fb1d3 100644 (file)
@@ -19,9 +19,12 @@ package org.onap.ccsdk.apps.controllerblueprints.service.validator;
 \r
 import org.apache.commons.io.FileUtils;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.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
@@ -33,6 +36,12 @@ import java.util.List;
 public class ServiceTemplateValidationTest {\r
     private static EELFLogger log = EELFManager.getInstance().getLogger(ServiceTemplateValidationTest.class);\r
 \r
+    @Before\r
+    public void setUp(){\r
+        // Setup dummy Source Instance Mapping\r
+        ResourceDictionaryTestUtils.setUpResourceSourceMapping();\r
+    }\r
+\r
     @Test\r
     public void testBluePrintDirs() {\r
         List<String> dirs = ConfigModelUtils.getBlueprintNames("load/blueprints");\r
index 429588b..397f3b1 100644 (file)
@@ -14,7 +14,7 @@
 # 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
 
 
@@ -23,9 +23,12 @@ logging.level.org.hibernate.SQL=warn
 logging.level.org.hibernate.type.descriptor.sql=debug
 
 
-blueprints.load.initial-data=true
+blueprints.load.initial-data=false
 load.dataTypePath=./../../application/load/model_type/data_type
 load.nodeTypePath=./../../application/load/model_type/node_type
 load.artifactTypePath=./../../application/load/model_type/artifact_type
 load.resourceDictionaryPath=./../../application/load/resource_dictionary
-load.blueprintsPath=./../../application/load/blueprints
\ No newline at end of file
+load.blueprintsPath=./../../application/load/blueprints
+
+# Load Resource Source Mappings
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
new file mode 100644 (file)
index 0000000..3715bec
--- /dev/null
@@ -0,0 +1,62 @@
+[\r
+  {\r
+    "name": "rs-db-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "string",\r
+      "required": true\r
+    },\r
+    "dictionary-name": "sample-db-source",\r
+    "dictionary-source": "db",\r
+    "dependencies": [\r
+      "input-source"\r
+    ]\r
+  },\r
+  {\r
+    "name": "ra-default-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "string",\r
+      "required": true\r
+    },\r
+    "dictionary-name": "sample-default-source",\r
+    "dictionary-source": "default",\r
+    "dependencies": []\r
+  },\r
+  {\r
+    "name": "ra-input-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "string",\r
+      "required": true\r
+    },\r
+    "dictionary-name": "sample-input-source",\r
+    "dictionary-source": "input",\r
+    "dependencies": []\r
+  },\r
+  {\r
+    "name": "ra-list-input-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "list",\r
+      "required": true,\r
+      "entry_schema": {\r
+        "type": "string"\r
+      }\r
+    },\r
+    "dictionary-name": "ra-list-input-source",\r
+    "dictionary-source": "input",\r
+    "dependencies": []\r
+  },\r
+  {\r
+    "name": "ra-complex-input-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "dt-v4-aggregate",\r
+      "required": true\r
+    },\r
+    "dictionary-name": "sample-mdsal-source",\r
+    "dictionary-source": "mdsal",\r
+    "dependencies": []\r
+  }\r
+]\r
index 70d03e0..782ed50 100644 (file)
             "properties": {\r
               "mapping": [\r
                 {\r
-                  "name": "bundle-mac",\r
+                  "name": "rs-db-source",\r
                   "property": {\r
                     "required": true,\r
                     "type": "string"\r
                   },\r
                   "input-param": false,\r
-                  "dictionary-name": "bundle-mac",\r
+                  "dictionary-name": "sample-db-source",\r
                   "dictionary-source": "db",\r
                   "dependencies": [\r
                     "hostname"\r
                   "version": 0\r
                 },\r
                 {\r
-                  "name": "wan-aggregate-ipv4-addresses",\r
+                  "name": "mdsal-source",\r
                   "property": {\r
                     "description": "",\r
                     "required": true,\r
                     }\r
                   },\r
                   "input-param": false,\r
-                  "dictionary-name": "wan-aggregate-ipv4-addresses",\r
+                  "dictionary-name": "sample-mdsal-source",\r
                   "dictionary-source": "mdsal",\r
                   "dependencies": [\r
                     "service-instance-id"\r
                     }\r
                   },\r
                   "input-param": false,\r
-                  "dictionary-name": "licenses",\r
+                  "dictionary-name": "sample-licenses",\r
                   "dictionary-source": "mdsal",\r
                   "dependencies": [\r
                     "service-instance-id"\r
index bf3deff..531d756 100644 (file)
       "description" : "This is Dynamic Data type definition generated from resource mapping for the config template name base-config-template.",\r
       "version" : "1.0.0",\r
       "properties" : {\r
-        "bundle-mac" : {\r
-          "required" : true,\r
-          "type" : "string"\r
-        },\r
         "hostname" : {\r
           "required" : true,\r
           "type" : "string"\r
             "type" : "dt-license-key"\r
           }\r
         },\r
-        "wan-aggregate-ipv4-addresses" : {\r
-          "description" : "",\r
+        "rs-db-source" : {\r
           "required" : true,\r
-          "type" : "list",\r
-          "entry_schema" : {\r
-            "type" : "dt-v4-aggregate"\r
-          }\r
+          "type" : "string"\r
         },\r
         "service" : {\r
           "required" : true,\r
         "service-instance-id" : {\r
           "required" : true,\r
           "type" : "string"\r
+        },\r
+        "mdsal-source" : {\r
+          "description" : "",\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "dt-v4-aggregate"\r
+          }\r
         }\r
       },\r
       "derived_from" : "tosca.datatypes.Dynamic"\r
       "version" : "1.0.0",\r
       "derived_from" : "tosca.nodes.Root"\r
     },\r
+    "artifact-config-template" : {\r
+      "description" : "This is Configuration Velocity Template",\r
+      "version" : "1.0.0",\r
+      "properties" : {\r
+        "action-names" : {\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        }\r
+      },\r
+      "capabilities" : {\r
+        "content" : {\r
+          "type" : "tosca.capabilities.Content",\r
+          "properties" : {\r
+            "content" : {\r
+              "required" : true,\r
+              "type" : "string"\r
+            }\r
+          }\r
+        },\r
+        "mapping" : {\r
+          "type" : "tosca.capabilities.Mapping",\r
+          "properties" : {\r
+            "mapping" : {\r
+              "required" : false,\r
+              "type" : "list",\r
+              "entry_schema" : {\r
+                "type" : "datatype-resource-assignment"\r
+              }\r
+            }\r
+          }\r
+        }\r
+      },\r
+      "derived_from" : "tosca.nodes.Artifact"\r
+    },\r
+    "tosca.nodes.Vnf" : {\r
+      "description" : "This is VNF Node Type",\r
+      "version" : "1.0.0",\r
+      "derived_from" : "tosca.nodes.Root"\r
+    },\r
+    "tosca.nodes.Artifact" : {\r
+      "description" : "This is Deprecated Artifact Node Type.",\r
+      "version" : "1.0.0",\r
+      "derived_from" : "tosca.nodes.Root"\r
+    },\r
+    "dg-activate-netconf" : {\r
+      "description" : "This is Download Netconf Directed Graph",\r
+      "version" : "1.0.0",\r
+      "properties" : {\r
+        "mode" : {\r
+          "required" : false,\r
+          "type" : "string",\r
+          "default" : "sync"\r
+        },\r
+        "version" : {\r
+          "required" : false,\r
+          "type" : "string",\r
+          "default" : "LATEST"\r
+        },\r
+        "is-start-flow" : {\r
+          "required" : false,\r
+          "type" : "boolean",\r
+          "default" : false\r
+        }\r
+      },\r
+      "capabilities" : {\r
+        "dg-node" : {\r
+          "type" : "tosca.capabilities.Node"\r
+        }\r
+      },\r
+      "requirements" : {\r
+        "component-dependency" : {\r
+          "capability" : "component-node",\r
+          "node" : "component-netconf-executor",\r
+          "relationship" : "tosca.relationships.DependsOn"\r
+        }\r
+      },\r
+      "interfaces" : {\r
+        "CONFIG" : {\r
+          "operations" : {\r
+            "ActivateNetconf" : {\r
+              "inputs" : {\r
+                "params" : {\r
+                  "required" : false,\r
+                  "type" : "list",\r
+                  "entry_schema" : {\r
+                    "type" : "datatype-property"\r
+                  }\r
+                }\r
+              }\r
+            }\r
+          }\r
+        }\r
+      },\r
+      "derived_from" : "tosca.nodes.DG"\r
+    },\r
+    "source-input" : {\r
+      "description" : "This is Input Resource Source Node Type",\r
+      "version" : "1.0.0",\r
+      "properties" : {\r
+        "key" : {\r
+          "required" : false,\r
+          "type" : "string"\r
+        },\r
+        "key-dependencies" : {\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        }\r
+      },\r
+      "derived_from" : "tosca.nodes.ResourceSource"\r
+    },\r
+    "tosca.nodes.ResourceSource" : {\r
+      "description" : "TOSCA base type for Resource Sources",\r
+      "version" : "1.0.0",\r
+      "derived_from" : "tosca.nodes.Root"\r
+    },\r
     "component-resource-assignment" : {\r
       "description" : "This is Resource Assignment Component API",\r
       "version" : "1.0.0",\r
       "version" : "1.0.0",\r
       "derived_from" : "tosca.nodes.Root"\r
     },\r
-    "artifact-config-template" : {\r
-      "description" : "This is Configuration Velocity Template",\r
+    "source-db" : {\r
+      "description" : "This is Database Resource Source Node Type",\r
       "version" : "1.0.0",\r
       "properties" : {\r
-        "action-names" : {\r
+        "type" : {\r
           "required" : true,\r
-          "type" : "list",\r
+          "type" : "string",\r
+          "constraints" : [ {\r
+            "valid_values" : [ "SQL", "PLSQL" ]\r
+          } ]\r
+        },\r
+        "query" : {\r
+          "required" : true,\r
+          "type" : "string"\r
+        },\r
+        "input-key-mapping" : {\r
+          "required" : false,\r
+          "type" : "map",\r
           "entry_schema" : {\r
             "type" : "string"\r
           }\r
-        }\r
-      },\r
-      "capabilities" : {\r
-        "content" : {\r
-          "type" : "tosca.capabilities.Content",\r
-          "properties" : {\r
-            "content" : {\r
-              "required" : true,\r
-              "type" : "string"\r
-            }\r
+        },\r
+        "output-key-mapping" : {\r
+          "required" : false,\r
+          "type" : "map",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
           }\r
         },\r
-        "mapping" : {\r
-          "type" : "tosca.capabilities.Mapping",\r
-          "properties" : {\r
-            "mapping" : {\r
-              "required" : false,\r
-              "type" : "list",\r
-              "entry_schema" : {\r
-                "type" : "datatype-resource-assignment"\r
-              }\r
-            }\r
+        "key-dependencies" : {\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
           }\r
         }\r
       },\r
-      "derived_from" : "tosca.nodes.Artifact"\r
+      "derived_from" : "tosca.nodes.ResourceSource"\r
     },\r
     "vnf-netconf-device" : {\r
       "description" : "This is VNF Device with Netconf  Capability",\r
       },\r
       "derived_from" : "tosca.nodes.Vnf"\r
     },\r
-    "tosca.nodes.Vnf" : {\r
-      "description" : "This is VNF Node Type",\r
+    "source-rest" : {\r
+      "description" : "This is Rest Resource Source Node Type",\r
       "version" : "1.0.0",\r
-      "derived_from" : "tosca.nodes.Root"\r
+      "properties" : {\r
+        "type" : {\r
+          "required" : false,\r
+          "type" : "string",\r
+          "constraints" : [ {\r
+            "valid_values" : [ "JSON" ]\r
+          } ],\r
+          "default" : "JSON"\r
+        },\r
+        "url-path" : {\r
+          "required" : true,\r
+          "type" : "string"\r
+        },\r
+        "path" : {\r
+          "required" : true,\r
+          "type" : "string"\r
+        },\r
+        "expression-type" : {\r
+          "required" : false,\r
+          "type" : "string",\r
+          "constraints" : [ {\r
+            "valid_values" : [ "JSON_PATH", "JSON_POINTER" ]\r
+          } ],\r
+          "default" : "JSON_PATH"\r
+        },\r
+        "input-key-mapping" : {\r
+          "required" : false,\r
+          "type" : "map",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        },\r
+        "output-key-mapping" : {\r
+          "required" : false,\r
+          "type" : "map",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        },\r
+        "key-dependencies" : {\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        }\r
+      },\r
+      "derived_from" : "tosca.nodes.ResourceSource"\r
     },\r
     "component-netconf-executor" : {\r
       "description" : "This is Netconf Transaction Configuration Component API",\r
         }\r
       },\r
       "derived_from" : "tosca.nodes.Component"\r
-    },\r
-    "tosca.nodes.Artifact" : {\r
-      "description" : "This is Deprecated Artifact Node Type.",\r
-      "version" : "1.0.0",\r
-      "derived_from" : "tosca.nodes.Root"\r
-    },\r
-    "dg-activate-netconf" : {\r
-      "description" : "This is Download Netconf Directed Graph",\r
-      "version" : "1.0.0",\r
-      "properties" : {\r
-        "mode" : {\r
-          "required" : false,\r
-          "type" : "string",\r
-          "default" : "sync"\r
-        },\r
-        "version" : {\r
-          "required" : false,\r
-          "type" : "string",\r
-          "default" : "LATEST"\r
-        },\r
-        "is-start-flow" : {\r
-          "required" : false,\r
-          "type" : "boolean",\r
-          "default" : false\r
-        }\r
-      },\r
-      "capabilities" : {\r
-        "dg-node" : {\r
-          "type" : "tosca.capabilities.Node"\r
-        }\r
-      },\r
-      "requirements" : {\r
-        "component-dependency" : {\r
-          "capability" : "component-node",\r
-          "node" : "component-netconf-executor",\r
-          "relationship" : "tosca.relationships.DependsOn"\r
-        }\r
-      },\r
-      "interfaces" : {\r
-        "CONFIG" : {\r
-          "operations" : {\r
-            "ActivateNetconf" : {\r
-              "inputs" : {\r
-                "params" : {\r
-                  "required" : false,\r
-                  "type" : "list",\r
-                  "entry_schema" : {\r
-                    "type" : "datatype-property"\r
-                  }\r
-                }\r
-              }\r
-            }\r
-          }\r
-        }\r
-      },\r
-      "derived_from" : "tosca.nodes.DG"\r
     }\r
   },\r
   "topology_template" : {\r
           "mapping" : {\r
             "properties" : {\r
               "mapping" : [ {\r
-                "name" : "bundle-mac",\r
+                "name" : "rs-db-source",\r
                 "property" : {\r
                   "required" : true,\r
                   "type" : "string"\r
                 },\r
                 "input-param" : false,\r
-                "dictionary-name" : "bundle-mac",\r
+                "dictionary-name" : "sample-db-source",\r
                 "dictionary-source" : "db",\r
                 "dependencies" : [ "hostname" ],\r
                 "version" : 0\r
               }, {\r
-                "name" : "wan-aggregate-ipv4-addresses",\r
+                "name" : "mdsal-source",\r
                 "property" : {\r
                   "description" : "",\r
                   "required" : true,\r
                   }\r
                 },\r
                 "input-param" : false,\r
-                "dictionary-name" : "wan-aggregate-ipv4-addresses",\r
+                "dictionary-name" : "sample-mdsal-source",\r
                 "dictionary-source" : "mdsal",\r
                 "dependencies" : [ "service-instance-id" ],\r
                 "version" : 0\r
                   }\r
                 },\r
                 "input-param" : false,\r
-                "dictionary-name" : "licenses",\r
+                "dictionary-name" : "sample-licenses",\r
                 "dictionary-source" : "mdsal",\r
                 "dependencies" : [ "service-instance-id" ],\r
                 "version" : 0\r
index 4a04cfd..7b7ef75 100644 (file)
@@ -1,5 +1,6 @@
 <!--
   ~  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.
@@ -27,8 +28,8 @@
     </appender>
 
 
-    <logger name="org.springframework" level="info"/>
-    <logger name="org.springframework.web" level="info"/>
+    <logger name="org.springframework" level="warn"/>
+    <logger name="org.springframework.web" level="warn"/>
     <logger name="org.hibernate" level="error"/>
     <logger name="org.onap.ccsdk.apps" level="info"/>
 
index 5a2a4ec..c6dd794 100644 (file)
@@ -1,11 +1,14 @@
 [\r
        {\r
-               "name": "input-source"\r
+               "name": "sample-input-source"\r
        },\r
        {\r
-               "name": "v4-ip-type"\r
+               "name": "sample-default-source"\r
        },\r
        {\r
-               "name": "db-source"\r
+               "name": "sample-db-source"\r
+       },\r
+       {\r
+               "name": "sample-mdsal-source"\r
        }\r
 ]
\ No newline at end of file
index 798bdae..5c190db 100644 (file)
@@ -19,7 +19,7 @@
          xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <parent>
         <groupId>org.onap.ccsdk.apps</groupId>
-        <artifactId>ccsdk-apps</artifactId>
+        <artifactId>ccsdk-apps-ms</artifactId>
         <version>0.3.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
index 1272921..760fe4a 100644 (file)
@@ -6,22 +6,12 @@
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
-       <classpathentry kind="src" output="target-ide/classes" path="opt/etc/config">
+       <classpathentry excluding="**" kind="src" output="target-ide/classes" path="opt/etc/config">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
-       <classpathentry kind="src" output="target-ide/classes" path="opt/etc/keystore">
-               <attributes>
-                       <attribute name="maven.pomderived" value="true"/>
-               </attributes>
-       </classpathentry>
-       <classpathentry kind="src" output="target-ide/classes" path="opt/etc/truststore">
-               <attributes>
-                       <attribute name="maven.pomderived" value="true"/>
-               </attributes>
-       </classpathentry>
-       <classpathentry kind="src" output="target-ide/classes" path="src/main/resources">
+       <classpathentry excluding="**" kind="src" output="target-ide/classes" path="src/main/resources">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
        </classpathentry>
-       <classpathentry kind="src" output="target-ide/test-classes" path="src/test/resources">
-               <attributes>
-                       <attribute name="maven.pomderived" value="true"/>
-               </attributes>
-       </classpathentry>
-       <classpathentry kind="src" output="target-ide/classes" path="opt/aai/keystore">
+       <classpathentry excluding="**" kind="src" output="target-ide/test-classes" path="src/test/resources">
                <attributes>
                        <attribute name="maven.pomderived" value="true"/>
                </attributes>
index 8390350..87ac192 100644 (file)
         <serviceArtifactName>ms-networkelementnamegen</serviceArtifactName>
         <project.version>0.3.0</project.version>
         <ccsdk.distribution.version>0.2.4</ccsdk.distribution.version>
+        <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
+               <docker.push.phase>deploy</docker.push.phase>
+               <docker.verbose>true</docker.verbose>
+               <ccsdk.project.version>${project.version}</ccsdk.project.version>
     </properties>
 
     <profiles>
             </build>
         </profile>
 
+       <profile>
+               <id>docker</id>
+               <build>
+                       <plugins>
+                               <plugin>
+                                       <groupId>com.spotify</groupId>
+                                       <artifactId>docker-maven-plugin</artifactId>
+                                       <version>0.4.11</version>
+                                       <configuration>
+                                               <imageName>onap/ccsdk-apps-ms-neng:${project.version}</imageName>
+                                               <dockerDirectory>src/main/docker</dockerDirectory>
+                                               <serverId>docker-hub</serverId>
+                                               <registryUrl>https://${docker.registry}</registryUrl>
+                                               <imageTags>
+                                                       <imageTag>${project.version}</imageTag>
+                                                       <imageTag>${project.version}-STAGING-${maven.build.timestamp}</imageTag>
+                                                       <imageTag>${project.docker.latesttag.version}</imageTag>
+                                               </imageTags>
+                                               <forceTags>true</forceTags>
+                                               <resources>
+                                                       <resource>
+                                                               <targetPath>/</targetPath>
+                                                               <directory>${project.build.directory}</directory>
+                                                               <include>${project.build.finalName}.jar</include>
+                                                       </resource>
+                                                       <resource>
+                                                               <targetPath>/</targetPath>
+                                                               <directory>${project.build.directory}</directory>
+                                                               <include>opt/etc/config/*</include>
+                                                       </resource>
+                                                       <resource>
+                                                               <targetPath>/</targetPath>
+                                                               <directory>${project.build.directory}</directory>
+                                                               <include>opt/etc/keystore/*</include>
+                                                       </resource>
+                                                       <resource>
+                                                               <targetPath>/</targetPath>
+                                                               <directory>${project.build.directory}</directory>
+                                                               <include>opt/etc/truststore/*</include>
+                                                       </resource>
+                                                       <resource>
+                                                               <targetPath>/</targetPath>
+                                                               <directory>${project.build.directory}</directory>
+                                                               <include>opt/aai/keystore/*</include>
+                                                       </resource>
+                                                       <resource>
+                                                               <targetPath>/</targetPath>
+                                                               <directory>${project.build.directory}</directory>
+                                                               <include>etc/*</include>
+                                                       </resource>
+                                               </resources>
+                                       </configuration>
+                               </plugin>
+                       </plugins>
+               </build>
+       </profile>
+
     </profiles>
 
     <developers>
             <groupId>org.liquibase</groupId>
             <artifactId>liquibase-core</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.wisdom-framework</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <version>5.1.34_1</version>
-        </dependency>
+               <dependency>
+                       <groupId>org.mariadb.jdbc</groupId>
+                       <artifactId>mariadb-java-client</artifactId>
+                       <version>${mariadb.connector.version}</version>
+               </dependency>
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
     <build>
         <finalName>NetworkElementNameGen</finalName>
         <plugins>
+            <plugin>
+                <groupId>org.codehaus.groovy.maven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <source>
+                                println project.properties['ccsdk.project.version'];
+                                def versionArray;
+                                if (project.properties['ccsdk.project.version'] != null ) {
+                                    versionArray = project.properties['ccsdk.project.version'].split('\\.');
+                                }
+
+                                if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
+                                {
+                                    project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+                                } else {
+                                    project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest";
+                                }
+
+                                println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
+                            </source>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.jacoco</groupId>
                 <artifactId>jacoco-maven-plugin</artifactId>
             </plugin>
             -->
 
-            <plugin>
-                <groupId>com.spotify</groupId>
-                <artifactId>docker-maven-plugin</artifactId>
-                <version>0.4.11</version>
-                <configuration>
-                    <imageName>onap/ccsdk-apps-ms-neng:${project.version}</imageName>
-                    <dockerDirectory>src/main/docker</dockerDirectory>
-                    <serverId>docker-hub</serverId>
-                    <registryUrl>https://${docker.registry}</registryUrl>
-                    <imageTags>
-                        <imageTag>${project.version}</imageTag>
-                        <imageTag>latest</imageTag>
-                    </imageTags>
-                    <forceTags>true</forceTags>
-                    <resources>
-                        <resource>
-                            <targetPath>/</targetPath>
-                            <directory>${project.build.directory}</directory>
-                            <include>${project.build.finalName}.jar</include>
-                        </resource>
-                        <resource>
-                            <targetPath>/</targetPath>
-                            <directory>${project.build.directory}</directory>
-                            <include>opt/etc/config/*</include>
-                        </resource>
-                        <resource>
-                            <targetPath>/</targetPath>
-                            <directory>${project.build.directory}</directory>
-                            <include>opt/etc/keystore/*</include>
-                        </resource>
-                        <resource>
-                            <targetPath>/</targetPath>
-                            <directory>${project.build.directory}</directory>
-                            <include>opt/etc/truststore/*</include>
-                        </resource>
-                        <resource>
-                            <targetPath>/</targetPath>
-                            <directory>${project.build.directory}</directory>
-                            <include>opt/aai/keystore/*</include>
-                        </resource>
-                        <resource>
-                            <targetPath>/</targetPath>
-                            <directory>${project.build.directory}</directory>
-                            <include>etc/*</include>
-                        </resource>
-                    </resources>
-                </configuration>
-            </plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugins>
         </pluginManagement>
     </build>
+    
 </project>
 
index 4905e6e..ead6a1b 100644 (file)
@@ -40,6 +40,13 @@ import org.springframework.stereotype.Component;
 @Component
 @ApplicationPath("/")
 public class JerseyConfiguration extends ResourceConfig {
+
+    @Autowired
+    public JerseyConfiguration() {
+        register(RestServiceImpl.class);
+        property(ServletProperties.FILTER_FORWARD_ON_404, true);
+    }
+    
     /**
      * Builds the bean configuring Jackson for JSON serialization.
      */
@@ -53,10 +60,4 @@ public class JerseyConfiguration extends ResourceConfig {
         objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
         return objectMapper;
     }
-
-    @Autowired
-    public JerseyConfiguration() {
-        register(RestServiceImpl.class);
-        property(ServletProperties.FILTER_FORWARD_ON_404, true);
-    }
 }
index 79e4657..daf8f57 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 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
@@ -94,12 +96,12 @@ public class SpringServiceImpl implements SpringService {
     @Transactional(rollbackOn = Exception.class)
     public NameGenResponse genNetworkElementName(NameGenRequest request) throws Exception {
         try {
-            Map<String, Map<String, String>> earlierNames = new HashMap<String, Map<String, String>>();
-            List<Map<String, String>> allElements = new ArrayList<Map<String, String>>();
-            Map<String, Map<String, ?>> policyCache = new HashMap<String, Map<String, ?>>();
-            List<Map<String, String>> generatedNames = new ArrayList<Map<String, String>>();
+            Map<String, Map<String, String>> earlierNames = new HashMap<>();
+            List<Map<String, String>> allElements = new ArrayList<>();
+            Map<String, Map<String, ?>> policyCache = new HashMap<>();
+            List<Map<String, String>> generatedNames = new ArrayList<>();
             validateRequest(request);
-            if (request.getElements() != null && request.getElements().size() > 0) {
+            if (!request.getElements().isEmpty()) {
                 allElements.addAll(request.getElements());
             }
             PolicyFinder policyFinderImpl = findPolicyFinderImpl(request);
@@ -194,7 +196,7 @@ public class SpringServiceImpl implements SpringService {
 
     void validateRequest(NameGenRequest request) throws Exception {
         List<Map<String, String>> elems = request.getElements();
-        if (elems != null && elems.size() > 0) {
+        if (!elems.isEmpty()) {
             boolean error = false;
             Set<String> externalKeySet = elems.stream().map(s -> s.get("external-key")).collect(Collectors.toSet());
             if (externalKeySet.size() != request.getElements().size()) {
index df28ccc..5a16131 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 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
@@ -22,13 +24,22 @@ package org.onap.ccsdk.apps.ms.neng.core.gen;
 
 import static org.junit.Assert.assertEquals;
 
+import org.junit.Before;
 import org.junit.Test;
 import org.onap.ccsdk.apps.ms.neng.core.policy.PolicySequence;
 
 public class SequenceFormatterTest {
+    
+    private PolicySequence poly;
+    
+    @Before
+    public void setUp()
+    {
+        poly = new PolicySequence();
+    }
+    
     @Test
     public void formatSequence() throws Exception {
-        PolicySequence poly = new PolicySequence();
         poly.setLength(3);;
         assertEquals("001", SequenceFormatter.formatSequence(1, poly));
         poly.setLength(2);;
@@ -39,7 +50,6 @@ public class SequenceFormatterTest {
 
     @Test
     public void formatSequenceAlpha() throws Exception {
-        PolicySequence poly = new PolicySequence();
         poly.setLength(3);;
         poly.setType(PolicySequence.Type.ALPHA);
         assertEquals("001", SequenceFormatter.formatSequence(1, poly));
@@ -48,4 +58,33 @@ public class SequenceFormatterTest {
         poly.setLength(4);;
         assertEquals("000b", SequenceFormatter.formatSequence(11, poly));
     }
+    
+    @Test
+    public void testGetSetIncrement()
+    {
+        poly.setIncrement(1L);
+        assertEquals(1L, poly.getIncrement());
+    }
+    
+    @Test
+    public void testGetSetMaxValue()
+    {
+        poly.setMaxValue(1L);
+        assertEquals(1L, poly.getMaxValue());
+    }
+    
+    @Test
+    public void testGetSetKey()
+    {
+        poly.setKey("testKey");
+        assertEquals("testKey", poly.getKey());
+    }
+    
+    @Test
+    public void testGetSetLastReleaseSeqNumTried()
+    {
+        poly.setLastReleaseSeqNumTried(1L);
+        Long expected=1L;
+        assertEquals(expected, poly.getLastReleaseSeqNumTried());
+    }
 }
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/TestExternalInterface.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/persistence/entity/TestExternalInterface.java
new file mode 100644 (file)
index 0000000..26d2ef0
--- /dev/null
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK.apps
+ * ================================================================================
+ * Copyright (C) 2018 IBM. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.apps.ms.neng.persistence.entity;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestExternalInterface {
+    private ExternalInterface externalInterface;
+
+    @Before
+    public void setUp() {
+        externalInterface = new ExternalInterface();
+    }
+
+    @Test
+    public void testGetSetExternalInteraceId() {
+        externalInterface.setExternalInteraceId(1);
+        Integer expected = 1;
+        Assert.assertEquals(expected, externalInterface.getExternalInteraceId());
+    }
+
+    @Test
+    public void testGetSetSystem() {
+        externalInterface.setSystem("testSystem");
+        Assert.assertEquals("testSystem", externalInterface.getSystem());
+    }
+
+    @Test
+    public void testGetSetParam() {
+        externalInterface.setParam("testParam");
+        Assert.assertEquals("testParam", externalInterface.getParam());
+    }
+
+    @Test
+    public void testGetSetUrlSuffix() {
+        externalInterface.setUrlSuffix("testUrlSuffix");
+        Assert.assertEquals("testUrlSuffix", externalInterface.getUrlSuffix());
+    }
+
+    @Test
+    public void testGetSetTimeStamp() throws ParseException {
+        DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+        Date date = dateFormat.parse("23/09/2007");
+        long time = date.getTime();
+        Timestamp timeStamp = new Timestamp(time);
+        externalInterface.setCreatedTime(timeStamp);
+        Assert.assertEquals(timeStamp, externalInterface.getCreatedTime());
+    }
+
+    @Test
+    public void testGetSetCreatedBy() {
+        externalInterface.setCreatedBy("testUser");
+        Assert.assertEquals("testUser", externalInterface.getCreatedBy());
+    }
+
+    @Test
+    public void testGetSetLastUpdatedTime() throws ParseException {
+        DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
+        Date date = dateFormat.parse("23/09/2007");
+        long time = date.getTime();
+        Timestamp timeStamp = new Timestamp(time);
+        externalInterface.setLastUpdatedTime(timeStamp);
+        Assert.assertEquals(timeStamp, externalInterface.getLastUpdatedTime());
+    }
+
+    @Test
+    public void testGetSetLastUpdatedBy() {
+        externalInterface.setLastUpdatedBy("testUser");
+        Assert.assertEquals("testUser", externalInterface.getLastUpdatedBy());
+    }
+}
index 60b2f11..b746f24 100644 (file)
@@ -38,8 +38,9 @@
     <description>Micro-services</description>
 
     <modules>
+               <module>controllerblueprints</module>
         <module>neng</module>
-       <module>vlantag-api</module>
+               <module>vlantag-api</module>
     </modules>
 </project>
 
index 431d0a3..08466dc 100644 (file)
@@ -17,7 +17,7 @@
                <swagger.annotations.version>1.5.8</swagger.annotations.version>
                <java.version>1.8</java.version>
                <springboot.version>2.0.4.RELEASE</springboot.version>
-               <mysql.connector.version>5.1.46</mysql.connector.version>
+               <mariadb.connector.version>2.1.1</mariadb.connector.version>
                <ccsdk.sli.adaptors.version>0.3.0-SNAPSHOT</ccsdk.sli.adaptors.version>
                <docker.registry>TBD:5100</docker.registry>
                <serviceArtifactName>vlantagapi</serviceArtifactName>
                <sonar.jacoco.itReportPath>${basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
                <sonar.language>java</sonar.language>
                <ilib.version>2.0.7</ilib.version>
+               <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
+               <docker.push.phase>deploy</docker.push.phase>
+               <docker.verbose>true</docker.verbose>
+               <ccsdk.project.version>${project.version}</ccsdk.project.version>
        </properties>
 
        <parent>
-               <groupId>org.springframework.boot</groupId>
+               <groupId>org.onap.ccsdk.parent</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
-               <version>2.0.4.RELEASE</version>
+               <version>1.1.0-SNAPSHOT</version>
                <relativePath />
        </parent>
 
@@ -82,9 +86,9 @@
                </dependency>
 
                <dependency>
-                       <groupId>mysql</groupId>
-                       <artifactId>mysql-connector-java</artifactId>
-                       <version>5.1.46</version>
+                       <groupId>org.mariadb.jdbc</groupId>
+                       <artifactId>mariadb-java-client</artifactId>
+                       <version>${mariadb.connector.version}</version>
                </dependency>
 
                <dependency>
 
        <build>
                <plugins>
+            <plugin>
+                <groupId>org.codehaus.groovy.maven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <source>
+                                println project.properties['ccsdk.project.version'];
+                                def versionArray;
+                                if (project.properties['ccsdk.project.version'] != null ) {
+                                    versionArray = project.properties['ccsdk.project.version'].split('\\.');
+                                }
+
+                                if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
+                                {
+                                    project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+                                } else {
+                                    project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest";
+                                }
+
+                                println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
+                            </source>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
                    <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                </plugins>
        </build>
 
+       <profiles>
+               <profile>
+                       <id>docker</id>
+                       <build>
+                               <plugins>
+                                       <plugin>
+                                               <groupId>com.spotify</groupId>
+                                               <artifactId>docker-maven-plugin</artifactId>
+                                               <version>0.4.11</version>
+                                               <configuration>
+                                                       <imageName>${docker.registry}/org.onap.ccsdk.apps/${serviceArtifactName}</imageName>
+                                                       <dockerDirectory>src/main/docker</dockerDirectory>
+                                                       <serverId>docker-hub</serverId>
+                                                       <registryUrl>https://${docker.registry}</registryUrl>
+                                                       <imageTags>
+                                                               <imageTag>${project.version}</imageTag>
+                                                               <imageTag>${project.version}-STAGING-${maven.build.timestamp}</imageTag>
+                                                           <imageTag>${project.docker.latesttag.version}</imageTag>
+                                                       </imageTags>
+                                                       <forceTags>true</forceTags>
+                                                       <resources>
+                                                               <resource>
+                                                                       <targetPath>/</targetPath>
+                                                                       <directory>${project.build.directory}</directory>
+                                                                       <include>${project.build.finalName}.jar</include>
+                                                               </resource>
+                                                       </resources>
+                                               </configuration>
+                                       </plugin>
+                               </plugins>
+                       </build>
+               </profile>
+       </profiles>
+
 
 </project>
index bd18a98..0048965 100644 (file)
@@ -16,7 +16,6 @@
 package org.onap.ccsdk.apps.ms.vlantagapi.core;\r
 \r
 import org.springframework.boot.SpringApplication;\r
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;\r
 import org.springframework.boot.autoconfigure.SpringBootApplication;\r
 \r
 /**\r
index 60a8d1c..4c1c6c6 100644 (file)
@@ -4,8 +4,8 @@
 # because they are used in Jenkins, whose plug-in doesn't support
 
 
-release_name=1
-sprint_number=1
+release_name=0
+sprint_number=3
 feature_revision=0
 
 base_version=${release_name}.${sprint_number}.${feature_revision}