diff options
author | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-21 04:11:57 +0000 |
---|---|---|
committer | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-21 04:11:57 +0000 |
commit | 42b670cfd17dab61dbd6632080c95572ea3b83c8 (patch) | |
tree | fc39ffa851c836470ff99672c869ee21a3be8add /ms/controllerblueprints/modules/resource-dict/src/test/java/org | |
parent | 94521c797d7f7d903622f34f2a627c011b9c33bb (diff) |
Controller Blueprints Microservice
Define Controllerblueprint API DataType and Error definitions for Config model, Service Template, Model Type and Resource Dictionary Services
Change-Id: I12d8d87292ec101601b0cfb7ba9670730973e318
Issue-ID: CCSDK-469
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/controllerblueprints/modules/resource-dict/src/test/java/org')
2 files changed, 83 insertions, 14 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/DictionaryDefinitionTest.java new file mode 100644 index 00000000..851ba125 --- /dev/null +++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java @@ -0,0 +1,70 @@ +/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DictionaryDefinitionTest {
+ private Logger log = LoggerFactory.getLogger(DictionaryDefinitionTest.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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+}
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 22b01c4a..0c9a1c5d 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 @@ -17,13 +17,11 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;
-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.ConfigModelConstant;
-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.ResourceDictionaryConstants;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils;
import org.slf4j.Logger;
@@ -45,9 +43,9 @@ public class ResourceDictionaryUtilsTest { DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
- Map<String, JsonNode> source = new HashMap<>();
+ Map<String, ResourceSource> source = new HashMap<>();
SourceInput sourceInput = new SourceInput();
- source.put(ConfigModelConstant.SOURCE_INPUT, JacksonUtils.jsonNodeFromObject(sourceInput));
+ source.put(ResourceDictionaryConstants.SOURCE_INPUT, sourceInput);
dictionaryDefinition.setSource(source);
ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
@@ -72,15 +70,16 @@ public class ResourceDictionaryUtilsTest { DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
- Map<String, JsonNode> source = new HashMap<>();
+ Map<String, ResourceSource> source = new HashMap<>();
SourceDb sourceDb = new SourceDb();
- source.put(ConfigModelConstant.SOURCE_DB, JacksonUtils.jsonNodeFromObject(sourceDb));
+ sourceDb.setBase("sdnc_connection");
+ source.put(ResourceDictionaryConstants.SOURCE_DB, sourceDb);
dictionaryDefinition.setSource(source);
Map<String, DictionaryDependency> dependency = new HashMap<>();
DictionaryDependency dependencyDb = new DictionaryDependency();
dependencyDb.setNames(Arrays.asList("vnf-id", "vnf-name"));
- dependency.put(ConfigModelConstant.SOURCE_DB, dependencyDb);
+ dependency.put(ResourceDictionaryConstants.SOURCE_DB, dependencyDb);
dictionaryDefinition.setDependency(dependency);
DecryptionRule decryptionRule = new DecryptionRule();
@@ -115,15 +114,15 @@ public class ResourceDictionaryUtilsTest { DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
- Map<String, JsonNode> source = new HashMap<>();
+ Map<String, ResourceSource> source = new HashMap<>();
SourceDefault sourceDefault = new SourceDefault();
- source.put(ConfigModelConstant.SOURCE_DEFAULT, JacksonUtils.jsonNodeFromObject(sourceDefault));
+ source.put(ResourceDictionaryConstants.SOURCE_DEFAULT, sourceDefault);
dictionaryDefinition.setSource(source);
Map<String, DictionaryDependency> dependency = new HashMap<>();
DictionaryDependency dependencyDefault = new DictionaryDependency();
dependencyDefault.setNames(Arrays.asList(new String[]{"vnf-id", "vnf-name"}));
- dependency.put(ConfigModelConstant.SOURCE_DEFAULT, dependencyDefault);
+ dependency.put(ResourceDictionaryConstants.SOURCE_DEFAULT, dependencyDefault);
dictionaryDefinition.setDependency(dependency);
ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
@@ -143,15 +142,15 @@ public class ResourceDictionaryUtilsTest { DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
- Map<String, JsonNode> source = new HashMap<>();
+ Map<String, ResourceSource> source = new HashMap<>();
SourceMdsal sourceMdsal = new SourceMdsal();
- source.put(ConfigModelConstant.SOURCE_MDSAL, JacksonUtils.jsonNodeFromObject(sourceMdsal));
+ source.put(ResourceDictionaryConstants.SOURCE_MDSAL,sourceMdsal);
dictionaryDefinition.setSource(source);
Map<String, DictionaryDependency> dependency = new HashMap<>();
DictionaryDependency dependencyMdsal = new DictionaryDependency();
dependencyMdsal.setNames(Arrays.asList(new String[]{"vnf-id", "vnf-name"}));
- dependency.put(ConfigModelConstant.SOURCE_MDSAL, dependencyMdsal);
+ dependency.put(ResourceDictionaryConstants.SOURCE_MDSAL, dependencyMdsal);
dictionaryDefinition.setDependency(dependency);
ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
|