Commit 32d97980 authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Enriko Käsper

See merge request teis/common-api-gateway!138
parents 6952c66f c5758301
......@@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AuthorityPermissionExistsDto {
public class ValidatedAuthorityDto {
@NotNull
private boolean permissionExists;
private boolean hasPermission;
}
......@@ -2,9 +2,9 @@ package ee.sm.ti.teis.commongateway.representative.authoritypermission.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.AuthorityPermissionExistsDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.ValidatedAuthorityDto;
public class ValidateAuthorityPermissionResponse extends AbstractDTO<AuthorityPermissionExistsDto, ErrorDTO> {
public class ValidateAuthorityPermissionResponse extends AbstractDTO<ValidatedAuthorityDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.ValidateAuthorityPermissionResponse";
......
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto;
import ee.sm.ti.teis.commongateway.riskassessments.businesstype.dto.AssessedBusinessTypePublicDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -13,7 +14,7 @@ import java.util.List;
@AllArgsConstructor
public class RiskAssessmentConclusionDto {
private List<String> businessTypeNames;
private List<AssessedBusinessTypePublicDto> assessedBusinessTypes;
private long riskFactorNotAssessedCount;
private long riskStatementNotAssessedCount;
private long riskExistsCount;
......
package ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AssessRiskFactorDetailAssessmentPublicDto {
@NotNull
private UUID id;
@NotNull
private Boolean assessment;
}
package ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.dto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.dto.RiskFactorAssessmentPublicDto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AssessedRiskFactorDetailsAssessmentPublicDto {
private UUID id;
private UUID riskFactorAssessmentId;
private UUID riskFactorDetailsId;
private Boolean assessment;
private RiskFactorAssessmentPublicDto riskFactorAssessment;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.dto.AssessRiskFactorDetailAssessmentPublicDto;
public class AssessRiskFactorDetailAssessmentPublicRequest extends AbstractDTO<AssessRiskFactorDetailAssessmentPublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.AssessRiskFactorDetailAssessmentPublicRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.dto.AssessedRiskFactorDetailsAssessmentPublicDto;
public class AssessRiskFactorDetailAssessmentPublicResponse extends AbstractDTO<AssessedRiskFactorDetailsAssessmentPublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.AssessRiskFactorDetailAssessmentPublicResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicator.dto;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RiskIndicatorLightDto {
private UUID id;
private UUID riskStatementId;
private String name;
private String unit;
private String measuringInstruction;
private BigDecimal lowerLimit;
private BigDecimal upperLimit;
private String recommendation;
private ClassifierItemLightDto status;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RiskIndicatorValuePublicDto {
private UUID id;
@NotNull
private UUID riskStatementAssessmentId;
@NotNull
private UUID riskIndicatorId;
@NotNull
private BigDecimal value;
private String comment;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto.RiskIndicatorValuePublicDto;
public class CreateRiskIndicatorValuePublicRequest extends AbstractDTO<RiskIndicatorValuePublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CreateRiskIndicatorValuePublicRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import java.util.UUID;
public class DeleteRiskIndicatorValuePublicRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.DeleteRiskIndicatorValuePublicRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto.RiskIndicatorValuePublicDto;
public class UpdateRiskIndicatorValuePublicRequest extends AbstractDTO<RiskIndicatorValuePublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.UpdateRiskIndicatorValuePublicRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto.RiskIndicatorValuePublicDto;
public class CreateRiskIndicatorValuePublicResponse extends AbstractDTO<RiskIndicatorValuePublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CreateRiskIndicatorValuePublicResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
public class DeleteRiskIndicatorValuePublicResponse extends AbstractDTO<Void, ErrorDTO> {
public static final String ROUTING_KEY = "api.DeleteRiskIndicatorValuePublicResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto.RiskIndicatorValuePublicDto;
public class UpdateRiskIndicatorValuePublicResponse extends AbstractDTO<RiskIndicatorValuePublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.UpdateRiskIndicatorValuePublicResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
......@@ -5,8 +5,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.UUID;
@Data
......@@ -17,7 +17,8 @@ public class CreateRiskStatementAssessmentPublicDto {
@NotNull
private UUID riskFactorAssessmentId;
@NotNull
@Size(min = 3)
@NotBlank
private String description;
@NotNull
private Boolean assessment;
}
package ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto;
import ee.sm.ti.teis.commongateway.file.FileReferenceDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicator.dto.RiskIndicatorLightDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto.RiskIndicatorValuePublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatement.RiskStatementPublicDto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
......@@ -20,6 +22,8 @@ public class RiskStatementAssessmentPublicDto {
private UUID id;
private UUID riskFactorAssessmentId;
private RiskStatementPublicDto riskStatement;
private List<RiskIndicatorValuePublicDto> riskIndicatorValues;
private List<RiskIndicatorLightDto> riskIndicators;
private String description;
private Boolean assessment;
private Boolean action;
......
package ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.dto.AssessRiskFactorDetailAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetailsassessment.RiskFactorDetailsAssessmentController;
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 RiskFactorDetailsAssessmentControllerTest extends CommonApiGatewayTestBase {
@Autowired
RiskFactorDetailsAssessmentController controller;
@Test
void assess_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.assess(randomUUID(), new AssessRiskFactorDetailAssessmentPublicDto(), new RequestMetaDTO()));
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto.RiskIndicatorValuePublicDto;
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 RiskIndicatorValueControllerTest extends CommonApiGatewayTestBase {
@Autowired
RiskIndicatorValueController controller;
@Test
void create_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.create(new RiskIndicatorValuePublicDto(), new RequestMetaDTO()));
}
@Test
void update_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.update(randomUUID(), new RiskIndicatorValuePublicDto(), new RequestMetaDTO()));
}
@Test
void delete_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.delete(randomUUID(), new RequestMetaDTO()));
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.CreateRiskStatementAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.PatchRiskStatementAssessmentDescriptionPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.RiskStatementAssessmentPublicDto;
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 RiskStatementAssessmentControllerTest extends CommonApiGatewayTestBase {
@Autowired
RiskStatementAssessmentController controller;
@Test
void create_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.create(new CreateRiskStatementAssessmentPublicDto(), new RequestMetaDTO()));
}
@Test
void update_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.update(randomUUID(), new RiskStatementAssessmentPublicDto(), new RequestMetaDTO()));
}
@Test
void updateDescription_badRequest() {
assertThrows(NoResponseFromRabbitException.class,
() -> controller.updateDescription(randomUUID(), new PatchRiskStatementAssessmentDescriptionPublicDto(),
new RequestMetaDTO()));
}
@Test
void delete_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.delete(randomUUID(), 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