diff options
author | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-27 13:53:21 +0000 |
---|---|---|
committer | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-27 14:01:51 +0000 |
commit | 2b5c7e5b12440f35009d17d008b4061445b0524c (patch) | |
tree | 7998ae54779f9323a7c88ff0874371e940ee8c69 /ms/controllerblueprints/modules/resource-dict/src/test | |
parent | ee9f2dd72054056547ce7e9e96e8e9fb0eef4902 (diff) |
Controller Blueprints Microservice
Add junit test case for input, default and rest resource definition validation.
Change-Id: I5ee37891768e5985bc7a4df6f6b917396f439bf2
Issue-ID: CCSDK-487
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/controllerblueprints/modules/resource-dict/src/test')
-rw-r--r-- | ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java) | 3 | ||||
-rw-r--r-- | ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java | 24 |
2 files changed, 20 insertions, 7 deletions
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/ResourceDefinitionTest.java index c71843804..3e68d0991 100644 --- 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/ResourceDefinitionTest.java @@ -15,12 +15,11 @@ * limitations under the License.
*/
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict;
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;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java index 6eebdb2f0..b50c0e44b 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java +++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java @@ -25,18 +25,32 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition public class ResourceDictionaryValidationServiceTest { private String basePath = "load/model_type"; String dictionaryPath = "load/resource_dictionary"; + BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath); @Test - public void testValidate() throws Exception { - BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath); + public void testValidateSource() throws Exception { + + String inputFileName = dictionaryPath + "/db-source.json"; + testValidate(inputFileName); + + String dbFileName = dictionaryPath + "/db-source.json"; + testValidate(dbFileName); + + String defaultFileName = dictionaryPath + "/default-source.json"; + testValidate(defaultFileName); + + String restFileName = dictionaryPath + "/mdsal-source.json"; + testValidate(restFileName); + } + + private void testValidate(String fileName) throws Exception { - String fileName = dictionaryPath + "/db-source.json"; ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition); + Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition); ResourceDictionaryValidationService resourceDictionaryValidationService = new ResourceDictionaryDefaultValidationService(bluePrintRepoFileService); resourceDictionaryValidationService.validate(resourceDefinition); - + Assert.assertNotNull(String.format("Failed to populate dictionaryDefinition for : %s", fileName), resourceDefinition); } } |