*/
package org.openecomp.mso.adapters.sdnc.sdncrest;
-import org.openecomp.mso.adapters.sdncrest.SDNCEvent;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceError;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse;
-import org.codehaus.jackson.map.DeserializationConfig;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.openecomp.mso.adapters.sdncrest.SDNCEvent;
+import org.openecomp.mso.adapters.sdncrest.SDNCServiceError;
+import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest;
+import org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
"}" + EOL;
private final String PARAMS =
- "{\"entry\":[{\"key\":\"P1\",\"value\":\"V1\"},{\"key\":\"P2\",\"value\":\"V2\"},{\"key\":\"P3\",\"value\":\"V3\"}]}";
+ "{\"P1\":\"V1\",\"P2\":\"V2\",\"P3\":\"V3\"}";
@Test
public final void jsonToSDNCServiceRequest() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
String json = SDNC_SERVICE_REQUEST;
json = json.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL);
public final void jsonToSDNCServiceRequestWithoutOptionalFields() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// bpTimeout is optional.
String json = SDNC_SERVICE_REQUEST;
public final void jsonFromSDNCServiceRequest() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// Convert source json string to object.
String json1 = SDNC_SERVICE_REQUEST;
public final void jsonFromSDNCServiceRequestWithoutOptionalFields() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// Convert source json string to object.
String json1 = SDNC_SERVICE_REQUEST;
public final void jsonToSDNCServiceResponse() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
String json = SDNC_SERVICE_RESPONSE;
json = json.replace("((RESPONSE-MESSAGE))", " \"responseMessage\": \"" + "OK" + "\"," + EOL);
public final void jsonToSDNCServiceResponseWithoutOptionalFields() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// responseMessage is optional.
String json = SDNC_SERVICE_RESPONSE;
public final void jsonFromSDNCServiceResponse() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// Convert source json string to object.
String json1 = SDNC_SERVICE_RESPONSE;
public final void jsonFromSDNCServiceResponseWithoutOptionalFields() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// Convert source json string to object.
String json1 = SDNC_SERVICE_RESPONSE;
public final void jsonToSDNCServiceError() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
String json = SDNC_SERVICE_ERROR;
json = json.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "SOMETHING BAD" + "\"," + EOL);
public final void jsonToSDNCServiceErrorWithoutOptionalFields() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// responseMessage is optional.
String json = SDNC_SERVICE_ERROR;
public final void jsonFromSDNCServiceError() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// Convert source json string to object.
String json1 = SDNC_SERVICE_ERROR;
public final void jsonFromSDNCServiceErrorWithoutOptionalFields() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// Convert source json string to object.
String json1 = SDNC_SERVICE_ERROR;
public final void jsonToSDNCEvent() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
String json = SDNC_EVENT;
json = json.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL);
public final void jsonToSDNCEventWithoutOptionalFields() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// params are optional.
String json = SDNC_EVENT;
public final void jsonFromSDNCEvent() throws Exception {
logTest();
ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
- mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+ mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
+ mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
// Convert source json string to object.
String json1 = SDNC_EVENT;