Cleanup/fix jackson 2 -> 3 migration (#3024)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -45,7 +45,6 @@ import java.util.stream.Stream;
|
||||
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.eclipse.hawkbit.auth.SpPermission;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
@@ -115,7 +114,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
private static final String JSON_PATH_ROOT = "$";
|
||||
// fields, attributes
|
||||
private static final String JSON_PATH_FIELD_ID = ".id";
|
||||
private static final String JSON_PATH_FIELD_CONTROLLERID = ".controllerId";
|
||||
private static final String JSON_PATH_FIELD_CONTROLLER_ID = ".controllerId";
|
||||
private static final String JSON_PATH_FIELD_NAME = ".name";
|
||||
private static final String JSON_PATH_FIELD_DESCRIPTION = ".description";
|
||||
private static final String JSON_PATH_FIELD_CONTENT = ".content";
|
||||
@@ -133,7 +132,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
private static final String JSON_PATH_FIELD_TARGET_TYPE = ".targetType";
|
||||
private static final String JSON_PATH_NAME = JSON_PATH_ROOT + JSON_PATH_FIELD_NAME;
|
||||
private static final String JSON_PATH_ID = JSON_PATH_ROOT + JSON_PATH_FIELD_ID;
|
||||
private static final String JSON_PATH_CONTROLLERID = JSON_PATH_ROOT + JSON_PATH_FIELD_CONTROLLERID;
|
||||
private static final String JSON_PATH_CONTROLLER_ID = JSON_PATH_ROOT + JSON_PATH_FIELD_CONTROLLER_ID;
|
||||
private static final String JSON_PATH_DESCRIPTION = JSON_PATH_ROOT + JSON_PATH_FIELD_DESCRIPTION;
|
||||
private static final String JSON_PATH_LAST_REQUEST_AT = JSON_PATH_ROOT + JSON_PATH_FIELD_LAST_REQUEST_AT;
|
||||
private static final String JSON_PATH_TYPE = JSON_PATH_ROOT + JSON_PATH_FIELD_TARGET_TYPE;
|
||||
@@ -853,7 +852,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(JSON_PATH_NAME, equalTo(knownName)))
|
||||
.andExpect(jsonPath(JSON_PATH_CONTROLLERID, equalTo(knownControllerId)))
|
||||
.andExpect(jsonPath(JSON_PATH_CONTROLLER_ID, equalTo(knownControllerId)))
|
||||
.andExpect(jsonPath(JSON_PATH_DESCRIPTION, equalTo(TARGET_DESCRIPTION_TEST)))
|
||||
.andExpect(jsonPath(JSON_PATH_LAST_REQUEST_AT, equalTo(target.getLastTargetQuery())))
|
||||
.andExpect(jsonPath("$.pollStatus", hasKey("lastRequestAt")))
|
||||
@@ -2353,7 +2352,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(JSON_PATH_NAME, equalTo("targetOfType1")))
|
||||
.andExpect(jsonPath(JSON_PATH_CONTROLLERID, equalTo("id2")))
|
||||
.andExpect(jsonPath(JSON_PATH_CONTROLLER_ID, equalTo("id2")))
|
||||
.andExpect(jsonPath(JSON_PATH_TYPE, equalTo(type1.getId().intValue())))
|
||||
.andExpect(jsonPath(JSON_PATH_DESCRIPTION, equalTo("testid2")))
|
||||
.andExpect(jsonPath("$._links.targetType.href", equalTo(hrefType1)))
|
||||
|
||||
@@ -25,7 +25,6 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.eclipse.hawkbit.auth.SpPermission;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValueRequest;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
@@ -35,6 +34,7 @@ import org.json.JSONObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.ResultMatcher;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* Spring MVC Tests against the MgmtTenantManagementResource.
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.resource.util;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
|
||||
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* Utility additions for the REST API tests.
|
||||
@@ -22,11 +20,11 @@ public final class ResourceUtility {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
public static ExceptionInfo convertException(final String jsonExceptionResponse) throws IOException {
|
||||
public static ExceptionInfo convertException(final String jsonExceptionResponse) {
|
||||
return OBJECT_MAPPER.readValue(jsonExceptionResponse, ExceptionInfo.class);
|
||||
}
|
||||
|
||||
public static MgmtArtifact convertArtifactResponse(final String jsonResponse) throws IOException {
|
||||
public static MgmtArtifact convertArtifactResponse(final String jsonResponse) {
|
||||
return OBJECT_MAPPER.readValue(jsonResponse, MgmtArtifact.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user