Loading atlas-commands/src/test/java/es/redmic/test/atlascommands/integration/layer/LayerDataUtil.java +18 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ import org.joda.time.DateTime; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Polygon; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import es.redmic.atlaslib.dto.layer.ActivityDTO; import es.redmic.atlaslib.dto.layer.AttributionDTO; import es.redmic.atlaslib.dto.layer.ContactDTO; Loading Loading @@ -286,6 +289,21 @@ public abstract class LayerDataUtil { return layerInfo; } public static String getLayerInfoToSave(LayerInfoDTO layerInfoDTO) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); String layerInfoString = mapper.writeValueAsString(layerInfoDTO); layerInfoString = layerInfoString.replace(mapper.writeValueAsString(ThemeInspireDataUtil.getThemeInspire("cc")), "\"" + ThemeInspireDataUtil.getThemeInspire("cc").getId() + "\""); layerInfoString = layerInfoString.replace(mapper.writeValueAsString(CategoryDataUtil.getCategory("3442")), "\"" + CategoryDataUtil.getCategory("3442").getId() + "\""); return layerInfoString; } public static LayerDTO getLayer(String code) { LayerDTO layer = new LayerDTO(); Loading atlas-commands/src/test/java/es/redmic/test/atlascommands/integration/layer/LayerRestTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public class LayerRestTest extends DocumentationCommandBaseTest { this.mockMvc .perform(post(CATEGORY_PATH) .header("Authorization", "Bearer " + getTokenOAGUser()) .content(mapper.writeValueAsString(layerInfoDTO)) .content(LayerDataUtil.getLayerInfoToSave(layerInfoDTO)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) Loading Loading @@ -209,7 +209,7 @@ public class LayerRestTest extends DocumentationCommandBaseTest { this.mockMvc .perform(put(CATEGORY_PATH + "/" + id) .header("Authorization", "Bearer " + getTokenOAGUser()) .content(mapper.writeValueAsString(layerInfoDTO)) .content(LayerDataUtil.getLayerInfoToSave(layerInfoDTO)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) Loading Loading
atlas-commands/src/test/java/es/redmic/test/atlascommands/integration/layer/LayerDataUtil.java +18 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ import org.joda.time.DateTime; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Polygon; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import es.redmic.atlaslib.dto.layer.ActivityDTO; import es.redmic.atlaslib.dto.layer.AttributionDTO; import es.redmic.atlaslib.dto.layer.ContactDTO; Loading Loading @@ -286,6 +289,21 @@ public abstract class LayerDataUtil { return layerInfo; } public static String getLayerInfoToSave(LayerInfoDTO layerInfoDTO) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); String layerInfoString = mapper.writeValueAsString(layerInfoDTO); layerInfoString = layerInfoString.replace(mapper.writeValueAsString(ThemeInspireDataUtil.getThemeInspire("cc")), "\"" + ThemeInspireDataUtil.getThemeInspire("cc").getId() + "\""); layerInfoString = layerInfoString.replace(mapper.writeValueAsString(CategoryDataUtil.getCategory("3442")), "\"" + CategoryDataUtil.getCategory("3442").getId() + "\""); return layerInfoString; } public static LayerDTO getLayer(String code) { LayerDTO layer = new LayerDTO(); Loading
atlas-commands/src/test/java/es/redmic/test/atlascommands/integration/layer/LayerRestTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ public class LayerRestTest extends DocumentationCommandBaseTest { this.mockMvc .perform(post(CATEGORY_PATH) .header("Authorization", "Bearer " + getTokenOAGUser()) .content(mapper.writeValueAsString(layerInfoDTO)) .content(LayerDataUtil.getLayerInfoToSave(layerInfoDTO)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) Loading Loading @@ -209,7 +209,7 @@ public class LayerRestTest extends DocumentationCommandBaseTest { this.mockMvc .perform(put(CATEGORY_PATH + "/" + id) .header("Authorization", "Bearer " + getTokenOAGUser()) .content(mapper.writeValueAsString(layerInfoDTO)) .content(LayerDataUtil.getLayerInfoToSave(layerInfoDTO)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) Loading