aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/resource-dict/src/test
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2018-08-28 22:46:02 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2018-08-28 22:52:52 -0400
commit382e72538c5df057328b3cf790daaa873849c362 (patch)
tree5564c87b8719f3b9557ac01333d7738929b0b90e /ms/controllerblueprints/modules/resource-dict/src/test
parentc0e77765214b94cc493b181bcc1d58165ac8b09f (diff)
Controller Blueprints Microservice
Add resource assignment json data to input property convertor utlity and their test cases. Change-Id: Ie4557048e85df38c75ac3d31ff62d4fce0662d9f Issue-ID: CCSDK-488 Signed-off-by: Brinda Santh <brindasanth@in.ibm.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/service/ResourceDefinitionValidationServiceTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDictionaryValidationServiceTest.java)10
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java15
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json10
3 files changed, 30 insertions, 5 deletions
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/ResourceDefinitionValidationServiceTest.java
index b50c0e44..ef305627 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/ResourceDefinitionValidationServiceTest.java
@@ -22,10 +22,10 @@ import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileSe
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
-public class ResourceDictionaryValidationServiceTest {
+public class ResourceDefinitionValidationServiceTest {
private String basePath = "load/model_type";
- String dictionaryPath = "load/resource_dictionary";
- BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath);
+ private String dictionaryPath = "load/resource_dictionary";
+ private BluePrintRepoFileService bluePrintRepoFileService = new BluePrintRepoFileService(basePath);
@Test
public void testValidateSource() throws Exception {
@@ -48,8 +48,8 @@ public class ResourceDictionaryValidationServiceTest {
ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition);
- ResourceDictionaryValidationService resourceDictionaryValidationService =
- new ResourceDictionaryDefaultValidationService(bluePrintRepoFileService);
+ ResourceDefinitionValidationService resourceDictionaryValidationService =
+ new ResourceDefinitionDefaultValidationService(bluePrintRepoFileService);
resourceDictionaryValidationService.validate(resourceDefinition);
Assert.assertNotNull(String.format("Failed to populate dictionaryDefinition for : %s", fileName), resourceDefinition);
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
index 2a207e09..5c22f654 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
@@ -18,9 +18,12 @@
package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils;
+import com.fasterxml.jackson.databind.JsonNode;
import org.junit.Assert;
import org.junit.Test;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;
@@ -76,4 +79,16 @@ public class ResourceDictionaryUtilsTest {
}
+ @Test
+ public void testAssignInputs() {
+ JsonNode data = JacksonUtils.jsonNodeFromClassPathFile("data/resource-assignment-input.json");
+ Map<String, Object> context = new HashMap<>();
+ ResourceDictionaryUtils.assignInputs(data, context);
+ String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue");
+ log.info("populated context {}", context);
+ Assert.assertTrue(String.format("failed to get variable : %s",path),context.containsKey(path));
+
+ }
+
+
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json
new file mode 100644
index 00000000..d79c9068
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json
@@ -0,0 +1,10 @@
+{
+ "intValue" : 1,
+ "floatValue" : 1.34,
+ "booleanValue" : true,
+ "stringValue" : "sample-String",
+ "timeValue" : "2018-09-29",
+ "arrayStringValue" : ["one", "two"],
+ "mapValue" : {"profile_name1":"profile_name1",
+ "profile_name2":"profile_name2"}
+} \ No newline at end of file