Commit c32df088 authored by Jyrgen Hannus's avatar Jyrgen Hannus
Browse files

Technical debt: cleaned up, refactored code and fixed todos

parent 59bd57d4
theGroup=ee.sm.ti.teis theGroup=ee.sm.ti.teis
theVersion=0.3.0 theVersion=0.4.0-SNAPSHOT
commonsVersion=1.0.0 commonsVersion=1.1.0-SNAPSHOT
officeApiGatewayVersion=0.10.0 officeApiGatewayVersion=0.11.0-SNAPSHOT
pluginVersion=1.0.0 pluginVersion=1.0.0
mapstructVersion=1.3.0.Final mapstructVersion=1.3.0.Final
querydslVersion=4.1.3 querydslVersion=4.1.3
...@@ -3,19 +3,8 @@ package ee.sm.ti.teis.officials.group.listener; ...@@ -3,19 +3,8 @@ package ee.sm.ti.teis.officials.group.listener;
import ee.sm.ti.teis.OfficialsAppTestBase; import ee.sm.ti.teis.OfficialsAppTestBase;
import ee.sm.ti.teis.officegateway.official.dto.OfficialUserDto; import ee.sm.ti.teis.officegateway.official.dto.OfficialUserDto;
import ee.sm.ti.teis.officegateway.official.dto.OfficialsGroupDto; import ee.sm.ti.teis.officegateway.official.dto.OfficialsGroupDto;
import ee.sm.ti.teis.officegateway.official.request.AddOfficialsGroupMembersRequest; import ee.sm.ti.teis.officegateway.official.request.*;
import ee.sm.ti.teis.officegateway.official.request.CreateOfficialsGroupRequest; import ee.sm.ti.teis.officegateway.official.response.*;
import ee.sm.ti.teis.officegateway.official.request.DeleteOfficialsGroupMemberRequest;
import ee.sm.ti.teis.officegateway.official.request.DeleteOfficialsGroupRequest;
import ee.sm.ti.teis.officegateway.official.request.OfficialsGroupRequest;
import ee.sm.ti.teis.officegateway.official.request.OfficialsGroupsRequest;
import ee.sm.ti.teis.officegateway.official.request.UpdateOfficialsGroupRequest;
import ee.sm.ti.teis.officegateway.official.response.AddOfficialsGroupMembersResponse;
import ee.sm.ti.teis.officegateway.official.response.CreateOfficialsGroupResponse;
import ee.sm.ti.teis.officegateway.official.response.DeleteOfficialsGroupMemberResponse;
import ee.sm.ti.teis.officegateway.official.response.OfficialsGroupResponse;
import ee.sm.ti.teis.officegateway.official.response.OfficialsGroupsResponse;
import ee.sm.ti.teis.officegateway.official.response.UpdateOfficialsGroupResponse;
import ee.sm.ti.teis.officials.group.OfficialsGroupRepository; import ee.sm.ti.teis.officials.group.OfficialsGroupRepository;
import ee.sm.ti.teis.officials.official.OfficialUserRepository; import ee.sm.ti.teis.officials.official.OfficialUserRepository;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO; import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
...@@ -39,7 +28,8 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -39,7 +28,8 @@ import static org.assertj.core.api.Assertions.assertThat;
@Transactional @Transactional
class OfficialsGroupGwListenerTest extends OfficialsAppTestBase { class OfficialsGroupGwListenerTest extends OfficialsAppTestBase {
private static final RequestMetaDTO REQUEST_META_DTO = RequestMetaDTO.builder().userId(UUID.randomUUID().toString()).privileges(of("TI_MANAGE_OFFICIALS_GROUPS")).userType(UserType.OFFICIAL_USER).requestId(UUID.randomUUID().toString()).build(); private static final RequestMetaDTO REQUEST_META_DTO = RequestMetaDTO.builder().userId(UUID.randomUUID().toString())
.privileges(of("TI_MANAGE_OFFICIALS_GROUPS")).userType(UserType.OFFICIAL_USER).requestId(UUID.randomUUID().toString()).build();
private static final UUID ADMIN_GROUP_ID = UUID.fromString("68b5b265-9427-457f-8f16-0bd5cf608714"); private static final UUID ADMIN_GROUP_ID = UUID.fromString("68b5b265-9427-457f-8f16-0bd5cf608714");
private static final UUID DELETED_GROUP_ID = UUID.fromString("c6bbd0d0-a614-408e-b22b-c60eed1a0dc9"); private static final UUID DELETED_GROUP_ID = UUID.fromString("c6bbd0d0-a614-408e-b22b-c60eed1a0dc9");
private static final UUID ADMIN_USER_ID = UUID.fromString("b5d59f3b-57af-4971-8110-51019e5e827d"); private static final UUID ADMIN_USER_ID = UUID.fromString("b5d59f3b-57af-4971-8110-51019e5e827d");
...@@ -112,13 +102,13 @@ class OfficialsGroupGwListenerTest extends OfficialsAppTestBase { ...@@ -112,13 +102,13 @@ class OfficialsGroupGwListenerTest extends OfficialsAppTestBase {
void findOfficialGroup_statusDeleted_success() { void findOfficialGroup_statusDeleted_success() {
OfficialsGroupRequest request = new OfficialsGroupRequest(); OfficialsGroupRequest request = new OfficialsGroupRequest();
OfficialsGroupRequest.Parameters payload = new OfficialsGroupRequest.Parameters(); OfficialsGroupRequest.Parameters payload = new OfficialsGroupRequest.Parameters();
payload.setId("c6bbd0d0-a614-408e-b22b-c60eed1a0dc9"); payload.setId(DELETED_GROUP_ID.toString());
request.setPayload(payload, REQUEST_META_DTO); request.setPayload(payload, REQUEST_META_DTO);
OfficialsGroupResponse response = groupListener.findOfficialsGroup(request); OfficialsGroupResponse response = groupListener.findOfficialsGroup(request);
OfficialsGroupDto responseDto = response.getPayload(); OfficialsGroupDto responseDto = response.getPayload();
assertThat(responseDto.getId()).isEqualTo(UUID.fromString("c6bbd0d0-a614-408e-b22b-c60eed1a0dc9")); assertThat(responseDto.getId()).isEqualTo(DELETED_GROUP_ID);
assertThat(responseDto.getName()).isEqualTo("Admin kasutajad (removed)"); assertThat(responseDto.getName()).isEqualTo("Admin kasutajad (removed)");
assertThat(responseDto.getObjectStatus()).isEqualTo(DELETED); assertThat(responseDto.getObjectStatus()).isEqualTo(DELETED);
} }
......
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