diff options
Diffstat (limited to 'components')
7 files changed, 193 insertions, 212 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt index 01874455..58a82079 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.ccsdk.apps.controllerblueprints.core.utils
import com.att.eelf.configuration.EELFLogger
@@ -22,6 +21,9 @@ import com.att.eelf.configuration.EELFManager import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import kotlinx.coroutines.Dispatchers
@@ -40,241 +42,209 @@ import java.nio.charset.Charset *
* @author Brinda Santh
*/
-object JacksonUtils {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
-
- inline fun <reified T : Any> readValue(content: String): T =
- jacksonObjectMapper().readValue(content, T::class.java)
+class JacksonUtils {
+ companion object {
+ private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
+ inline fun <reified T : Any> readValue(content: String): T =
+ jacksonObjectMapper().readValue(content, T::class.java)
+
+ fun <T> readValue(content: String, valueType: Class<T>): T? {
+ return jacksonObjectMapper().readValue(content, valueType)
+ }
- @JvmStatic
- fun <T> readValue(content: String, valueType: Class<T>): T? {
- return jacksonObjectMapper().readValue(content, valueType)
- }
+ fun <T> readValue(node: JsonNode, valueType: Class<T>): T? {
+ return jacksonObjectMapper().treeToValue(node, valueType)
+ }
- @JvmStatic
- fun <T> readValue(node: JsonNode, valueType: Class<T>): T? {
- return jacksonObjectMapper().treeToValue(node, valueType)
- }
+ fun getContent(fileName: String): String = runBlocking {
+ async {
+ try {
+ File(fileName).readText(Charsets.UTF_8)
+ } catch (e: Exception) {
+ throw BluePrintException("couldn't get file ($fileName) content : ${e.message}")
+ }
+ }.await()
+ }
- @JvmStatic
- fun getContent(fileName: String): String = runBlocking {
- async {
- try {
- File(fileName).readText(Charsets.UTF_8)
- } catch (e: Exception) {
- throw BluePrintException("couldn't get file ($fileName) content : ${e.message}")
+ fun getClassPathFileContent(fileName: String): String {
+ return runBlocking {
+ withContext(Dispatchers.Default) {
+ IOUtils.toString(JacksonUtils::class.java.classLoader
+ .getResourceAsStream(fileName), Charset.defaultCharset())
+ }
}
- }.await()
- }
+ }
- @JvmStatic
- fun getClassPathFileContent(fileName: String): String {
- return runBlocking {
- withContext(Dispatchers.Default) {
- IOUtils.toString(JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset())
- }
+ fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {
+ val content: String = getContent(fileName)
+ return readValue(content, valueType)
}
- }
- @JvmStatic
- fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {
- val content: String = getContent(fileName)
- return readValue(content, valueType)
- }
+ fun <T> readValueFromClassPathFile(fileName: String, valueType: Class<T>): T? {
+ val content: String = getClassPathFileContent(fileName)
+ return readValue(content, valueType)
+ }
- @JvmStatic
- fun <T> readValueFromClassPathFile(fileName: String, valueType: Class<T>): T? {
- val content: String = getClassPathFileContent(fileName)
- return readValue(content, valueType)
- }
+ fun jsonNodeFromObject(from: kotlin.Any): JsonNode {
+ return jacksonObjectMapper().convertValue(from, JsonNode::class.java)
+ }
- @JvmStatic
- fun jsonNodeFromObject(from: kotlin.Any): JsonNode = jacksonObjectMapper().convertValue(from, JsonNode::class.java)
+ fun jsonNodeFromClassPathFile(fileName: String): JsonNode {
+ val content: String = getClassPathFileContent(fileName)
+ return jsonNode(content)
+ }
- @JvmStatic
- fun jsonNodeFromClassPathFile(fileName: String): JsonNode {
- val content: String = getClassPathFileContent(fileName)
- return jsonNode(content)
- }
+ fun jsonNodeFromFile(fileName: String): JsonNode {
+ val content: String = getContent(fileName)
+ return jsonNode(content)
+ }
- @JvmStatic
- fun jsonNodeFromFile(fileName: String): JsonNode {
- val content: String = getContent(fileName)
- return jsonNode(content)
- }
+ fun jsonNode(content: String): JsonNode {
+ return jacksonObjectMapper().readTree(content)
+ }
- @JvmStatic
- fun jsonNode(content: String): JsonNode {
- return jacksonObjectMapper().readTree(content)
- }
+ fun getJson(any: kotlin.Any): String {
+ return getJson(any, false)
+ }
- @JvmStatic
- fun getJson(any: kotlin.Any): String {
- return getJson(any, false)
- }
+ fun getWrappedJson(wrapper: String, any: kotlin.Any, pretty: Boolean = false): String {
+ val wrapperMap = hashMapOf<String, Any>()
+ wrapperMap[wrapper] = any
+ return getJson(wrapperMap, pretty)
+ }
- @JvmStatic
- fun getWrappedJson(wrapper: String, any: kotlin.Any, pretty: Boolean = false): String {
- val wrapperMap = hashMapOf<String, Any>()
- wrapperMap[wrapper] = any
- return getJson(wrapperMap, pretty)
- }
+ fun getJson(any: kotlin.Any, pretty: Boolean = false): String {
+ val objectMapper = jacksonObjectMapper()
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ if (pretty) {
+ objectMapper.enable(SerializationFeature.INDENT_OUTPUT)
+ }
+ return objectMapper.writeValueAsString(any)
+ }
- @JvmStatic
- fun getJson(any: kotlin.Any, pretty: Boolean = false): String {
- val objectMapper = jacksonObjectMapper()
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
- if (pretty) {
- objectMapper.enable(SerializationFeature.INDENT_OUTPUT)
+ fun getJsonNode(any: kotlin.Any?, pretty: Boolean = false): JsonNode {
+ val objectMapper = jacksonObjectMapper()
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ if (pretty) {
+ objectMapper.enable(SerializationFeature.INDENT_OUTPUT)
+ }
+ return objectMapper.valueToTree(any)
}
- return objectMapper.writeValueAsString(any)
- }
- @JvmStatic
- fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T>? {
- return getListFromJson(node.toString(), valueType)
- }
+ fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T>? {
+ return getListFromJson(node.toString(), valueType)
+ }
- @JvmStatic
- fun <T> getListFromJson(content: String, valueType: Class<T>): List<T>? {
- val objectMapper = jacksonObjectMapper()
- val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType)
- return objectMapper.readValue<List<T>>(content, javaType)
- }
+ fun <T> getListFromJson(content: String, valueType: Class<T>): List<T>? {
+ val objectMapper = jacksonObjectMapper()
+ val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType)
+ return objectMapper.readValue<List<T>>(content, javaType)
+ }
- @JvmStatic
- fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T>? {
- val content: String = getContent(fileName)
- return getListFromJson(content, valueType)
- }
+ fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T>? {
+ val content: String = getContent(fileName)
+ return getListFromJson(content, valueType)
+ }
- @JvmStatic
- fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T>? {
- val content: String = getClassPathFileContent(fileName)
- return getListFromJson(content, valueType)
- }
+ fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T>? {
+ val content: String = getClassPathFileContent(fileName)
+ return getListFromJson(content, valueType)
+ }
- @JvmStatic
- fun <T> getMapFromJson(content: String, valueType: Class<T>): MutableMap<String, T>? {
- val objectMapper = jacksonObjectMapper()
- val typeRef = object : TypeReference<MutableMap<String, T>>() {}
- return objectMapper.readValue(content, typeRef)
- }
+ fun <T> getMapFromJson(content: String, valueType: Class<T>): MutableMap<String, T>? {
+ val objectMapper = jacksonObjectMapper()
+ val typeRef = object : TypeReference<MutableMap<String, T>>() {}
+ return objectMapper.readValue(content, typeRef)
+ }
- @JvmStatic
- fun <T> getMapFromFile(fileName: String, valueType: Class<T>): MutableMap<String, T>? {
- val content: String = getContent(fileName)
- return getMapFromJson(content, valueType)
- }
+ fun <T> getMapFromFile(fileName: String, valueType: Class<T>): MutableMap<String, T>? {
+ val content: String = getContent(fileName)
+ return getMapFromJson(content, valueType)
+ }
- @JvmStatic
- fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {
- if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
- return checkJsonNodeValueOfPrimitiveType(type, jsonNode)
- } else if (BluePrintTypes.validCollectionTypes().contains(type)) {
- return checkJsonNodeValueOfCollectionType(type, jsonNode)
+ fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {
+ if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
+ return checkJsonNodeValueOfPrimitiveType(type, jsonNode)
+ } else if (BluePrintTypes.validCollectionTypes().contains(type)) {
+ return checkJsonNodeValueOfCollectionType(type, jsonNode)
+ }
+ return false
}
- return false
- }
- @JvmStatic
- fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean {
- when (primitiveType) {
- BluePrintConstants.DATA_TYPE_STRING -> return jsonNode.isTextual
- BluePrintConstants.DATA_TYPE_BOOLEAN -> return jsonNode.isBoolean
- BluePrintConstants.DATA_TYPE_INTEGER -> return jsonNode.isInt
- BluePrintConstants.DATA_TYPE_FLOAT -> return jsonNode.isDouble
- BluePrintConstants.DATA_TYPE_TIMESTAMP -> return jsonNode.isTextual
- else -> return false
+ fun checkJsonNodeValueOfPrimitiveType(primitiveType: String, jsonNode: JsonNode): Boolean {
+ when (primitiveType) {
+ BluePrintConstants.DATA_TYPE_STRING -> return jsonNode.isTextual
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> return jsonNode.isBoolean
+ BluePrintConstants.DATA_TYPE_INTEGER -> return jsonNode.isInt
+ BluePrintConstants.DATA_TYPE_FLOAT -> return jsonNode.isDouble
+ BluePrintConstants.DATA_TYPE_TIMESTAMP -> return jsonNode.isTextual
+ else -> return false
+ }
}
- }
- @JvmStatic
- fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean {
- when (type) {
- BluePrintConstants.DATA_TYPE_LIST -> return jsonNode.isArray
- BluePrintConstants.DATA_TYPE_MAP -> return jsonNode.isContainerNode
- else -> return false
+ fun checkJsonNodeValueOfCollectionType(type: String, jsonNode: JsonNode): Boolean {
+ when (type) {
+ BluePrintConstants.DATA_TYPE_LIST -> return jsonNode.isArray
+ BluePrintConstants.DATA_TYPE_MAP -> return jsonNode.isContainerNode
+ else -> return false
+ }
}
- }
-/*
- @JvmStatic
- fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) {
- if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {
- objectNode.put(key, value as Boolean)
- } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {
- objectNode.put(key, value as Int)
- } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {
- objectNode.put(key, value as Float)
- } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == primitiveType) {
- objectNode.put(key, value as String)
- } else {
- objectNode.put(key, value as String)
+ fun populatePrimitiveValues(key: String, value: Any, primitiveType: String, objectNode: ObjectNode) {
+ when (primitiveType) {
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, value as Boolean)
+ BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, value as Int)
+ BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, value as Float)
+ BluePrintConstants.DATA_TYPE_TIMESTAMP -> objectNode.put(key, value as String)
+ else -> objectNode.put(key, value as String)
+ }
}
- }
- @JvmStatic
- fun populatePrimitiveValues(value: Any, primitiveType: String, objectNode: ArrayNode) {
- if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {
- objectNode.add(value as Boolean)
- } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {
- objectNode.add(value as Int)
- } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {
- objectNode.add(value as Float)
- } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == primitiveType) {
- objectNode.add(value as String)
- } else {
- objectNode.add(value as String)
+ fun populatePrimitiveValues(value: Any, primitiveType: String, arrayNode: ArrayNode) {
+ when (primitiveType) {
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(value as Boolean)
+ BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(value as Int)
+ BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(value as Float)
+ BluePrintConstants.DATA_TYPE_TIMESTAMP -> arrayNode.add(value as String)
+ else -> arrayNode.add(value as String)
+ }
}
- }
- @JvmStatic
- fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {
- if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {
- objectNode.put(key, false)
- } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {
- objectNode.put(key, 0)
- } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {
- objectNode.put(key, 0.0)
- } else {
- objectNode.put(key, "")
+ fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {
+ when (primitiveType) {
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> objectNode.put(key, false)
+ BluePrintConstants.DATA_TYPE_INTEGER -> objectNode.put(key, 0)
+ BluePrintConstants.DATA_TYPE_FLOAT -> objectNode.put(key, 0.0)
+ else -> objectNode.put(key, "")
+ }
}
- }
- @JvmStatic
- fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {
- if (BluePrintConstants.DATA_TYPE_BOOLEAN == primitiveType) {
- arrayNode.add(false)
- } else if (BluePrintConstants.DATA_TYPE_INTEGER == primitiveType) {
- arrayNode.add(0)
- } else if (BluePrintConstants.DATA_TYPE_FLOAT == primitiveType) {
- arrayNode.add(0.0)
- } else {
- arrayNode.add("")
+ fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {
+ when (primitiveType) {
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> arrayNode.add(false)
+ BluePrintConstants.DATA_TYPE_INTEGER -> arrayNode.add(0)
+ BluePrintConstants.DATA_TYPE_FLOAT -> arrayNode.add(0.0)
+ else -> arrayNode.add("")
+ }
}
- }
- @JvmStatic
- fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) {
- if (nodeValue == null || nodeValue is NullNode) {
- objectNode.set(key, nodeValue)
- } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
- if (BluePrintConstants.DATA_TYPE_BOOLEAN == type) {
- objectNode.put(key, nodeValue.asBoolean())
- } else if (BluePrintConstants.DATA_TYPE_INTEGER == type) {
- objectNode.put(key, nodeValue.asInt())
- } else if (BluePrintConstants.DATA_TYPE_FLOAT == type) {
- objectNode.put(key, nodeValue.floatValue())
- } else if (BluePrintConstants.DATA_TYPE_TIMESTAMP == type) {
- objectNode.put(key, nodeValue.asText())
+ fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) {
+ if (nodeValue == null || nodeValue is NullNode) {
+ objectNode.set(key, nodeValue)
+ } else if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
+ populatePrimitiveValues(key, nodeValue, type, objectNode)
} else {
- objectNode.put(key, nodeValue.asText())
+ objectNode.set(key, nodeValue)
+ }
+ }
+
+ fun convertPrimitiveResourceValue(type: String, value: String): JsonNode? {
+ when (type) {
+ BluePrintConstants.DATA_TYPE_BOOLEAN -> return JacksonUtils.getJsonNode(value as Boolean)
+ BluePrintConstants.DATA_TYPE_INTEGER -> return JacksonUtils.getJsonNode(value as Int)
+ BluePrintConstants.DATA_TYPE_FLOAT -> return JacksonUtils.getJsonNode(value as Float)
+ else -> return JacksonUtils.getJsonNode(value)
}
- } else {
- objectNode.set(key, nodeValue)
}
}
- */
}
\ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 1dfb89a5..c01b14b3 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -26,8 +26,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintRuntimeUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromFile
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils.jsonNodeFromObject
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
@@ -47,7 +46,7 @@ class BluePrintRuntimeServiceTest { val inputDataPath = "src/test/resources/data/default-context.json"
- val inputNode: JsonNode = jsonNodeFromFile(inputDataPath)
+ val inputNode: JsonNode = JacksonUtils.jsonNodeFromFile(inputDataPath)
bluePrintRuntimeService.assignInputs(inputNode)
val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")
@@ -82,9 +81,9 @@ class BluePrintRuntimeServiceTest { "ResourceAssignmentComponent", "process")
assertNotNull(inContext, "Failed to populate interface input property values")
- assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
- assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
- }
+ assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
+ assertEquals(inContext["request-id"], JacksonUtils.jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
+ }
@Test
fun testResolveNodeTemplateInterfaceOperationOutputs() {
@@ -113,9 +112,9 @@ class BluePrintRuntimeServiceTest { val bluePrintRuntimeService = getBluePrintRuntimeService()
bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context1",
- jsonNodeFromObject("context1-value"))
+ JacksonUtils.jsonNodeFromObject("context1-value"))
bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context2",
- jsonNodeFromObject("context2-value"))
+ JacksonUtils.jsonNodeFromObject("context2-value"))
val keys = listOf("context1", "context2")
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json index 7d850f20..6d771cd6 100644 --- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json @@ -28,6 +28,14 @@ "required": true, "type": "string" }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "vnf-id": { + "required": true, + "type": "string" + }, "action-name": { "required": true, "type": "string" @@ -39,6 +47,10 @@ "hostname": { "required": true, "type": "string" + }, + "vnf_name": { + "required": true, + "type": "string" } }, "derived_from": "tosca.datatypes.Dynamic" diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java index fde80005..cb39200f 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinitionTest.java @@ -31,7 +31,7 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionInputSource(){
String fileName = basePath + "/input-source.json";
- ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition);
}
@@ -39,7 +39,7 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionDefaultSource(){
String fileName = basePath + "/default-source.json";
- ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition);
}
@@ -47,14 +47,14 @@ public class ResourceDefinitionTest { public void testDictionaryDefinitionDBSource(){
String fileName = basePath + "/db-source.json";
- ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition);
}
@Test
public void testDictionaryDefinitionMDSALSource(){
String fileName = basePath + "/mdsal-source.json";
- ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition);
}
}
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java index 2b68585f..f5c3567f 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java @@ -45,7 +45,7 @@ public class ResourceDefinitionValidationServiceTest { private void testValidate(String fileName) throws Exception { - ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class); + ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition); ResourceDefinitionValidationService resourceDictionaryValidationService = diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java index c7444dba..a2c2310b 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java @@ -30,7 +30,7 @@ public class BulkResourceSequencingUtilsTest { @Test
public void testProcess(){
- List<ResourceAssignment> assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment.class);
+ List<ResourceAssignment> assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class);
Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments);
BulkResourceSequencingUtils.process(assignments);
}
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java index 13bf8195..fa241380 100644 --- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java +++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java @@ -86,7 +86,7 @@ public class ResourceDictionaryUtilsTest { @Test
public void testAssignInputs() {
- JsonNode data = JacksonUtils.jsonNodeFromClassPathFile("data/resource-assignment-input.json");
+ JsonNode data = JacksonUtils.Companion.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");
|