Add multiple location repo for enhancer.
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Wed, 12 Dec 2018 21:49:04 +0000 (16:49 -0500)
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Wed, 12 Dec 2018 21:49:04 +0000 (16:49 -0500)
Change-Id: I5333b30fad8d754caf8dc89956132e4637f28c26
Issue-ID: CCSDK-803
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt [new file with mode: 0644]
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt [moved from components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt with 81% similarity]
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
components/model-catalog/definition-type/starter-type/node_type/dg-generic.json [new file with mode: 0644]
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt [deleted file]
components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java [deleted file]

diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt
new file mode 100644 (file)
index 0000000..efcb0c3
--- /dev/null
@@ -0,0 +1,47 @@
+/*\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.interfaces\r
+\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*\r
+import java.io.Serializable\r
+\r
+/**\r
+ * BluePrintRepoFileService\r
+ * @author Brinda Santh\r
+ *\r
+ */\r
+\r
+interface BluePrintRepoService : Serializable {\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun getNodeType(nodeTypeName: String): NodeType\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun getDataType(dataTypeName: String): DataType\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun getArtifactType(artifactTypeName: String): ArtifactType\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun getRelationshipType(relationshipTypeName: String): RelationshipType\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition\r
+\r
+}
\ No newline at end of file
@@ -1,6 +1,5 @@
 /*\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
@@ -22,34 +21,8 @@ import com.att.eelf.configuration.EELFManager
 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.data.*\r
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils\r
-import java.io.Serializable\r
-\r
-/**\r
- * BluePrintRepoFileService\r
- * @author Brinda Santh\r
- *\r
- */\r
-\r
-interface BluePrintRepoService : Serializable {\r
-\r
-    @Throws(BluePrintException::class)\r
-    fun getNodeType(nodeTypeName: String): NodeType\r
-\r
-    @Throws(BluePrintException::class)\r
-    fun getDataType(dataTypeName: String): DataType\r
-\r
-    @Throws(BluePrintException::class)\r
-    fun getArtifactType(artifactTypeName: String): ArtifactType\r
-\r
-    @Throws(BluePrintException::class)\r
-    fun getRelationshipType(relationshipTypeName: String): RelationshipType\r
-\r
-    @Throws(BluePrintException::class)\r
-    fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition\r
-\r
-}\r
-\r
 \r
 open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoService {\r
 \r
index f7f995f..f7ffc39 100644 (file)
@@ -29,29 +29,29 @@ import kotlin.test.assertNotNull
 class BluePrintRepoFileServiceTest {\r
 \r
     private val basePath = "load/model_type"\r
-    private val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath)\r
+    private val bluePrintRepoFileService = BluePrintRepoFileService(basePath)\r
 \r
     @Test\r
     fun testGetDataType() {\r
-        val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")\r
+        val dataType = bluePrintRepoFileService.getDataType("dt-v4-aggregate")\r
         assertNotNull(dataType, "Failed to get DataType from repo")\r
     }\r
 \r
     @Test\r
     fun testGetNodeType() {\r
-        val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")\r
+        val nodeType = bluePrintRepoFileService.getNodeType("component-resource-assignment")\r
         assertNotNull(nodeType, "Failed to get NodeType from repo")\r
     }\r
 \r
     @Test\r
     fun testGetArtifactType() {\r
-        val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")\r
+        val nodeType = bluePrintRepoFileService.getArtifactType("artifact-template-velocity")\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")\r
+        val dataType = bluePrintRepoFileService.getDataType("dt-not-found")\r
         assertNotNull(dataType, "Failed to get DataType from repo")\r
     }\r
 }
