summaryrefslogtreecommitdiffstats
path: root/components/resource-dict
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-12-12 16:49:04 -0500
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-12-12 16:49:04 -0500
commitb8f16f15fa937db113dbe2e3b3438469fa284a71 (patch)
tree8cc18e2683d0f841a4d75797d6d3d5a70f3ab284 /components/resource-dict
parent50e751e5374e1240080411400f4ae71d27115fa2 (diff)
Add multiple location repo for enhancer.
Change-Id: I5333b30fad8d754caf8dc89956132e4637f28c26 Issue-ID: CCSDK-803 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'components/resource-dict')
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt67
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt2
-rw-r--r--components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java36
3 files changed, 1 insertions, 104 deletions
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 bcb7e7da..00000000
--- 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 9ed07732..2c66ff19 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 ac8cbcb4..00000000
--- 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