diff options
10 files changed, 70 insertions, 180 deletions
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 index 000000000..efcb0c38b --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintRepoService.kt @@ -0,0 +1,47 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.controllerblueprints.core.interfaces
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import java.io.Serializable
+
+/**
+ * BluePrintRepoFileService
+ * @author Brinda Santh
+ *
+ */
+
+interface BluePrintRepoService : Serializable {
+
+ @Throws(BluePrintException::class)
+ fun getNodeType(nodeTypeName: String): NodeType
+
+ @Throws(BluePrintException::class)
+ fun getDataType(dataTypeName: String): DataType
+
+ @Throws(BluePrintException::class)
+ fun getArtifactType(artifactTypeName: String): ArtifactType
+
+ @Throws(BluePrintException::class)
+ fun getRelationshipType(relationshipTypeName: String): RelationshipType
+
+ @Throws(BluePrintException::class)
+ fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition
+
+}
\ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt index 5ca43952d..de338664c 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileService.kt @@ -1,6 +1,5 @@ /*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications 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.
@@ -22,34 +21,8 @@ import com.att.eelf.configuration.EELFManager import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import java.io.Serializable
-
-/**
- * BluePrintRepoFileService
- * @author Brinda Santh
- *
- */
-
-interface BluePrintRepoService : Serializable {
-
- @Throws(BluePrintException::class)
- fun getNodeType(nodeTypeName: String): NodeType
-
- @Throws(BluePrintException::class)
- fun getDataType(dataTypeName: String): DataType
-
- @Throws(BluePrintException::class)
- fun getArtifactType(artifactTypeName: String): ArtifactType
-
- @Throws(BluePrintException::class)
- fun getRelationshipType(relationshipTypeName: String): RelationshipType
-
- @Throws(BluePrintException::class)
- fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition
-
-}
-
open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoService {
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt index f7f995fbb..f7ffc3940 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt @@ -29,29 +29,29 @@ import kotlin.test.assertNotNull class BluePrintRepoFileServiceTest {
private val basePath = "load/model_type"
- private val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath)
+ private val bluePrintRepoFileService = BluePrintRepoFileService(basePath)
@Test
fun testGetDataType() {
- val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")
+ val dataType = bluePrintRepoFileService.getDataType("dt-v4-aggregate")
assertNotNull(dataType, "Failed to get DataType from repo")
}
@Test
fun testGetNodeType() {
- val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")
+ val nodeType = bluePrintRepoFileService.getNodeType("component-resource-assignment")
assertNotNull(nodeType, "Failed to get NodeType from repo")
}
@Test
fun testGetArtifactType() {
- val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")
+ val nodeType = bluePrintRepoFileService.getArtifactType("artifact-template-velocity")
assertNotNull(nodeType, "Failed to get ArtifactType from repo")
}
@Test(expected = FileNotFoundException::class)
fun testModelNotFound() {
- val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-not-found")
+ val dataType = bluePrintRepoFileService.getDataType("dt-not-found")
assertNotNull(dataType, "Failed to get DataType from repo")
}
}
\ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 2f519802d..cbcadeb39 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -53,8 +53,6 @@ class BluePrintRuntimeServiceTest { val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")
assertNotNull(propContext, "Failed to populate interface property values")
- assertEquals(propContext["process-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter process-name")
- assertEquals(propContext["version"], jsonNodeFromObject("sample-action"), "Failed to populate parameter version")
}
@Test
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 446932d54..f756ef7ed 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -39,17 +39,8 @@ }, "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", @@ -65,17 +56,8 @@ } }, "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", @@ -91,17 +73,8 @@ } }, "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", diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json index 6e8d839ee..8227b82f7 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json @@ -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 index 000000000..6274445ca --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json @@ -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 index bcb7e7da7..000000000 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt +++ /dev/null @@ -1,67 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications 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.controllerblueprints.resource.dict.service
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileService
-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
-
-/**
- * ResourceDefinitionRepoService.
- *
- * @author Brinda Santh
- */
-interface ResourceDefinitionRepoService : BluePrintRepoService {
-
- @Throws(BluePrintException::class)
- fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition
-}
-
-/**
- * ResourceDefinitionFileRepoService.
- *
- * @author Brinda Santh
- */
-open class ResourceDefinitionFileRepoService : BluePrintRepoFileService,
- ResourceDefinitionRepoService {
-
- private var resourceDefinitionPath: String
- private val extension = ".json"
-
- constructor(basePath: String) : this(basePath,
- basePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(BluePrintConstants.MODEL_DIR_MODEL_TYPE)
- .plus(BluePrintConstants.PATH_DIVIDER)
- .plus("starter-type"))
-
- constructor(basePath: String, modelTypePath: String) : super(modelTypePath) {
- resourceDefinitionPath = basePath.plus("/resource-dictionary/starter-dictionary")
- }
-
- override fun getResourceDefinition(resourceDefinitionName: String): ResourceDefinition {
-
- val fileName = resourceDefinitionPath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(resourceDefinitionName).plus(extension)
-
- return JacksonUtils.readValueFromFile(fileName, ResourceDefinition::class.java)
- ?: throw BluePrintException("couldn't get resource definition for file($fileName)")
- }
-}
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt index 9ed077323..2c66ff197 100644 --- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt +++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt @@ -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 index ac8cbcb43..000000000 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
-
-public class ResourceDefinitionRepoServiceTest {
-
- @Test
- public void testGetResourceDefinition() throws Exception {
- ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("./../model-catalog");
- ResourceDefinition resourceDefinition = resourceDefinitionRepoService
- .getResourceDefinition("db-source");
- Assert.assertNotNull("Failed to get Resource Definition db-source", resourceDefinition);
-
- NodeType nodeType = resourceDefinitionRepoService.getNodeType("source-db");
- Assert.assertNotNull("Failed to get Node Type source-db", resourceDefinition);
- }
-}
\ No newline at end of file |