From b8f16f15fa937db113dbe2e3b3438469fa284a71 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Wed, 12 Dec 2018 16:49:04 -0500 Subject: Add multiple location repo for enhancer. Change-Id: I5333b30fad8d754caf8dc89956132e4637f28c26 Issue-ID: CCSDK-803 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../dict/service/ResourceDefinitionRepoService.kt | 67 ---------------------- .../service/ResourceDefinitionValidationService.kt | 2 +- .../service/ResourceDefinitionRepoServiceTest.java | 36 ------------ 3 files changed, 1 insertion(+), 104 deletions(-) delete mode 100644 components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt delete mode 100644 components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoServiceTest.java (limited to 'components/resource-dict') 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 -- cgit 1.2.3-korg