--- /dev/null
+/*\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
/*\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
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
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
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
},
"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",
{
"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"
--- /dev/null
+{
+ "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
+++ /dev/null
-/*\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
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
+++ /dev/null
-/*\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