From 19ef02e9ad1d5b4550f0663cef2a9a9866266ec0 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Thu, 28 Feb 2019 09:00:18 -0500 Subject: Use protobuf JsonFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of manually parsing Struct to ObjectNode, uses JsonFormat Change-Id: I5a457f10e3d106f189f9636fbcc166b12e3915fd Issue-ID: CCSDK-947 Signed-off-by: Alexis de Talhouët --- .../selfservice/api/utils/BluePrintMappingTests.kt | 41 ---------------------- 1 file changed, 41 deletions(-) (limited to 'ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test') diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt index 2e4ba2755..04a2c1e8e 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt @@ -1,11 +1,5 @@ package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils -import com.fasterxml.jackson.databind.ObjectMapper -import com.google.protobuf.ListValue -import com.google.protobuf.NullValue -import com.google.protobuf.Struct -import com.google.protobuf.Value -import com.google.protobuf.util.JsonFormat import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -134,39 +128,4 @@ class BluePrintMappingsTest { Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion) Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode) } - - @Test - fun testStructToJava() { - val struct = Struct.newBuilder().putAllFields(createValues()).build() - val struct2 = struct.toJava() - - val mapper = ObjectMapper() - - Assert.assertEquals(JsonFormat.printer().print(struct).replace(" ", "").replace("\r",""), - mapper.writerWithDefaultPrettyPrinter().writeValueAsString(struct2).replace(" ", "").replace("\r","")) - } - - fun createValues(): Map { - val map = mutableMapOf() - - val boolValue = Value.newBuilder().setBoolValue(true).build() - val stringValue = Value.newBuilder().setStringValue("string").build() - val doubleValue = Value.newBuilder().setNumberValue(Double.MAX_VALUE).build() - val jsonValue = Value.newBuilder().setStringValue("{\"bblah\": \"bbblo\"}").build() - val listValue = Value.newBuilder().setListValue(ListValue.newBuilder().addValues(boolValue).addValues(boolValue).build()).build() - val nullValue = Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build() - - map.put("bool", boolValue) - map.put("string", stringValue) - map.put("doublbe", doubleValue) - map.put("json", jsonValue) - map.put("list", listValue) - map.put("null", nullValue) - - val structValue = Value.newBuilder().setStructValue(Struct.newBuilder().putAllFields(map).build()).build() - - map.put("struct", structValue) - - return map - } } \ No newline at end of file -- cgit 1.2.3-korg