Commit 0cdf29db authored by Jyrgen Hannus's avatar Jyrgen Hannus
Browse files

Removed verified deprecated *TestControllers and their corresponding Rabbit...

Removed verified deprecated *TestControllers and their corresponding Rabbit listeners with functionality
parent 271f7c9e
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import java.util.UUID;
public class ProceedingInspectionDocumentsTestRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.ProceedingInspectionDocumentsTestRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.dto.ProceedingInspectionDocumentDto;
import java.util.List;
public class ProceedingsInspectionDocumentsTestResponse extends AbstractDTO<List<ProceedingInspectionDocumentDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.ProceedingsInspectionDocumentsTestResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import java.util.UUID;
public class ProceedingTopicTestRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.ProceedingTopicTestRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
\ No newline at end of file
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.ProceedingTopicDto;
import java.util.List;
public class ProceedingTopicTestResponse extends AbstractDTO<List<ProceedingTopicDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.ProceedingTopicTestResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase;
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 ProceedingInspectionDocumentTestControllerTest extends OfficeApiGatewayTestBase {
@Autowired
ProceedingInspectionDocumentTestController controller;
@Test
void getDocuments() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getDocuments(randomUUID(), new RequestMetaDTO()));
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase;
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 ProceedingTopicTestControllerTest extends OfficeApiGatewayTestBase {
@Autowired
ProceedingTopicTestController controller;
@Test
void updateTopics() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getTopics(
randomUUID(), new RequestMetaDTO()));
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.dto.CommentDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.dto.ProceedingInspectionDocumentDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.CreateProceedingInspectionDocumentRequest;
......@@ -24,7 +25,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@RequiredArgsConstructor
public class ProceedingInspectionDocumentController extends TeisBaseController {
private final ProceedingInspectionDocumentProcessingService processingService;
private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.messages.proceeding.get-proceeding-inspection-documents}",
response = ProceedingInspectionDocumentDto.class)
......@@ -34,7 +35,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
ProceedingInspectionDocumentsRequest request = new ProceedingInspectionDocumentsRequest();
request.setPayload(id, requestMetaDTO);
return processingService.getProceedingDocuments(request);
return (List<ProceedingInspectionDocumentDto>) service.sendAndReceive(request);
}
@ApiOperation(value = "${teis.api.messages.proceeding.put-proceeding-inspection-documents}",
......@@ -47,7 +48,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
UpdateProceedingInspectionDocumentsRequest request = new UpdateProceedingInspectionDocumentsRequest();
request.setPayload(new UpdateProceedingInspectionDocumentsRequest.Parameters(id, inspectionDocumentCodes), requestMetaDTO);
return processingService.updateDocuments(request);
return (List<ProceedingInspectionDocumentDto>) service.sendAndReceive(request);
}
@ApiOperation(value = "${teis.api.messages.proceeding.create-proceeding-inspection-documents}",
......@@ -60,7 +61,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
payload.setProceedingId(id);
request.setPayload(payload, requestMetaDTO);
return processingService.createDocument(request);
return (ProceedingInspectionDocumentDto) service.sendAndReceive(request);
}
@ApiOperation(value = "${teis.api.messages.proceeding.get-proceeding.comment}",
......@@ -73,7 +74,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
comment.setId(documentId);
request.setPayload(comment, requestMetaDTO);
return processingService.patchDocumentComment(request);
return (ProceedingInspectionDocumentDto) service.sendAndReceive(request);
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.dto.ProceedingInspectionDocumentDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.*;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.response.*;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Deprecated(since = "1.19.0-SNAPSHOT", forRemoval = true)
@RequiredArgsConstructor
public class ProceedingInspectionDocumentProcessingService {
private final RabbitTemplate gwRabbitTemplate;
List<ProceedingInspectionDocumentDto> getProceedingDocuments(ProceedingInspectionDocumentsRequest request) {
ProceedingsInspectionDocumentsResponse response =
(ProceedingsInspectionDocumentsResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
List<ProceedingInspectionDocumentDto> updateDocuments(UpdateProceedingInspectionDocumentsRequest request) {
UpdateProceedingsInspectionDocumentsResponse response =
(UpdateProceedingsInspectionDocumentsResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
ProceedingInspectionDocumentDto patchDocumentComment(PatchProceedingInspectionDocumentCommentRequest request) {
PatchProceedingsInspectionDocumentCommentResponse response =
(PatchProceedingsInspectionDocumentCommentResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public ProceedingInspectionDocumentDto createDocument(CreateProceedingInspectionDocumentRequest requestDTO) {
CreateProceedingsInspectionDocumentResponse response =
(CreateProceedingsInspectionDocumentResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId());
}
public List<ProceedingInspectionDocumentDto> getTestProceedingDocuments(ProceedingInspectionDocumentsTestRequest request) {
ProceedingsInspectionDocumentsTestResponse response =
(ProceedingsInspectionDocumentsTestResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.dto.ProceedingInspectionDocumentDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.ProceedingInspectionDocumentsTestRequest;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.UUID;
@Profile({"dev", "test", "local", "integtest"})
@RestController
@RequestMapping("proceedings/{id}/inspection-documents/test")
@RequiredArgsConstructor
public class ProceedingInspectionDocumentTestController extends TeisBaseController {
private final ProceedingInspectionDocumentProcessingService processingService;
@ApiOperation(value = "${teis.api.messages.proceeding.get-proceeding-inspection-documents}",
response = ProceedingInspectionDocumentDto.class)
@GetMapping
public List<ProceedingInspectionDocumentDto> getDocuments(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
ProceedingInspectionDocumentsTestRequest request = new ProceedingInspectionDocumentsTestRequest();
request.setPayload(id, requestMetaDTO);
return processingService.getTestProceedingDocuments(request);
}
}
......@@ -2,6 +2,7 @@ package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.request.ProceedingTopicRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.request.UpdateProceedingTopicRequest;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
......@@ -19,7 +20,7 @@ import java.util.UUID;
@RequiredArgsConstructor
public class ProceedingTopicController extends TeisBaseController {
private final ProceedingTopicProcessingService service;
private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.messages.proceeding.put-proceeding-inspection-topics}",
response = ProceedingTopicDto.class)
......@@ -31,7 +32,7 @@ public class ProceedingTopicController extends TeisBaseController {
UpdateProceedingTopicRequest request = new UpdateProceedingTopicRequest();
request.setPayload(new UpdateProceedingTopicRequest.Parameters(id, inspectionTopicCodes), requestMetaDTO);
return service.updateTopics(request);
return (List<ProceedingTopicDto>) service.sendAndReceive(request);
}
@ApiOperation(value = "${teis.api.messages.proceeding.get-proceeding-inspection-topics}",
......@@ -42,7 +43,7 @@ public class ProceedingTopicController extends TeisBaseController {
ProceedingTopicRequest request = new ProceedingTopicRequest();
request.setPayload(id, requestMetaDTO);
return service.getTopics(request);
return (List<ProceedingTopicDto>) service.sendAndReceive(request);
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.request.ProceedingTopicRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.request.ProceedingTopicTestRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.request.UpdateProceedingTopicRequest;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.response.ProceedingTopicResponse;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.response.ProceedingTopicTestResponse;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.response.UpdateProceedingTopicResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Deprecated(since = "1.19.0-SNAPSHOT", forRemoval = true)
@RequiredArgsConstructor
public class ProceedingTopicProcessingService {
private final RabbitTemplate gwRabbitTemplate;
List<ProceedingTopicDto> updateTopics(UpdateProceedingTopicRequest request) {
UpdateProceedingTopicResponse response =
(UpdateProceedingTopicResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
List<ProceedingTopicDto> getTopics(ProceedingTopicRequest request) {
ProceedingTopicResponse response =
(ProceedingTopicResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public List<ProceedingTopicDto> getTestTopics(ProceedingTopicTestRequest request) {
ProceedingTopicTestResponse response =
(ProceedingTopicTestResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.topic.request.ProceedingTopicTestRequest;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.UUID;
@Profile({"dev", "test", "local", "integtest"})
@RestController
@RequestMapping("proceedings/{id}/inspection-topics/test")
@RequiredArgsConstructor
public class ProceedingTopicTestController extends TeisBaseController {
private final ProceedingTopicProcessingService service;
@ApiOperation(value = "${teis.api.messages.proceeding.get-proceeding-inspection-topics}",
response = ProceedingTopicDto.class)
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.proceeding.id}"))
@GetMapping
public List<ProceedingTopicDto> getTopics(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
ProceedingTopicTestRequest request = new ProceedingTopicTestRequest();
request.setPayload(id, requestMetaDTO);
return service.getTestTopics(request);
}
}
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