Commit 6b04da62 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!110
parents fb360875 45d4c4c3
......@@ -25,6 +25,6 @@ public class AuditLogItemDto {
private ActivityType activityType;
private String activityDescription;
private String dataObjectType;
private UUID parentDataObjectId;
private UUID dataObjectId;
private String parentDataObjectId;
private String dataObjectId;
}
package ee.sm.ti.teis.commongateway.classifier;
import lombok.Getter;
import lombok.Setter;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Getter
@Setter
import java.util.UUID;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ClassifierItemLinkDto {
ClassifierItemDto sourceClassifierItem;
ClassifierItemDto targetClassifierItem;
private UUID id;
private ClassifierItemDto sourceClassifierItem;
private ClassifierItemDto targetClassifierItem;
}
......@@ -3,9 +3,9 @@ package ee.sm.ti.teis.commongateway.classifier;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import java.util.ArrayList;
import java.util.List;
public class ClassifierItemsResponse extends AbstractDTO<ArrayList<ClassifierItemDto>, ErrorDTO> {
public class ClassifierItemsResponse extends AbstractDTO<List<ClassifierItemDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.ClassifierItemsResponse";
@Override
......
package ee.sm.ti.teis.commongateway.classifier.search;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ClassifierItemSearchFilterDto {
private String definitionId;
private String itemCode;
private String attributeCode;
private String attributeValue;
private Integer itemLevel;
private boolean includeDeleted;
private String upperClassifierItemId;
}
package ee.sm.ti.teis.commongateway.representative;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import java.util.UUID;
public class ExpireRepresentativesRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.ExpireRepresentativesRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.representative;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
public class ExpireRepresentativesResponse extends AbstractDTO<Void, ErrorDTO> {
public static final String ROUTING_KEY = "api.ExpireRepresentativesResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.role;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RoleDefinitionLightDto implements Serializable {
private UUID Id;
private UUID id;
private String name;
private String roleCode;
private Long seqNo;
......
......@@ -2,11 +2,10 @@ package ee.sm.ti.teis.commongateway.role;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
public class RoleDefinitionRequest extends AbstractDTO<RoleDefinitionRequest.Parameters, ErrorDTO> {
import java.util.UUID;
public class RoleDefinitionRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.RoleDefinitionRequest";
......@@ -14,11 +13,4 @@ public class RoleDefinitionRequest extends AbstractDTO<RoleDefinitionRequest.Par
public String routingKey() {
return ROUTING_KEY;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
private String id;
}
}
......@@ -2,13 +2,11 @@ package ee.sm.ti.teis.commongateway.role;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.UUID;
public class RolePrivilegesRequest extends AbstractDTO<RolePrivilegesRequest.Parameters, ErrorDTO> {
public class RolePrivilegesRequest extends AbstractDTO<List<UUID>, ErrorDTO> {
public static final String ROUTING_KEY = "api.RolePrivilegesRequest";
......@@ -17,11 +15,4 @@ public class RolePrivilegesRequest extends AbstractDTO<RolePrivilegesRequest.Par
return ROUTING_KEY;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
private List<String> roleIds;
}
}
......@@ -5,9 +5,9 @@ import ee.sm.ti.teis.ErrorDTO;
import java.util.HashSet;
public class RolePrivilegeResponse extends AbstractDTO<HashSet<String>, ErrorDTO> {
public class RolePrivilegesResponse extends AbstractDTO<HashSet<String>, ErrorDTO> {
public static final String ROUTING_KEY = "api.RolePrivilegeResponse";
public static final String ROUTING_KEY = "api.RolePrivilegesResponse";
@Override
public String routingKey() {
......
package ee.sm.ti.teis.commongateway.role.privilege.dto;
import ee.sm.ti.teis.commongateway.role.RoleDefinitionLightDto;
import ee.sm.ti.teis.types.enums.PrivilegeType;
import ee.sm.ti.teis.types.enums.RolePrivilegeCode;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PrivilegeDto {
private RolePrivilegeCode privilege;
private String name;
private PrivilegeType privilegeType;
private List<RelatedPrivilegeDto> relatedPrivileges;
private List<RoleDefinitionLightDto> roleDefinitions;
}
package ee.sm.ti.teis.commongateway.role.privilege.dto;
import ee.sm.ti.teis.types.enums.PrivilegeType;
import ee.sm.ti.teis.types.enums.RolePrivilegeCode;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PrivilegeLightDto {
private RolePrivilegeCode privilege;
private String name;
private PrivilegeType privilegeType;
}
package ee.sm.ti.teis.commongateway.role.privilege.dto;
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 RelatedPrivilegeDto {
private UUID id;
private PrivilegeLightDto parentPrivilege;
private PrivilegeLightDto childPrivilege;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.commongateway.role.privilege.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.types.enums.RolePrivilegeCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import static ee.sm.ti.teis.commongateway.role.privilege.request.PrivilegeRequest.Parameters;
public class PrivilegeRequest extends AbstractDTO<Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.PrivilegeRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
private RolePrivilegeCode privilege;
private boolean includeRelatedPrivileges;
private boolean includeRoles;
}
}
package ee.sm.ti.teis.commongateway.role.privilege.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
public class PrivilegesRequest extends AbstractDTO<Void, ErrorDTO> {
public static final String ROUTING_KEY = "api.PrivilegesRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.role.privilege.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.role.privilege.dto.PrivilegeDto;
public class PrivilegeResponse extends AbstractDTO<PrivilegeDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.PrivilegeResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.role.privilege.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.role.privilege.dto.PrivilegeLightDto;
import java.util.List;
public class PrivilegesResponse extends AbstractDTO<List<PrivilegeLightDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.PrivilegesResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.representative;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
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 RepresentativeTestControllerTest extends CommonApiGatewayTestBase {
@Autowired
RepresentativeTestController controller;
@Test
void checkRepresentative_test() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.expire(randomUUID(), new RequestMetaDTO()));
}
}
......@@ -7,25 +7,25 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.UUID;
import static java.util.UUID.randomUUID;
import static org.junit.jupiter.api.Assertions.assertThrows;
class RoleControllerTest extends CommonApiGatewayTestBase {
private static final RequestMetaDTO requestMetaDTO = RequestMetaDTO.builder().requestId(UUID.randomUUID().toString()).build();
private static final RequestMetaDTO requestMetaDTO = RequestMetaDTO.builder().requestId(randomUUID().toString()).build();
@Autowired
RoleController controller;
@Test
void getPrivileges_test() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getPrivileges(List.of("role"), requestMetaDTO));
assertThrows(NoResponseFromRabbitException.class, () -> controller.getPrivileges(List.of(randomUUID()), requestMetaDTO));
}
@Test
void getRole_test() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getRole("id", requestMetaDTO));
assertThrows(NoResponseFromRabbitException.class, () -> controller.getRole(randomUUID(), requestMetaDTO));
}
@Test
......
package ee.sm.ti.teis.commongateway.role.privilege;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
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 ee.sm.ti.teis.types.enums.RolePrivilegeCode.TI_MANAGE_ROLES_PRIVILEGES;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class PrivilegeControllerTest extends CommonApiGatewayTestBase {
@Autowired
PrivilegeController controller;
@Test
void getPrivileges_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getPrivileges(new RequestMetaDTO()));
}
@Test
void getPrivilege_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.getPrivilege(TI_MANAGE_ROLES_PRIVILEGES, false, false, 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