\ No newline at end of file
index 2f51980..cbcadeb 100644 (file)
@@ -53,8 +53,6 @@ class BluePrintRuntimeServiceTest {
         val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")\r
 \r
         assertNotNull(propContext, "Failed to populate interface property values")\r
-        assertEquals(propContext["process-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter process-name")\r
-        assertEquals(propContext["version"], jsonNodeFromObject("sample-action"), "Failed to populate parameter version")\r
     }\r
 \r
     @Test\r
index 446932d..f756ef7 100644 (file)
     },
     "node_templates": {
       "resource-assignment-process": {
-        "type": "dg-activate",
+        "type": "dg-generic",
         "properties": {
-          "process-name": {
-            "get_input": "action-name"
-          },
-          "version": {
-            "get_property": [
-              "SELF",
-              "process-name"
-            ]
-          },
           "content": {
             "get_artifact": [
               "SELF",
         }
       },
       "activate-process": {
-        "type": "dg-activate",
+        "type": "dg-generic",
         "properties": {
-          "process-name": {
-            "get_input": "action-name"
-          },
-          "version": {
-            "get_property": [
-              "SELF",
-              "process-name"
-            ]
-          },
           "content": {
             "get_artifact": [
               "SELF",
         }
       },
       "assign-activate-process": {
-        "type": "dg-activate",
+        "type": "dg-generic",
         "properties": {
-          "process-name": {
-            "get_input": "action-name"
-          },
-          "version": {
-            "get_property": [
-              "SELF",
-              "process-name"
-            ]
-          },
           "content": {
             "get_artifact": [
               "SELF",
index 6e8d839..8227b82 100644 (file)
@@ -1,21 +1,12 @@
 {
   "node_types": {
-    "dg-activate": {
+    "dg-generic": {
       "description": "This is Generic Directed Graph Type",
       "version": "1.0.0",
       "properties": {
         "content": {
-          "required": false,
-          "type": "string"
-        },
-        "process-name": {
-          "required": false,
+          "required": true,
           "type": "string"
-        },
-        "version": {
-          "required": false,
-          "type": "string",
-          "default": "LATEST"
         }
       },
       "derived_from": "tosca.nodes.DG"
diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json
new file mode 100644 (file)
index 0000000..6274445
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "description": "This is Generic Directed Graph Type",
+  "version": "1.0.0",
+  "properties": {
+    "content": {
+      "required": true,
+      "type": "string"
+    }
+  },
+  "derived_from": "tosca.nodes.DG"
+}
\ No newline at end of file
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt
deleted file mode 100644 (file)
index bcb7e7d..0000000
+++ /dev/null
@@ -1,67 +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.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.JacksonUtils\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition\r
-\r
-/**\r
- * ResourceDefinitionRepoService.\r
- *\r
- * @author Brinda Santh\r
- */\r
-interface ResourceDefinitionRepoService : BluePrintRepoService {\r
-\r
-    @Throws(BluePrintException::class)\r
-    fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition\r
-}\r
-\r
-/**\r
- * ResourceDefinitionFileRepoService.\r
- *\r
- * @author Brinda Santh\r
- */\r
-open class ResourceDefinitionFileRepoService : BluePrintRepoFileService,\r
-        ResourceDefinitionRepoService {\r
-\r
-    private var resourceDefinitionPath: String\r
-    private val extension = ".json"\r
-\r
-    constructor(basePath: String) : this(basePath,\r
-            basePath.plus(BluePrintConstants.PATH_DIVIDER)\r
-                    .plus(BluePrintConstants.MODEL_DIR_MODEL_TYPE)\r
-                    .plus(BluePrintConstants.PATH_DIVIDER)\r
-                    .plus("starter-type"))\r
-\r
-    constructor(basePath: String, modelTypePath: String) : super(modelTypePath) {\r
-        resourceDefinitionPath = basePath.plus("/resource-dictionary/starter-dictionary")\r
-    }\r
-\r
-    override fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition {\r
-\r
-        val fileName = resourceDefinitionPath.plus(BluePrintConstants.PATH_DIVIDER)\r
-                .plus(resourceDefinitionName).plus(extension)\r
-\r
-        return JacksonUtils.readValueFromFile(fileName, ResourceDefinition::class.java)\r
-                ?: throw BluePrintException("couldn't get resource definition for file($fileName)")\r
-    }\r
-}\r
index 9ed0773..2c66ff1 100644 (file)
@@ -27,8 +27,8 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
 import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType
 import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
 import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
 import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintExpressionService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
 import java.io.Serializable
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java
deleted file mode 100644 (file)
index ac8cbcb..0000000
+++ /dev/null
@@ -1,36 +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.resource.dict.service;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;\r
-\r
-public class ResourceDefinitionRepoServiceTest {\r
-\r
-    @Test\r
-    public void testGetResourceDefinition() throws Exception {\r
-        ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("./../model-catalog");\r
-        ResourceDefinition resourceDefinition = resourceDefinitionRepoService\r
-                .getResourceDefinition("db-source");\r
-        Assert.assertNotNull("Failed to get Resource Definition db-source", resourceDefinition);\r
-\r
-        NodeType nodeType = resourceDefinitionRepoService.getNodeType("source-db");\r
-        Assert.assertNotNull("Failed to get Node Type source-db", resourceDefinition);\r
-    }\r
-}
\ No newline at end of file