From 7b23a92a3d079940193eaf141ff8494851b49d61 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Fri, 24 Aug 2018 22:48:32 -0400 Subject: Controller Blueprints Microservice Create resource definition and Create Source Node Type definitions for Input, default, db, mdsal and component sources. Change-Id: Icc49cb4be2e8700b61c281ff2d01c365321bb311 Issue-ID: CCSDK-487 Signed-off-by: Brinda Santh --- .../dict/util/DictionaryDefinitionTest.java | 70 ---------------------- .../resource/dict/util/ResourceDefinitionTest.java | 61 +++++++++++++++++++ .../dict/util/ResourceDictionaryUtilsTest.java | 18 +++++- 3 files changed, 77 insertions(+), 72 deletions(-) delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java create mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java (limited to 'ms/controllerblueprints/modules/resource-dict/src/test/java') diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java deleted file mode 100644 index 851ba1256..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java +++ /dev/null @@ -1,70 +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.util; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants; -import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DictionaryDefinitionTest { - private Logger log = LoggerFactory.getLogger(DictionaryDefinitionTest.class); - String basePath = "load/resource_dictionary"; - - @Before - public void setup(){ - SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DB, SourceDb.class); - SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_INPUT, SourceInput.class); - SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_MDSAL, SourceMdsal.class); - SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DEFAULT,SourceDefault.class); - } - - @Test - public void testDictionaryDefinitionInputSource(){ - - String fileName = basePath + "/input-source.json"; - DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", dictionaryDefinition); - } - - @Test - public void testDictionaryDefinitionDefaultSource(){ - - String fileName = basePath + "/default-source.json"; - DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", dictionaryDefinition); - } - - @Test - public void testDictionaryDefinitionDBSource(){ - - String fileName = basePath + "/db-source.json"; - DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", dictionaryDefinition); - } - - @Test - public void testDictionaryDefinitionMDSALSource(){ - String fileName = basePath + "/mdsal-source.json"; - DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", dictionaryDefinition); - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java new file mode 100644 index 000000000..c71843804 --- /dev/null +++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java @@ -0,0 +1,61 @@ +/* + * 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.util; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils; +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ResourceDefinitionTest { + private Logger log = LoggerFactory.getLogger(ResourceDefinitionTest.class); + String basePath = "load/resource_dictionary"; + + @Test + public void testDictionaryDefinitionInputSource(){ + + String fileName = basePath + "/input-source.json"; + ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition); + } + + @Test + public void testDictionaryDefinitionDefaultSource(){ + + String fileName = basePath + "/default-source.json"; + ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition); + } + + @Test + public void testDictionaryDefinitionDBSource(){ + + String fileName = basePath + "/db-source.json"; + ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition); + } + + @Test + public void testDictionaryDefinitionMDSALSource(){ + String fileName = basePath + "/mdsal-source.json"; + ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition); + } +} diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java index 0c9a1c5d8..b6ac103ee 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java +++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java @@ -1,5 +1,6 @@ /* * 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. @@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util; import org.junit.Assert; import org.junit.Test; import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants; +import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition; import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment; import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants; import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*; @@ -37,9 +39,11 @@ public class ResourceDictionaryUtilsTest { @Test public void validateSingleInputSource() { try { - log.info(" **************** Validating validateSingleSource *****************"); ResourceAssignment resourceAssignment = new ResourceAssignment(); resourceAssignment.setName("test-input-key"); + PropertyDefinition propertyDefinition = new PropertyDefinition(); + propertyDefinition.setType("string"); + resourceAssignment.setProperty(propertyDefinition); DictionaryDefinition dictionaryDefinition = new DictionaryDefinition(); dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING); @@ -64,9 +68,12 @@ public class ResourceDictionaryUtilsTest { @Test public void validateSingleDbSource() { try { - log.info(" **************** Validating validateSingleSource *****************"); ResourceAssignment resourceAssignment = new ResourceAssignment(); resourceAssignment.setName("test-db-key"); + PropertyDefinition propertyDefinition = new PropertyDefinition(); + propertyDefinition.setType("string"); + resourceAssignment.setProperty(propertyDefinition); + DictionaryDefinition dictionaryDefinition = new DictionaryDefinition(); dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING); @@ -110,6 +117,9 @@ public class ResourceDictionaryUtilsTest { public void testSourceDefault() { ResourceAssignment resourceAssignment = new ResourceAssignment(); resourceAssignment.setName("test-input-key"); + PropertyDefinition propertyDefinition = new PropertyDefinition(); + propertyDefinition.setType("string"); + resourceAssignment.setProperty(propertyDefinition); DictionaryDefinition dictionaryDefinition = new DictionaryDefinition(); dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING); @@ -139,6 +149,10 @@ public class ResourceDictionaryUtilsTest { public void testSourceMdsal() { ResourceAssignment resourceAssignment = new ResourceAssignment(); resourceAssignment.setName("test-input-key"); + PropertyDefinition propertyDefinition = new PropertyDefinition(); + propertyDefinition.setType("string"); + resourceAssignment.setProperty(propertyDefinition); + DictionaryDefinition dictionaryDefinition = new DictionaryDefinition(); dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING); -- cgit 1.2.3-korg