Commit 5a8f0e84 authored by Kristel Meikas's avatar Kristel Meikas
Browse files

TEIS-2186: refactoring to match spec updates

parent a6108068
......@@ -14,8 +14,6 @@ import java.util.UUID;
@AllArgsConstructor
public class CreateDriversInspectionDto {
@NotNull
private UUID proceedingId;
@NotNull
private UUID proceduralActId;
......
......@@ -2,11 +2,12 @@ package ee.sm.ti.teis.officegateway.proceedings.proceduralact.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.CreateDriversInspectionDto;
public class ConfirmProceedingAndProceduralActExistRequest extends AbstractDTO<CreateDriversInspectionDto, ErrorDTO> {
import java.util.UUID;
public static final String ROUTING_KEY = "api.ConfirmProceedingAndProceduralActExistRequest";
public class GetProceedingByProceduralActRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.GetProceedingByProceduralActRequest";
@Override
public String routingKey() {
......
......@@ -2,11 +2,12 @@ package ee.sm.ti.teis.officegateway.proceedings.proceduralact.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.dto.ProceedingAndProceduralActExistDto;
public class ConfirmProceedingAndProceduralActExistResponse extends AbstractDTO<ProceedingAndProceduralActExistDto, ErrorDTO> {
import java.util.UUID;
public static final String ROUTING_KEY = "api.ConfirmProceedingAndProceduralActExistResponse";
public class GetProceedingByProceduralActResponse extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.GetProceedingByProceduralActResponse";
@Override
public String routingKey() {
......
......@@ -3,12 +3,13 @@ package ee.sm.ti.teis.officegateway.proceedings.proceduralact;
import com.fasterxml.jackson.core.type.TypeReference;
import ee.sm.ti.teis.gatewaycommon.MockMvcUtil;
import ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.dto.ProceedingAndProceduralActExistDto;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.request.ConfirmProceedingAndProceduralActExistRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.request.GetProceedingByProceduralActRequest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.test.context.support.WithMockUser;
import java.util.UUID;
import static ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase.MOCK_ROLE;
import static java.util.UUID.randomUUID;
import static org.mockito.ArgumentMatchers.any;
......@@ -24,16 +25,15 @@ class ProceduralActTestControllerTest extends OfficeApiGatewayTestBase {
MockMvcUtil mockMvcUtil;
@Test
void confirmExist_success() {
when(requestProcessingService.sendAndReceive(any(ConfirmProceedingAndProceduralActExistRequest.class)))
.thenReturn(new ProceedingAndProceduralActExistDto());
void getProceedingId_success() {
when(requestProcessingService.sendAndReceive(any(GetProceedingByProceduralActRequest.class)))
.thenReturn(randomUUID());
parameters.add("proceedingId", randomUUID().toString());
parameters.add("proceduralActId", randomUUID().toString());
mockMvcUtil.testGet(BASE_URL + "exist", parameters, new TypeReference<ProceedingAndProceduralActExistDto>() {
mockMvcUtil.testGet(BASE_URL + "get-proceeding-id", parameters, new TypeReference<UUID>() {
});
verify(requestProcessingService).sendAndReceive(any(ConfirmProceedingAndProceduralActExistRequest.class));
verify(requestProcessingService).sendAndReceive(any(GetProceedingByProceduralActRequest.class));
}
}
......@@ -2,17 +2,18 @@ package ee.sm.ti.teis.officegateway.proceedings.proceduralact.controller;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.CreateDriversInspectionDto;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.dto.ProceedingAndProceduralActExistDto;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.request.ConfirmProceedingAndProceduralActExistRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.request.GetProceedingByProceduralActRequest;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
@RestController
@RequestMapping("procedural-acts/test")
@Profile({"dev", "test", "local", "integtest"})
......@@ -21,14 +22,13 @@ public class ProceduralActTestController extends TeisBaseController {
private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.proceeding.test.confirm-proceeding-and-procedural-act}", response = ProceedingAndProceduralActExistDto.class)
@GetMapping("exist")
public ProceedingAndProceduralActExistDto confirmExist(CreateDriversInspectionDto dto,
RequestMetaDTO requestMetaDTO) {
ConfirmProceedingAndProceduralActExistRequest request = new ConfirmProceedingAndProceduralActExistRequest();
request.setPayload(dto, requestMetaDTO);
@ApiOperation(value = "${teis.api.proceeding.test.get-proceeding-by-procedural-act}", response = UUID.class)
@GetMapping("get-proceeding-id")
public UUID getProceedingId(@RequestParam UUID proceduralActId, RequestMetaDTO requestMetaDTO) {
GetProceedingByProceduralActRequest request = new GetProceedingByProceduralActRequest();
request.setPayload(proceduralActId, requestMetaDTO);
return (ProceedingAndProceduralActExistDto) service.sendAndReceive(request);
return (UUID) service.sendAndReceive(request);
}
}
......@@ -59,7 +59,7 @@ teis.api.proceeding.patch-procedural-act: API-ga muudetakse kontrolli staatust.
teis.api.proceeding.delete-procedural-act: APIga on võimalik kustutada kontrolli objekti ja sellega seotud objektide andmeid. Mõeldud kontrolli kustutamiseks.
teis.api.proceeding.procedural-act-feedback: API väljastab csv faili, milles on sisendis esitatud perioodil lõppenud menetluste kontrollide tagasiside adresaatite nimi ja e-posti aadress ning kontrolli läbiviinud TI teenistujate nimed.
teis.api.proceeding.test.confirm-proceeding-and-procedural-act: Testteenus tagastab kehtivamenetluse ja kehtiva kontrolli eksisteerimise kinnituse.
teis.api.proceeding.test.get-proceeding-by-procedural-act: Testteenus tagastab kehtivamenetluse ja kehtiva kontrolli eksisteerimise kinnituse.
teis.api.proceeding.get-procedural-act-inspection-topics: API-ga on võimalik otsida kontrollile lisatud kontrolli teemasid.
teis.api.proceeding.put-procedural-act-inspection-topics: API-ga on võimalik muuta kontrollil kontrolliteemasid.
......
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