Commit 13c9d3f9 authored by Jürgen Hannus's avatar Jürgen Hannus
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Jürgen Hannus

See merge request teis/common-api-gateway!188
parents ef1261f5 d306ae3f
# Changelog # Changelog
## [1.20.0] - 2021-02-22
* functionality to check if employer has risk assessments
* updated feature flag name -> description in DTO
* replaced constant requestMetaDTO naming with CONSTANT_CASE
* functionality to map S3 Minio bucket dynamically (configuration provided by files service)
* new authorities/get authority-licences endpoint
* enabled ms_exchange for common API gateway to enable initialization of buckets configuration via files service micro
services exchange
## [1.19.0] - 2021-02-05 ## [1.19.0] - 2021-02-05
* added REST endpoint for task action plan references & responsible persons. * added REST endpoint for task action plan references & responsible persons.
* added PATCH risk-statement-assessments/{id}/task-status method. * added PATCH risk-statement-assessments/{id}/task-status method.
* updated GET parameters functionality. * updated GET parameters functionality.
* refactored Rabbit requests processing service layer classes. * refactored Rabbit requests processing service layer classes.
## [1.18.0] - 2021-01-22 ## [1.18.0] - 2021-01-22
......
...@@ -12,6 +12,6 @@ import lombok.NoArgsConstructor; ...@@ -12,6 +12,6 @@ import lombok.NoArgsConstructor;
public class FeatureFlagDto { public class FeatureFlagDto {
private String id; private String id;
private String name; private String description;
private boolean enabled; private boolean enabled;
} }
package ee.sm.ti.teis.commongateway.auditlog.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EmployerAuditLogItemDto {
private LocalDateTime activityTime;
private String activityDescription;
}
package ee.sm.ti.teis.commongateway.auditlog.dto;
import ee.sm.ti.teis.paging.AbstractPagingDto;
import lombok.*;
import java.time.LocalDateTime;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class EmployerAuditLogItemSearchDto extends AbstractPagingDto {
private LocalDateTime activityTimeFrom;
private LocalDateTime activityTimeUntil;
}
package ee.sm.ti.teis.commongateway.auditlog.dto;
import ee.sm.ti.teis.paging.AbstractPagedPayload;
public class EmployerAuditLogItemsDto extends AbstractPagedPayload<EmployerAuditLogItemDto> {
}
package ee.sm.ti.teis.commongateway.auditlog.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.auditlog.dto.EmployerAuditLogItemSearchDto;
public class EmployerAuditLogItemsRequest extends AbstractDTO<EmployerAuditLogItemSearchDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.EmployerAuditLogItemsRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.auditlog.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.auditlog.dto.EmployerAuditLogItemsDto;
public class EmployerAuditLogItemsResponse extends AbstractDTO<EmployerAuditLogItemsDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.EmployerAuditLogItemsResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.authorities.authoritylicence.dto;
import ee.sm.ti.teis.types.enums.AuthorityLicenceType;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AuthorityLicenceDto {
private UUID id;
private UUID authorityId;
private String licenceNumber;
private AuthorityLicenceType licenceType;
private LocalDate validFrom;
private LocalDate validUntil;
private LocalDateTime lastUpdate;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.commongateway.authorities.authoritylicence.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.types.enums.AuthorityLicenceType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.UUID;
public class AuthorityLicencesRequest extends AbstractDTO<AuthorityLicencesRequest.Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.AuthorityLicencesRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
@NotNull
private UUID authorityId;
private AuthorityLicenceType licenceType;
private Boolean includeAll;
}
}
package ee.sm.ti.teis.commongateway.authorities.authoritylicence.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.authorities.authoritylicence.dto.AuthorityLicenceDto;
import java.util.List;
public class AuthorityLicencesResponse extends AbstractDTO<List<AuthorityLicenceDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.AuthorityLicencesResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
...@@ -27,6 +27,8 @@ public class FileMetadataDto { ...@@ -27,6 +27,8 @@ public class FileMetadataDto {
private FileScanStatusType scanStatus; private FileScanStatusType scanStatus;
private Boolean signed; private Boolean signed;
private LocalDateTime signedAt; private LocalDateTime signedAt;
private ObjectStatus objectStatus; private String bucket;
private String thumbnailsBucket;
private Map<String, String> thumbnails; private Map<String, String> thumbnails;
private ObjectStatus objectStatus;
} }
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RiskAssessmentExistsDto {
private Boolean riskAssessmentExists;
}
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
public class RiskAssessmentExistsPublicRequest extends AbstractDTO<Void, ErrorDTO> {
public static final String ROUTING_KEY = "api.RiskAssessmentExistsPublicRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.RiskAssessmentExistsDto;
public class RiskAssessmentExistsPublicResponse extends AbstractDTO<RiskAssessmentExistsDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.RiskAssessmentExistsPublicResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.signing.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SignFileDto {
private UUID fileId;
private String bucket;
}
...@@ -14,6 +14,9 @@ dependencies { ...@@ -14,6 +14,9 @@ dependencies {
compile "ee.sm.ti.teis:service-common-lib:${commonsVersion}" compile "ee.sm.ti.teis:service-common-lib:${commonsVersion}"
compile "ee.sm.ti.teis:gateway-common-lib:${commonsVersion}" compile "ee.sm.ti.teis:gateway-common-lib:${commonsVersion}"
compile project(':common-api-gateway-lib') compile project(':common-api-gateway-lib')
compile ("ee.sm.ti.teis:files-client-lib:${filesVersion}") {
exclude group: "ee.sm.ti.teis", module: "domain-cache-lib" //by both name and group
}
} }
// Define the main class for the application // Define the main class for the application
......
package ee.sm.ti.teis.commongateway.auditlog;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.auditlog.dto.EmployerAuditLogItemSearchDto;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static org.junit.jupiter.api.Assertions.assertThrows;
class AuditLogControllerTest extends CommonApiGatewayTestBase {
@Autowired
AuditLogController controller;
@Test
void getAuditLogItemsForEmployer_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.getEmployerAuditLogItems(new EmployerAuditLogItemSearchDto(), new RequestMetaDTO()));
}
}
...@@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; ...@@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class AuditLogTestControllerTest extends CommonApiGatewayTestBase { class AuditLogTestControllerTest extends CommonApiGatewayTestBase {
private static final RequestMetaDTO requestMetaDTO = RequestMetaDTO.builder().requestId(randomUUID().toString()).build(); private static final RequestMetaDTO REQUEST_META_DTO = RequestMetaDTO.builder().requestId(randomUUID().toString()).build();
@Autowired @Autowired
AuditLogTestController controller; AuditLogTestController controller;
...@@ -23,19 +23,19 @@ class AuditLogTestControllerTest extends CommonApiGatewayTestBase { ...@@ -23,19 +23,19 @@ class AuditLogTestControllerTest extends CommonApiGatewayTestBase {
AuditLogItemDto logItemDto = AuditLogItemDto.builder().build(); AuditLogItemDto logItemDto = AuditLogItemDto.builder().build();
assertThrows(NoResponseFromRabbitException.class, () -> assertThrows(NoResponseFromRabbitException.class, () ->
controller.createAuditLogItem(logItemDto, requestMetaDTO)); controller.createAuditLogItem(logItemDto, REQUEST_META_DTO));
} }
@Test @Test
void getAuditLogItems_badRequest() { void getAuditLogItems_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () -> assertThrows(NoResponseFromRabbitException.class, () ->
controller.getAuditLogItems(null, null, requestMetaDTO)); controller.getAuditLogItems(null, null, REQUEST_META_DTO));
} }
@Test @Test
void auditLogItemExists_badRequest() { void auditLogItemExists_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () -> assertThrows(NoResponseFromRabbitException.class, () ->
controller.auditLogItemExists(new AuditLogItemExistsDto(), requestMetaDTO)); controller.auditLogItemExists(new AuditLogItemExistsDto(), REQUEST_META_DTO));
} }
} }
package ee.sm.ti.teis.commongateway.authorities.authoritylicences;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.authorities.authoritylicence.AuthorityLicenceController;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static java.util.UUID.randomUUID;
import static org.junit.jupiter.api.Assertions.assertThrows;
class AuthorityLicenceControllerTest extends CommonApiGatewayTestBase {
@Autowired
AuthorityLicenceController controller;
@Test
void getgetAuthorityLicenses_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.getAuthorityLicenses(randomUUID(), null, null, new RequestMetaDTO()));
}
}
...@@ -12,14 +12,14 @@ import static org.junit.jupiter.api.Assertions.assertThrows; ...@@ -12,14 +12,14 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class DUMonitorTestControllerTest extends CommonApiGatewayTestBase { class DUMonitorTestControllerTest extends CommonApiGatewayTestBase {
private static final RequestMetaDTO requestMetaDTO = RequestMetaDTO.builder().requestId(UUID.randomUUID().toString()).build(); private static final RequestMetaDTO REQUEST_META_DTO = RequestMetaDTO.builder().requestId(UUID.randomUUID().toString()).build();
@Autowired @Autowired
DUMonitorTestController controller; DUMonitorTestController controller;
@Test @Test
void send_test() { void send_test() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.send(new PersonalDataUsageDto(), requestMetaDTO)); assertThrows(NoResponseFromRabbitException.class, () -> controller.send(new PersonalDataUsageDto(), REQUEST_META_DTO));
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment