Commit 705744ec 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!195
parents d025e4ad 7d90e881
...@@ -3,6 +3,7 @@ stages: ...@@ -3,6 +3,7 @@ stages:
- build - build
- deploy - deploy
- reset_data - reset_data
- create_FE_test_data
- common_api_tests - common_api_tests
variables: variables:
...@@ -29,5 +30,7 @@ include: ...@@ -29,5 +30,7 @@ include:
file: "/.gitlab-ci-variables.yml" file: "/.gitlab-ci-variables.yml"
- project: "teis/api-tests" - project: "teis/api-tests"
file: "/.gitlab-ci-reset-data.yml" file: "/.gitlab-ci-reset-data.yml"
- project: "teis/api-tests"
file: ".gitlab-ci-FE-test-data-postman.yml"
- project: "teis/api-tests" - project: "teis/api-tests"
file: "/.gitlab-ci-common-api-postman-tests.yml" file: "/.gitlab-ci-common-api-postman-tests.yml"
# Changelog # Changelog
## [1.21.0] - 2021-03-08
* TEIS-1961: new endpoint for getting authority permissions by grantor.
* TEIS-1959: new endpoint for validating authority's licences.
* Updated Minio client dependency to latest version; Code refactor due to MinioClient SDK breaking changes
* TEIS-2037: added Prometheus for common-api-gateway to enable hardware monitoring
* NB: replaced Gradle compile with implementation which doesn't expose service libraries to depending services. Services
which depend on latest versions of common-api-gateway-lib may require to add dependencies for Gradle task
integTestImplementation in service Gradle configuration
## [1.20.0] - 2021-02-22 ## [1.20.0] - 2021-02-22
* functionality to check if employer has risk assessments * functionality to check if employer has risk assessments
......
...@@ -4,13 +4,15 @@ functionalities{ ...@@ -4,13 +4,15 @@ functionalities{
description = """common-api-gateway-lib""" description = """common-api-gateway-lib"""
dependencies { dependencies {
implementation "ee.sm.ti.teis:service-request-lib:${commonsVersion}"
// This dependency is exported to consumers, that is to say found on their compile classpath. // This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1' implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.springframework.security:spring-security-core:5.1.5.RELEASE' implementation 'org.springframework.security:spring-security-core:5.1.5.RELEASE'
// This dependency is used for validation annotations // This dependency is used for validation annotations
compile 'javax.validation:validation-api:2.0.1.Final' implementation 'javax.validation:validation-api:2.0.1.Final'
compile 'io.swagger:swagger-annotations:1.5.20' implementation 'io.swagger:swagger-annotations:1.5.20'
} }
apply from: this.getClass().getClassLoader().getResource('teis.publishLib.gradle') apply from: this.getClass().getClassLoader().getResource('teis.publishLib.gradle')
package ee.sm.ti.teis.commongateway.authorities.authoritylicence.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ValidatedAuthorityLicenceDto {
@NotNull
private boolean licenceExists;
}
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;
public class LicencedAuthoritiesRequest extends AbstractDTO<AuthorityLicenceType, ErrorDTO> {
public static final String ROUTING_KEY = "api.LicencedAuthoritiesRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
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 ValidateAuthorityLicenceRequest extends AbstractDTO<ValidateAuthorityLicenceRequest.Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.ValidateAuthorityLicenceRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
@NotNull
private UUID authorityId;
@NotNull
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.person.PersonDto;
import java.util.List;
public class LicencedAuthoritiesResponse extends AbstractDTO<List<PersonDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.LicencedAuthoritiesResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
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.ValidatedAuthorityLicenceDto;
public class ValidateAuthorityLicenceResponse extends AbstractDTO<ValidatedAuthorityLicenceDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.ValidateAuthorityLicenceResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.authorities.authoritypermission.dto;
import ee.sm.ti.teis.commongateway.person.PersonDto;
import ee.sm.ti.teis.types.enums.AuthorityPermissionType;
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 GrantorsAuthorityPermissionDto {
private UUID id;
private UUID grantorId;
private PersonDto authority;
private AuthorityPermissionType permissionType;
private LocalDateTime grantedAt;
private LocalDate validUntil;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.commongateway.authorities.authoritypermission.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.types.enums.AuthorityPermissionType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.UUID;
public class GrantorsAuthorityPermissionsRequest extends AbstractDTO<GrantorsAuthorityPermissionsRequest.Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.GrantorsAuthorityPermissionsRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
@NotNull
private UUID grantorId;
private AuthorityPermissionType permissionType;
private Boolean includeAll;
}
}
package ee.sm.ti.teis.commongateway.authorities.authoritypermission.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.authorities.authoritypermission.dto.GrantorsAuthorityPermissionDto;
import java.util.List;
public class GrantorsAuthorityPermissionsResponse extends AbstractDTO<List<GrantorsAuthorityPermissionDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.GrantorsAuthorityPermissionsResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
...@@ -2,11 +2,10 @@ package ee.sm.ti.teis.commongateway.proceduralact; ...@@ -2,11 +2,10 @@ package ee.sm.ti.teis.commongateway.proceduralact;
import ee.sm.ti.teis.AbstractDTO; import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO; import ee.sm.ti.teis.ErrorDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
public class ProceduralActPublicRequest extends AbstractDTO<ProceduralActPublicRequest.Parameters, ErrorDTO> { import java.util.UUID;
public class ProceduralActPublicRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.ProceduralActPublicRequest"; public static final String ROUTING_KEY = "api.ProceduralActPublicRequest";
...@@ -15,11 +14,4 @@ public class ProceduralActPublicRequest extends AbstractDTO<ProceduralActPublicR ...@@ -15,11 +14,4 @@ public class ProceduralActPublicRequest extends AbstractDTO<ProceduralActPublicR
return ROUTING_KEY; return ROUTING_KEY;
} }
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
private String id;
}
} }
...@@ -2,11 +2,10 @@ package ee.sm.ti.teis.commongateway.proceduralact; ...@@ -2,11 +2,10 @@ package ee.sm.ti.teis.commongateway.proceduralact;
import ee.sm.ti.teis.AbstractDTO; import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO; import ee.sm.ti.teis.ErrorDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
public class ProceduralActsPublicRequest extends AbstractDTO<ProceduralActsPublicRequest.Parameters, ErrorDTO> { import java.util.UUID;
public class ProceduralActsPublicRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.ProceduralActsPublicRequest"; public static final String ROUTING_KEY = "api.ProceduralActsPublicRequest";
...@@ -15,11 +14,4 @@ public class ProceduralActsPublicRequest extends AbstractDTO<ProceduralActsPubli ...@@ -15,11 +14,4 @@ public class ProceduralActsPublicRequest extends AbstractDTO<ProceduralActsPubli
return ROUTING_KEY; return ROUTING_KEY;
} }
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
private String id;
}
} }
...@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor; ...@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.UUID; import java.util.UUID;
@Deprecated(since = "1.21.0", forRemoval = true)
public class AuthorityPermissionsGrantorRequest extends AbstractDTO<AuthorityPermissionsGrantorRequest.Parameters, ErrorDTO> { public class AuthorityPermissionsGrantorRequest extends AbstractDTO<AuthorityPermissionsGrantorRequest.Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.AuthorityPermissionsGrantorRequest"; public static final String ROUTING_KEY = "api.AuthorityPermissionsGrantorRequest";
......
...@@ -6,6 +6,7 @@ import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.Author ...@@ -6,6 +6,7 @@ import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.Author
import java.util.List; import java.util.List;
@Deprecated(since = "1.21.0", forRemoval = true)
public class AuthorityPermissionGrantorResponse extends AbstractDTO<List<AuthorityPermissionDto>, ErrorDTO> { public class AuthorityPermissionGrantorResponse extends AbstractDTO<List<AuthorityPermissionDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.AuthorityPermissionGrantorResponse"; public static final String ROUTING_KEY = "api.AuthorityPermissionGrantorResponse";
......
...@@ -2,10 +2,9 @@ package ee.sm.ti.teis.commongateway.signing.request; ...@@ -2,10 +2,9 @@ package ee.sm.ti.teis.commongateway.signing.request;
import ee.sm.ti.teis.AbstractDTO; import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO; import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.signing.dto.SignFileDto;
import java.util.UUID; public class SignExistingFileRequest extends AbstractDTO<SignFileDto, ErrorDTO> {
public class SignExistingFileRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.SignExistingFileRequest"; public static final String ROUTING_KEY = "api.SignExistingFileRequest";
......
...@@ -21,7 +21,8 @@ public class TaskQueryDto { ...@@ -21,7 +21,8 @@ public class TaskQueryDto {
private UUID employerId; private UUID employerId;
private UUID officialUserId; private UUID officialUserId;
private AssigneeType assigneeType; private AssigneeType assigneeType;
private List<String> taskDefinitionCode; private List<String> taskDefinitionCodes;
private List<String> excludedTaskDefinitionCodes;
private LocalDateTime deadlineFrom; private LocalDateTime deadlineFrom;
private LocalDateTime deadlineUntil; private LocalDateTime deadlineUntil;
private Boolean includeDone; private Boolean includeDone;
......
...@@ -11,12 +11,13 @@ apply from: this.getClass().getClassLoader().getResource('teis.microservice.grad ...@@ -11,12 +11,13 @@ apply from: this.getClass().getClassLoader().getResource('teis.microservice.grad
dependencies { dependencies {
implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'
compile "ee.sm.ti.teis:files-client-lib:${commonsVersion}"
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}"
implementation "io.micrometer:micrometer-registry-prometheus"
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
......
...@@ -4,6 +4,7 @@ import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase; ...@@ -4,6 +4,7 @@ import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.authorities.authoritylicence.AuthorityLicenceController; import ee.sm.ti.teis.commongateway.authorities.authoritylicence.AuthorityLicenceController;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException; import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO; import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import ee.sm.ti.teis.types.enums.AuthorityLicenceType;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -16,9 +17,20 @@ class AuthorityLicenceControllerTest extends CommonApiGatewayTestBase { ...@@ -16,9 +17,20 @@ class AuthorityLicenceControllerTest extends CommonApiGatewayTestBase {
AuthorityLicenceController controller; AuthorityLicenceController controller;
@Test @Test
void getgetAuthorityLicenses_badRequest() { void getAuthorityLicences_badRequest() {
assertThrows(NoResponseFromRabbitException.class, assertThrows(NoResponseFromRabbitException.class,
() -> controller.getAuthorityLicenses(randomUUID(), null, null, new RequestMetaDTO())); () -> controller.getAuthorityLicences(randomUUID(), null, null, new RequestMetaDTO()));
} }
@Test
void getLicencedAuthorities_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.getLicencedAuthorities(AuthorityLicenceType.OH, new RequestMetaDTO()));
}
@Test
void validate_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.validateAuthorityLicence(randomUUID(), AuthorityLicenceType.OH, null, new RequestMetaDTO()));
}
} }
package ee.sm.ti.teis.commongateway.authorities.authoritypermissions;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.authorities.authoritypermission.AuthorityPermissionsController;
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 AuthorityPermissionsControllerTest extends CommonApiGatewayTestBase {
@Autowired
AuthorityPermissionsController controller;
@Test
void getGrantorsAuthorityLicences_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.getGrantorsAuthorityPermissions(randomUUID(), null, null, new RequestMetaDTO()));
}
}
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