summaryrefslogtreecommitdiffstats
path: root/ms
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
commit522a86b6dc2d08b16ba6aba682d5d1fd8558ad25 (patch)
treef3f09a2e462b8baed767f081092333db97393586 /ms
parent380790370ba573e0b0e0829b4fa1b38a79581a0e (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')
-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 73d835c1..413d9044 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 ddbd88bd..48b89bd6 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 c7184380..3e68d099 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 6eebdb2f..b50c0e44 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);
}
}