summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ms/controllerblueprints/modules')
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java7
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java11
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java8
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java9
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaJsonNodeConverter.java40
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java39
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java8
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java8
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java18
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java3
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java4
12 files changed, 120 insertions, 37 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
index 428c5245..a763d503 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
@@ -22,7 +22,6 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
-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.utils.ResourceDictionaryUtils;
@@ -100,9 +99,9 @@ public class AutoResourceMappingService {
private void populateDictionaryMapping(Map<String, ResourceDictionary> dictionaryMap, ResourceAssignment resourceAssignment) {
ResourceDictionary dbDataDictionary = dictionaryMap.get(resourceAssignment.getName());
- if (dbDataDictionary != null && StringUtils.isNotBlank(dbDataDictionary.getDefinition())) {
+ if (dbDataDictionary != null && dbDataDictionary.getDefinition() != null) {
- ResourceDefinition dictionaryDefinition = JacksonUtils.readValue(dbDataDictionary.getDefinition(), ResourceDefinition.class);
+ ResourceDefinition dictionaryDefinition = dbDataDictionary.getDefinition();
if (dictionaryDefinition != null && StringUtils.isNotBlank(dictionaryDefinition.getName())
&& StringUtils.isBlank(resourceAssignment.getDictionaryName())) {
@@ -185,7 +184,7 @@ public class AutoResourceMappingService {
}
if (dictionaries != null) {
for (ResourceDictionary resourcedictionary : dictionaries) {
- ResourceDefinition dictionaryDefinition = JacksonUtils.readValue(resourcedictionary.getDefinition(), ResourceDefinition.class);
+ ResourceDefinition dictionaryDefinition = resourcedictionary.getDefinition();
Preconditions.checkNotNull(dictionaryDefinition, "failed to get Resource Definition from dictionary definition");
PropertyDefinition property = new PropertyDefinition();
property.setRequired(true);
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java
index c4aebe52..5510e480 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java
@@ -17,6 +17,7 @@
package org.onap.ccsdk.apps.controllerblueprints.service;
+import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
@@ -75,16 +76,16 @@ public class BluePrintRepoDBService implements BluePrintRepoService {
Preconditions.checkArgument(StringUtils.isNotBlank(modelName),
"Failed to get model from repo, model name is missing");
- return getModelDefinition(modelName).map(content -> {
- Preconditions.checkArgument(StringUtils.isNotBlank(content),
+ return getModelDefinition(modelName).map(modelDefinition -> {
+ Preconditions.checkNotNull(modelDefinition,
String.format("Failed to get model content for model name (%s)", modelName));
- return JacksonUtils.readValue(content, valueClass);
+ return JacksonUtils.readValue(modelDefinition, valueClass);
}
);
}
- private Mono<String> getModelDefinition(String modelName) throws BluePrintException {
- String modelDefinition;
+ private Mono<JsonNode> getModelDefinition(String modelName) throws BluePrintException {
+ JsonNode modelDefinition;
Optional<ModelType> modelTypeDb = modelTypeRepository.findByModelName(modelName);
if (modelTypeDb.isPresent()) {
modelDefinition = modelTypeDb.get().getDefinition();
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
index 4e7c3911..88680929 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
@@ -168,7 +168,7 @@ public class DataBaseInitService {
ResourceDictionary resourceDictionary = new ResourceDictionary();
resourceDictionary.setResourcePath(dictionaryDefinition.getResourcePath());
resourceDictionary.setName(dictionaryDefinition.getName());
- resourceDictionary.setDefinition(definitionContent);
+ resourceDictionary.setDefinition(dictionaryDefinition);
resourceDictionary.setResourceType(dictionaryDefinition.getResourceType());
resourceDictionary.setDescription(dictionaryDefinition.getProperty().getDescription());
@@ -252,7 +252,7 @@ public class DataBaseInitService {
modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE);
modelType.setDerivedFrom(nodeType.getDerivedFrom());
modelType.setDescription(nodeType.getDescription());
- modelType.setDefinition(definitionContent);
+ modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(nodeKey);
modelType.setVersion(nodeType.getVersion());
modelType.setUpdatedBy("System");
@@ -276,7 +276,7 @@ public class DataBaseInitService {
modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
modelType.setDerivedFrom(dataType.getDerivedFrom());
modelType.setDescription(dataType.getDescription());
- modelType.setDefinition(definitionContent);
+ modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(dataKey);
modelType.setVersion(dataType.getVersion());
modelType.setUpdatedBy("System");
@@ -300,7 +300,7 @@ public class DataBaseInitService {
modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
modelType.setDerivedFrom(artifactType.getDerivedFrom());
modelType.setDescription(artifactType.getDescription());
- modelType.setDefinition(definitionContent);
+ modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
modelType.setModelName(dataKey);
modelType.setVersion(artifactType.getVersion());
modelType.setUpdatedBy("System");
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
index ccf4ffcc..70e43d69 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
@@ -105,11 +105,9 @@ public class ResourceDictionaryService {
*/
public ResourceDictionary saveResourceDictionary(ResourceDictionary resourceDictionary) {
Preconditions.checkNotNull(resourceDictionary, "Resource Dictionary information is missing");
- Preconditions.checkArgument(StringUtils.isNotBlank(resourceDictionary.getDefinition()),
- "Resource Dictionary definition information is missing");
+ Preconditions.checkNotNull(resourceDictionary.getDefinition(),"Resource Dictionary definition information is missing");
- ResourceDefinition resourceDefinition =
- JacksonUtils.readValue(resourceDictionary.getDefinition(), ResourceDefinition.class);
+ ResourceDefinition resourceDefinition = resourceDictionary.getDefinition();
Preconditions.checkNotNull(resourceDefinition, "failed to get resource definition from content");
// Validate the Resource Definitions
resourceDictionaryValidationService.validate(resourceDefinition);
@@ -126,9 +124,6 @@ public class ResourceDictionaryService {
resourceDictionary.setEntrySchema(propertyDefinition.getEntrySchema().getType());
}
- String definitionContent = JacksonUtils.getJson(resourceDefinition, true);
- resourceDictionary.setDefinition(definitionContent);
-
ResourceDictionaryValidator.validateResourceDictionary(resourceDictionary);
Optional<ResourceDictionary> dbResourceDictionaryData =
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaJsonNodeConverter.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaJsonNodeConverter.java
new file mode 100644
index 00000000..05f822d5
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaJsonNodeConverter.java
@@ -0,0 +1,40 @@
+/*
+ * 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.service.domain;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+/**
+ * @author Brinda Santh
+ */
+@Converter
+public class JpaJsonNodeConverter implements
+ AttributeConverter<JsonNode, String> {
+
+ @Override
+ public String convertToDatabaseColumn(JsonNode node) {
+ return JacksonUtils.getJson(node, true);
+ }
+
+ @Override
+ public JsonNode convertToEntityAttribute(String dbData) {
+ return JacksonUtils.jsonNode(dbData);
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java
new file mode 100644
index 00000000..18672f1c
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/JpaResourceDefinitionConverter.java
@@ -0,0 +1,39 @@
+/*
+ * 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.service.domain;
+
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+/**
+ * @author Brinda Santh
+ */
+@Converter
+public class JpaResourceDefinitionConverter implements
+ AttributeConverter<ResourceDefinition, String> {
+ @Override
+ public String convertToDatabaseColumn(ResourceDefinition resourceDefinition) {
+ return JacksonUtils.getJson(resourceDefinition);
+ }
+
+ @Override
+ public ResourceDefinition convertToEntityAttribute(String content) {
+ return JacksonUtils.readValue(content, ResourceDefinition.class);
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
index cb8d229f..d8fea60e 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
@@ -17,6 +17,7 @@
package org.onap.ccsdk.apps.controllerblueprints.service.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -52,9 +53,10 @@ public class ModelType implements Serializable {
private String definitionType;
@Lob
+ @Convert(converter = JpaJsonNodeConverter.class)
@Column(name = "definition", nullable = false)
@ApiModelProperty(required=true)
- private String definition;
+ private JsonNode definition;
@Lob
@Column(name = "description", nullable = false)
@@ -118,11 +120,11 @@ public class ModelType implements Serializable {
this.definitionType = definitionType;
}
- public String getDefinition() {
+ public JsonNode getDefinition() {
return definition;
}
- public void setDefinition(String definition) {
+ public void setDefinition(JsonNode definition) {
this.definition = definition;
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
index c8846220..7af9972a 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
@@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -66,9 +67,10 @@ public class ResourceDictionary implements Serializable {
private String sampleValue;
@Lob
+ @Convert(converter = JpaResourceDefinitionConverter.class)
@Column(name = "definition", nullable = false)
@ApiModelProperty(required=true)
- private String definition;
+ private ResourceDefinition definition;
@Lob
@Column(name = "description", nullable = false)
@@ -163,11 +165,11 @@ public class ResourceDictionary implements Serializable {
this.sampleValue = sampleValue;
}
- public String getDefinition() {
+ public ResourceDefinition getDefinition() {
return definition;
}
- public void setDefinition(String definition) {
+ public void setDefinition(ResourceDefinition definition) {
this.definition = definition;
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
index aaa445a4..9641f897 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
@@ -17,6 +17,7 @@
package org.onap.ccsdk.apps.controllerblueprints.service.validator;
+import com.fasterxml.jackson.databind.JsonNode;
import org.apache.commons.lang3.StringUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
@@ -56,14 +57,14 @@ public class ModelTypeValidator {
/**
* This is a validateModelTypeDefinition
*
- * @param definitionType
- * @param definitionContent
+ * @param definitionType definitionType
+ * @param definitionContent definitionContent
* @return boolean
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
- public static boolean validateModelTypeDefinition(String definitionType, String definitionContent)
+ public static boolean validateModelTypeDefinition(String definitionType, JsonNode definitionContent)
throws BluePrintException {
- if (StringUtils.isNotBlank(definitionContent)) {
+ if (definitionContent != null) {
if (BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE.equalsIgnoreCase(definitionType)) {
DataType dataType = JacksonUtils.readValue(definitionContent, DataType.class);
if (dataType == null) {
@@ -98,8 +99,9 @@ public class ModelTypeValidator {
/**
* This is a validateModelType method
*
- * @param modelType
+ * @param modelType modelType
* @return boolean
+ * @throws BluePrintException BluePrintException
*/
public static boolean validateModelType(ModelType modelType) throws BluePrintException {
if (modelType != null) {
@@ -115,7 +117,7 @@ public class ModelTypeValidator {
throw new BluePrintException("Model Type Information is missing.");
}
- if (StringUtils.isBlank(modelType.getDefinition())) {
+ if (modelType.getDefinition() == null) {
throw new BluePrintException("Model Definition Information is missing.");
}
if (StringUtils.isBlank(modelType.getDescription())) {
@@ -133,7 +135,7 @@ public class ModelTypeValidator {
List<String> validRootTypes = getValidModelDefinitionType();
if (!validRootTypes.contains(modelType.getDefinitionType())) {
throw new BluePrintException("Not Valid Model Root Type(" + modelType.getDefinitionType()
- + "), It sould be " + validRootTypes);
+ + "), It should be " + validRootTypes);
}
validateModelTypeDefinition(modelType.getDefinitionType(), modelType.getDefinition());
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java
index ff0b4ac5..1c2a7337 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java
@@ -49,7 +49,7 @@ public class ResourceDictionaryValidator {
"DataDictionary Resource Name Information is missing.");
Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourceType()),
"DataDictionary Resource Type Information is missing.");
- Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getDefinition()),
+ Preconditions.checkNotNull( resourceDictionary.getDefinition(),
"DataDictionary Definition Information is missing.");
Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getDescription()),
"DataDictionary Description Information is missing.");
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
index 8e88f0a6..c28abe2d 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
@@ -22,6 +22,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -64,7 +65,7 @@ public class ModelTypeRestTest {
modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
modelType.setDescription("Definition for Sample Datatype ");
- modelType.setDefinition(content);
+ modelType.setDefinition(JacksonUtils.jsonNode(content));
modelType.setModelName(modelName);
modelType.setVersion("1.0.0");
modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
index 8bb1f0b8..82346954 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
@@ -24,6 +24,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -58,7 +60,7 @@ public class ResourceDictionaryRestTest {
ResourceDictionary dataDictionary = new ResourceDictionary();
dataDictionary.setResourcePath("test/vnf/ipaddress");
dataDictionary.setName("test-name");
- dataDictionary.setDefinition(definition);
+ dataDictionary.setDefinition(JacksonUtils.readValue(definition, ResourceDefinition.class));
dataDictionary.setValidValues("127.0.0.1");
dataDictionary.setResourceType("ONAP");
dataDictionary.setDataType("string");