summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/resource-dict/src
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
commit7b23a92a3d079940193eaf141ff8494851b49d61 (patch)
treee91344b83fd419900ec77638fb467035f667dd6c /ms/controllerblueprints/modules/resource-dict/src
parentbddb076486a7c3def39687f6f9aaa0fc060d85e6 (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')
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java167
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java3
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java3
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt34
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt95
-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
12 files changed, 171 insertions, 192 deletions
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java
deleted file mode 100644
index f85e5ebcd..000000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * ResourceAssignment.java Purpose: Provide ResourceAssignment Custom TOSCO Model POJO bean.
- *
- * @author Brinda Santh
- * @version 1.0
- */
-public class ResourceAssignment {
- @JsonProperty(value = "name", required = true)
- private String name;
-
- @JsonProperty(value = "property", required = true)
- private PropertyDefinition property;
-
- @JsonProperty("input-param")
- private Boolean inputParameter;
-
- @JsonProperty("dictionary-name")
- private String dictionaryName;
-
- @JsonProperty("dictionary-source")
- private String dictionarySource;
-
- @JsonProperty("dependencies")
- private List<String> dependencies;
-
- @JsonProperty("version")
- private int version;
-
- @JsonProperty("status")
- private String status;
-
- @JsonProperty("message")
- private String message;
-
- @JsonProperty("updated-date")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date updatedDate;
-
- @JsonProperty("updated-by")
- private String updatedBy;
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("[");
- builder.append("name = " + name);
- builder.append(", source = " + dictionarySource);
- if (dependencies != null) {
- builder.append(", dependencies = " + dependencies);
- }
- builder.append("]");
- return builder.toString();
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public PropertyDefinition getProperty() {
- return property;
- }
-
- public void setProperty(PropertyDefinition property) {
- this.property = property;
- }
-
- public Boolean getInputParameter() {
- return inputParameter;
- }
-
- public void setInputParameter(Boolean inputParameter) {
- this.inputParameter = inputParameter;
- }
-
- public String getDictionaryName() {
- return dictionaryName;
- }
-
- public void setDictionaryName(String dictionaryName) {
- this.dictionaryName = dictionaryName;
- }
-
- public String getDictionarySource() {
- return dictionarySource;
- }
-
- public void setDictionarySource(String dictionarySource) {
- this.dictionarySource = dictionarySource;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
- public int getVersion() {
- return version;
- }
-
- public void setVersion(int version) {
- this.version = version;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Date getUpdatedDate() {
- return updatedDate;
- }
-
- public void setUpdatedDate(Date updatedDate) {
- this.updatedDate = updatedDate;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
-}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
index 7c2d926f0..92178673e 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.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.
@@ -26,6 +27,7 @@ import java.util.Map;
* DictionaryDefinition.java Purpose:
* @author Brinda Santh
*/
+@Deprecated
public class DictionaryDefinition {
@JsonProperty(value = "name", required = true)
private String name;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java
index acb710584..6ffbca264 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.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.
@@ -22,6 +23,7 @@ import java.util.List;
* DictionaryDependency
* @author Brinda Santh
*/
+@Deprecated
public class DictionaryDependency {
private List<String> names;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
index 724d0224e..fbeab52f0 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.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.
@@ -24,6 +25,7 @@ import java.util.Map;
* SourceDb
* @author Brinda Santh
*/
+@Deprecated
public class SourceDb implements ResourceSource{
@JsonProperty(value = "base", required = true)
private String base;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
index d165192e9..e0f83bb89 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.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.data;
* SourceDefault
* @author Brinda Santh
*/
+@Deprecated
public class SourceDefault implements ResourceSource {
private String key;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java
index 86476e1c2..a097c56d9 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.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.
@@ -29,7 +30,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-
+@Deprecated
public class SourceDeserializer extends JsonDeserializer<Map<String, ResourceSource>> {
private static final Logger log = LoggerFactory.getLogger(SourceDeserializer.class);
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
index 87184f223..8ab16ecbc 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.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.data;
* SourceInput
* @author Brinda Santh
*/
+@Deprecated
public class SourceInput implements ResourceSource {
private String key;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
index 8a066e91a..379f6e915 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.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.
@@ -23,7 +24,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
-
+@Deprecated
public class SourceMdsal implements ResourceSource {
@JsonProperty(value = "base", required = true)
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt
new file mode 100644
index 000000000..a6802f677
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ * 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
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+
+interface ResourceAssignmentProcessor {
+
+ @Throws(BluePrintProcessorException::class)
+ fun validate(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+
+ @Throws(BluePrintProcessorException::class)
+ fun process(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+
+ @Throws(BluePrintProcessorException::class)
+ fun errorHandle(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+
+ @Throws(BluePrintProcessorException::class)
+ fun reTrigger(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt
new file mode 100644
index 000000000..c2c8094b9
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ * 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
+
+import com.fasterxml.jackson.annotation.JsonFormat
+import com.fasterxml.jackson.annotation.JsonProperty
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DecryptionRule
+import java.io.Serializable
+import java.util.*
+
+open class ResourceDefinition{
+
+ @JsonProperty(value = "name", required = true)
+ lateinit var name: String
+
+ @JsonProperty(value = "property", required = true)
+ lateinit var property : PropertyDefinition
+
+ var tags: String? = null
+
+ @JsonProperty(value = "updated-by")
+ lateinit var updatedBy: String
+
+ @JsonProperty(value = "resource-type", required = true)
+ lateinit var resourceType: String
+
+ @JsonProperty(value = "resource-path", required = true)
+ lateinit var resourcePath: String
+
+ @JsonProperty(value = "sources", required = true)
+ var sources: MutableMap<String, NodeTemplate>? = null
+
+ @JsonProperty("decryption-rules")
+ var decryptionRules: MutableList<DecryptionRule>? = null
+
+}
+
+open class ResourceAssignment {
+
+ @JsonProperty(value = "name", required = true)
+ lateinit var name: String
+
+ @JsonProperty(value = "property")
+ var property: PropertyDefinition? = null
+
+ @JsonProperty("input-param")
+ var inputParameter: Boolean = false
+
+ @JsonProperty("dictionary-name")
+ var dictionaryName: String? = null
+
+ @JsonProperty("dictionary-source")
+ var dictionarySource: String? = null
+
+ @JsonProperty("dependencies")
+ var dependencies: MutableList<String>? = null
+
+ @JsonProperty("version")
+ var version: Int = 0
+
+ @JsonProperty("status")
+ var status: String? = null
+
+ @JsonProperty("message")
+ var message: String? = null
+
+ @JsonProperty("updated-date")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ var updatedDate: Date? = null
+
+ @JsonProperty("updated-by")
+ var updatedBy: String? = null
+}
+
+/**
+ * Interface for Source Definitions (ex Input Source,
+ * Default Source, Database Source, Rest Sources, etc)
+ */
+interface ResourceSource : Serializable
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 851ba1256..c71843804 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 0c9a1c5d8..b6ac103ee 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);