Loading atlas-commands/src/test/java/es/redmic/test/atlascommands/integration/layer/LayerDataUtil.java +2 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,8 @@ public abstract class LayerDataUtil { contact.setName("Pepe"); layer.setContact(contact); layer.setParent(CategoryDataUtil.getCategory("3442")); layer.setThemeInspire(ThemeInspireDataUtil.getThemeInspire("cc")); layer.setProtocols(getProtocols()); Loading atlas-commands/src/test/resources/data/schemas/layerschema.json +2 −2 Original line number Diff line number Diff line Loading @@ -47,11 +47,11 @@ "type": "string" }, "parent": { "type": ["integer", "null"], "type": "integer", "url": "/api/atlas/commands/category" } }, "required": ["name", "protocols", "atlas", "refresh", "urlSource"], "required": ["name", "protocols", "atlas", "refresh", "urlSource", "parent"], "definitions": { "LatLonBoundingBoxDTO": { "type": ["object", "null"], Loading atlas-lib/src/main/java/es/redmic/atlaslib/dto/layer/LayerDTO.java +2 −2 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ public class LayerDTO extends LayerInfoDTO { + "\"default\": null}," + "{\"name\":\"updated\",\"type\":[\"null\",{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}]," + "\"default\": null}," + "{\"name\":\"parent\",\"type\":[" + CategoryDTO.SCHEMA$ + ",\"null\"]}," + "{\"name\":\"parent\",\"type\":" + CategoryDTO.SCHEMA$ + "}," + "{\"name\":\"themeInspire\",\"type\":["+ ThemeInspireDTO.SCHEMA$ +", \"null\"]}," + "{\"name\":\"latLonBoundsImage\",\"type\":[" + LatLonBoundingBoxDTO.SCHEMA$ + ", \"null\"]}," + "{\"name\": \"protocols\",\"type\": [{\"type\": \"array\",\"items\":" + ProtocolDTO.SCHEMA$ + "},\"null\"]}," Loading Loading @@ -429,7 +429,7 @@ public class LayerDTO extends LayerInfoDTO { setUpdated(value != null ? new DateTime(value, DateTimeZone.UTC).toDateTime() : null); break; case 17: setParent(value != null ? (CategoryDTO) value : null); setParent((CategoryDTO) value); break; case 18: setThemeInspire(value != null ? (ThemeInspireDTO) value : null); Loading atlas-lib/src/main/java/es/redmic/atlaslib/dto/layerinfo/LayerInfoDTO.java +4 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ package es.redmic.atlaslib.dto.layerinfo; */ import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.apache.avro.Schema; Loading Loading @@ -49,7 +50,7 @@ public class LayerInfoDTO extends LayerCompactDTO { @JsonIgnore public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse( "{\"type\":\"record\",\"name\":\"LayerDTO\",\"namespace\":\"es.redmic.atlaslib.dto.layerinfo\",\"fields\":[" + "{\"name\":\"parent\",\"type\":[" + CategoryDTO.SCHEMA$ + ",\"null\"]}," + "{\"name\":\"parent\",\"type\":" + CategoryDTO.SCHEMA$ + "}," + "{\"name\":\"themeInspire\",\"type\":["+ ThemeInspireDTO.SCHEMA$ +", \"null\"]}," + "{\"name\":\"latLonBoundsImage\",\"type\":[" + LatLonBoundingBoxDTO.SCHEMA$ + ", \"null\"]}," + "{\"name\": \"protocols\",\"type\": [{\"type\": \"array\",\"items\":" + ProtocolDTO.SCHEMA$ + "},\"null\"]}," Loading @@ -66,6 +67,7 @@ public class LayerInfoDTO extends LayerCompactDTO { super(); } @NotNull @JsonDeserialize(using = CustomRelationDeserializer.class) @JsonSchemaUrl(value = "controller.mapping.CATEGORY") @Valid Loading Loading @@ -122,7 +124,7 @@ public class LayerInfoDTO extends LayerCompactDTO { public void put(int field, Object value) { switch (field) { case 0: setParent(value != null ? (CategoryDTO) value : null); setParent((CategoryDTO) value); break; case 1: setThemeInspire(value != null ? (ThemeInspireDTO) value : null); Loading atlas-lib/src/test/java/es/redmic/atlaslib/unit/dto/layerinfo/LayerInfoCheckDTOValidationTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -127,4 +127,12 @@ public class LayerInfoCheckDTOValidationTest extends DTOBaseTest<LayerInfoDTO> { checkDTOHasError(dto, NOT_NULL_MESSAGE_TEMPLATE); } @Test public void validationDTO_ReturnNotNullError_IfParentFieldIsNull() { dto.setParent(null); checkDTOHasError(dto, NOT_NULL_MESSAGE_TEMPLATE); } } Loading
atlas-commands/src/test/java/es/redmic/test/atlascommands/integration/layer/LayerDataUtil.java +2 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,8 @@ public abstract class LayerDataUtil { contact.setName("Pepe"); layer.setContact(contact); layer.setParent(CategoryDataUtil.getCategory("3442")); layer.setThemeInspire(ThemeInspireDataUtil.getThemeInspire("cc")); layer.setProtocols(getProtocols()); Loading
atlas-commands/src/test/resources/data/schemas/layerschema.json +2 −2 Original line number Diff line number Diff line Loading @@ -47,11 +47,11 @@ "type": "string" }, "parent": { "type": ["integer", "null"], "type": "integer", "url": "/api/atlas/commands/category" } }, "required": ["name", "protocols", "atlas", "refresh", "urlSource"], "required": ["name", "protocols", "atlas", "refresh", "urlSource", "parent"], "definitions": { "LatLonBoundingBoxDTO": { "type": ["object", "null"], Loading
atlas-lib/src/main/java/es/redmic/atlaslib/dto/layer/LayerDTO.java +2 −2 Original line number Diff line number Diff line Loading @@ -80,7 +80,7 @@ public class LayerDTO extends LayerInfoDTO { + "\"default\": null}," + "{\"name\":\"updated\",\"type\":[\"null\",{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}]," + "\"default\": null}," + "{\"name\":\"parent\",\"type\":[" + CategoryDTO.SCHEMA$ + ",\"null\"]}," + "{\"name\":\"parent\",\"type\":" + CategoryDTO.SCHEMA$ + "}," + "{\"name\":\"themeInspire\",\"type\":["+ ThemeInspireDTO.SCHEMA$ +", \"null\"]}," + "{\"name\":\"latLonBoundsImage\",\"type\":[" + LatLonBoundingBoxDTO.SCHEMA$ + ", \"null\"]}," + "{\"name\": \"protocols\",\"type\": [{\"type\": \"array\",\"items\":" + ProtocolDTO.SCHEMA$ + "},\"null\"]}," Loading Loading @@ -429,7 +429,7 @@ public class LayerDTO extends LayerInfoDTO { setUpdated(value != null ? new DateTime(value, DateTimeZone.UTC).toDateTime() : null); break; case 17: setParent(value != null ? (CategoryDTO) value : null); setParent((CategoryDTO) value); break; case 18: setThemeInspire(value != null ? (ThemeInspireDTO) value : null); Loading
atlas-lib/src/main/java/es/redmic/atlaslib/dto/layerinfo/LayerInfoDTO.java +4 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ package es.redmic.atlaslib.dto.layerinfo; */ import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.apache.avro.Schema; Loading Loading @@ -49,7 +50,7 @@ public class LayerInfoDTO extends LayerCompactDTO { @JsonIgnore public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse( "{\"type\":\"record\",\"name\":\"LayerDTO\",\"namespace\":\"es.redmic.atlaslib.dto.layerinfo\",\"fields\":[" + "{\"name\":\"parent\",\"type\":[" + CategoryDTO.SCHEMA$ + ",\"null\"]}," + "{\"name\":\"parent\",\"type\":" + CategoryDTO.SCHEMA$ + "}," + "{\"name\":\"themeInspire\",\"type\":["+ ThemeInspireDTO.SCHEMA$ +", \"null\"]}," + "{\"name\":\"latLonBoundsImage\",\"type\":[" + LatLonBoundingBoxDTO.SCHEMA$ + ", \"null\"]}," + "{\"name\": \"protocols\",\"type\": [{\"type\": \"array\",\"items\":" + ProtocolDTO.SCHEMA$ + "},\"null\"]}," Loading @@ -66,6 +67,7 @@ public class LayerInfoDTO extends LayerCompactDTO { super(); } @NotNull @JsonDeserialize(using = CustomRelationDeserializer.class) @JsonSchemaUrl(value = "controller.mapping.CATEGORY") @Valid Loading Loading @@ -122,7 +124,7 @@ public class LayerInfoDTO extends LayerCompactDTO { public void put(int field, Object value) { switch (field) { case 0: setParent(value != null ? (CategoryDTO) value : null); setParent((CategoryDTO) value); break; case 1: setThemeInspire(value != null ? (ThemeInspireDTO) value : null); Loading
atlas-lib/src/test/java/es/redmic/atlaslib/unit/dto/layerinfo/LayerInfoCheckDTOValidationTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -127,4 +127,12 @@ public class LayerInfoCheckDTOValidationTest extends DTOBaseTest<LayerInfoDTO> { checkDTOHasError(dto, NOT_NULL_MESSAGE_TEMPLATE); } @Test public void validationDTO_ReturnNotNullError_IfParentFieldIsNull() { dto.setParent(null); checkDTOHasError(dto, NOT_NULL_MESSAGE_TEMPLATE); } }