aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/resource-dict/src/test
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2018-08-24 22:48:32 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2018-08-26 12:10:39 -0400
commit274c3adda0e6805701230b1137350a570d1caebf (patch)
tree871bb146746c4dfa483448bd254ce7c17b79b9f3 /ms/controllerblueprints/modules/resource-dict/src/test
parent06a872b11ad18698873452ed996fb60088e81577 (diff)
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 <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/util/ResourceDefinitionTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java)33
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java18
2 files changed, 28 insertions, 23 deletions
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/ResourceDefinitionTest.java
index 851ba125..c7184380 100644
--- 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/ResourceDefinitionTest.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.
@@ -17,54 +18,44 @@
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.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DictionaryDefinitionTest {
- private Logger log = LoggerFactory.getLogger(DictionaryDefinitionTest.class);
+public class ResourceDefinitionTest {
+ private Logger log = LoggerFactory.getLogger(ResourceDefinitionTest.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);
+ 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";
- DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", dictionaryDefinition);
+ 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";
- DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", dictionaryDefinition);
+ 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";
- DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", dictionaryDefinition);
+ 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 0c9a1c5d..b6ac103e 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);