aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-08-27 13:53:21 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-08-27 14:01:51 +0000
commit2b5c7e5b12440f35009d17d008b4061445b0524c (patch)
tree7998ae54779f9323a7c88ff0874371e940ee8c69 /ms/controllerblueprints/modules
parentee9f2dd72054056547ce7e9e96e8e9fb0eef4902 (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')
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java2
-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.java24
4 files changed, 22 insertions, 9 deletions
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
index 73d835c10..413d90446 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
@@ -24,7 +24,7 @@
"output-key-mapping": {
"oam-local-ipv4-address": "v4-ip-prefix"
},
- "key-dependency": [
+ "key-dependencies": [
"service-instance-id",
"network-role",
"v4-ip-type",
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java
index ddbd88bda..48b89bd6d 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java
@@ -26,5 +26,5 @@ public class ResourceDictionaryConstants {
public static final String PROPERTY_TYPE = "type";
public static final String PROPERTY_INPUT_KEY_MAPPING = "input-key-mapping";
public static final String PROPERTY_OUTPUT_KEY_MAPPING = "output-key-mapping";
- public static final String PROPERTY_KEY_DEPENDENCY = "key-dependency";
+ public static final String PROPERTY_KEY_DEPENDENCIES = "key-dependencies";
}
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);
}
}