Commit e09119e3 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!87
parents c05637f1 47ebcd8a
Pipeline #1093 failed
......@@ -3,7 +3,7 @@ stages:
- build
- deploy
- reset_data
- api_tests
- common_api_tests
variables:
BUILD_SERVICE_PROJECT_NAME: "common-api-gateway"
......@@ -13,15 +13,8 @@ variables:
USE_S3: "true"
USE_SSO: "true"
API_CONTEXT_PATH: "/api-common"
API_TEST_POSTMAN_COLLECTION: "api-gateway/src/integTest/resources/postman/common-api-gateway.postman_collection.json"
API_TEST_XROAD_POSTMAN_COLLECTION: "api-gateway/src/integTest/resources/postman/xroad-api-gateway.postman_collection.json"
API_TEST_PRIVILEGES_POSTMAN_COLLECTION: "api-gateway/src/integTest/resources/postman/common-api-gateway--PRIVILEGES.postman_collection.json"
RESET_TEST_DATA_POSTMAN_COLLECTION: "api-gateway/src/integTest/resources/postman/reset-test-data-api.postman_collection.json"
API_TEST_DEV_ENV: "api-gateway/src/integTest/resources/postman/teis-dev.postman_environment.json"
API_TEST_TEST_ENV: "api-gateway/src/integTest/resources/postman/teis-test.postman_environment.json"
API_TEST_XROAD: "true"
API_TEST_PRIVILEGES: "true"
RESET_TEST_DATA: "true"
API: "common"
API_TESTS_ROOT: "api-tests/"
include:
- project: "teis/dev-ops"
......@@ -32,5 +25,9 @@ include:
file: "/gitlab/java/microservice/.gitlab-ci-microservice-build.yml"
- project: "teis/dev-ops"
file: "/gitlab/java/microservice/.gitlab-ci-microservice-deploy.yml"
- project: "teis/dev-ops"
file: "/gitlab/api-tests/.gitlab-ci-postman-tests.yml"
- project: "teis/api-tests"
file: "/.gitlab-ci-variables.yml"
- project: "teis/api-tests"
file: "/.gitlab-ci-reset-data.yml"
- project: "teis/api-tests"
file: "/.gitlab-ci-common-api-postman-tests.yml"
[submodule "dev-ops"]
path = dev-ops
url = ../dev-ops.git
[submodule "api-tests"]
path = api-tests
url = ../api-tests.git
package ee.sm.ti.teis.commongateway.file.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import static org.springframework.util.StringUtils.isEmpty;
public class FilesMetadataTestRequest extends AbstractDTO<String, ErrorDTO> {
public static final String ROUTING_KEY = "api.FilesMetadataTestRequest";
private String objectType;
public FilesMetadataTestRequest() {
}
public FilesMetadataTestRequest(String objectType) {
this.objectType = objectType;
}
@Override
public String routingKey() {
if (isEmpty(objectType)) {
return ROUTING_KEY;
}
return ROUTING_KEY.concat(".").concat(objectType.toLowerCase());
}
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
}
package ee.sm.ti.teis.commongateway.file.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.file.FileReferenceDto;
import java.util.List;
public class FilesMetadataTestResponse extends AbstractDTO<List<FileReferenceDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.FilesMetadataTestResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
......@@ -4,6 +4,7 @@ import ee.sm.ti.teis.commongateway.file.FileReferenceDto;
import ee.sm.ti.teis.types.enums.AddresseeType;
import ee.sm.ti.teis.types.enums.MessageStatus;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import ee.sm.ti.teis.types.enums.SenderType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -32,6 +33,8 @@ public class MessageDto {
private MessageStatus status;
private LocalDateTime sentAt;
private String sentBy;
private SenderType senderType;
private UUID senderId;
private LocalDateTime editedAt;
private String editedBy;
private LocalDateTime emailSentAt;
......
......@@ -12,7 +12,6 @@ import java.util.UUID;
@Builder
@NoArgsConstructor
@AllArgsConstructor
// todo: replace class with ee.sm.ti.teis.commongateway.file.FileReferenceDto
public class MessageFileReferenceDto {
@NotNull
......
package ee.sm.ti.teis.commongateway.weblink;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
public class WebLinksTestRequest extends AbstractDTO<String, ErrorDTO> {
public static final String ROUTING_KEY = "api.WebLinksTestRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.weblink;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import java.util.List;
public class WebLinksTestResponse extends AbstractDTO<List<WebLinkDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.WebLinksTestResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
{
"info": {
"_postman_id": "a16c54af-e81b-41e4-a53d-fb45dade78b0",
"name": "reset-test-data-api",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Reset test data",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "*/*",
"type": "text"
}
],
"url": {
"raw": "{{url_admin}}/testdata/reset/{{test_data_reset_magic}}",
"host": [
"{{url_admin}}"
],
"path": [
"testdata",
"reset",
"{{test_data_reset_magic}}"
]
}
},
"response": []
}
],
"protocolProfileBehavior": {}
}
\ No newline at end of file
{
"id": "a3ac7055-e82d-4fe0-9b75-021b9aee0683",
"name": "DEV",
"values": [
{
"key": "url_office",
"value": "https://teis-ametnik.arendus.tehik.ee/api-office",
"enabled": true
},
{
"key": "url",
"value": "https://teis.arendus.tehik.ee/api-common",
"enabled": true
},
{
"key": "url_admin",
"value": "https://teis.arendus.tehik.ee/api-admin",
"enabled": true
},
{
"key": "url_mailserver",
"value": "https://teis-mail.arendus.tehik.ee/api",
"enabled": true
},
{
"key": "test_data_reset_magic",
"value": "mi6",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2019-06-21T06:55:04.409Z",
"_postman_exported_using": "Postman/7.2.0"
}
{
"id": "130adcb1-94b2-49df-a443-8d0cf77d1d6b",
"name": "TEST",
"values": [
{
"key": "url_office",
"value": "https://teis-ametnik-koormustest.test.tehik.ee/api-office",
"enabled": true
},
{
"key": "url",
"value": "https://teis-koormustest.test.tehik.ee/api-common",
"enabled": true
},
{
"key": "url_admin",
"value": "https://teis-ametnik-koormustest.test.tehik.ee/api-admin",
"enabled": true
},
{
"key": "test_data_reset_magic",
"value": "fsb",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2019-07-16T08:51:40.974Z",
"_postman_exported_using": "Postman/7.3.3"
}
{
"id": "130adcb1-94b2-49df-a443-8d0cf77d1d6b",
"name": "TEST",
"values": [
{
"key": "url_office",
"value": "https://teis-ametnik.test.tehik.ee/api-office",
"enabled": true
},
{
"key": "url",
"value": "https://teis.test.tehik.ee/api-common",
"enabled": true
},
{
"key": "url_admin",
"value": "https://teis-ametnik.test.tehik.ee/api-admin",
"enabled": true
},
{
"key": "url_mailserver",
"value": "https://teis-mail.test.tehik.ee/api",
"enabled": true
},
{
"key": "test_data_reset_magic",
"value": "cia",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2019-07-16T08:51:40.974Z",
"_postman_exported_using": "Postman/7.3.3"
}
package ee.sm.ti.teis.commongateway.file;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.commongateway.file.request.CreateFileReferenceRequest;
import ee.sm.ti.teis.commongateway.file.request.DeleteFileRequest;
import ee.sm.ti.teis.commongateway.file.request.FileRequest;
import ee.sm.ti.teis.commongateway.file.request.FilesMetadataRequest;
import ee.sm.ti.teis.commongateway.file.response.CreateFileReferenceResponse;
import ee.sm.ti.teis.commongateway.file.response.DeleteFileResponse;
import ee.sm.ti.teis.commongateway.file.response.FileResponse;
import ee.sm.ti.teis.commongateway.file.response.FilesMetadataResponse;
import ee.sm.ti.teis.commongateway.file.request.*;
import ee.sm.ti.teis.commongateway.file.response.*;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
......@@ -62,6 +56,20 @@ public class FileProcessingService {
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
List<FileReferenceDto> getFilesTestMetadata(String id, String objectType, RequestMetaDTO requestMetaDTO) {
FilesMetadataTestRequest request = new FilesMetadataTestRequest(objectType);
request.setPayload(id, requestMetaDTO);
FilesMetadataTestResponse response =
(FilesMetadataTestResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
FileMetadataDto getFile(UUID objectId, UUID fileId, String objectType, RequestMetaDTO requestMetaDTO) {
FileRequest request = new FileRequest(objectType);
......
......@@ -4,12 +4,11 @@ import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
@Profile({"dev", "test", "local", "integtest"})
@RestController
@RequestMapping("{fileReferencePath}/{id}/files")
......@@ -26,4 +25,11 @@ public class FileTestController extends TeisBaseController {
@PathVariable String fileId, @PathVariable("hard") boolean hard, @ApiIgnore RequestMetaDTO requestMetaDTO) {
fileProcessingService.delete(id, fileId, hard, fileReferencePath.name(), requestMetaDTO);
}
@ApiOperation(value = "${teis.api.messages.proceeding.get-files-metadata}")
@GetMapping(value = "test")
public List<FileReferenceDto> getFilesMetadata(@PathVariable("fileReferencePath") FileObjectType objectType,
@PathVariable String id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
return fileProcessingService.getFilesTestMetadata(id, objectType.name(), requestMetaDTO);
}
}
......@@ -5,11 +5,7 @@ import ee.sm.ti.teis.commongateway.proceedings.proceeding.CreateProceedingsInspe
import ee.sm.ti.teis.commongateway.proceedings.proceeding.ProceedingInspectionDocumentsPublicRequest;
import ee.sm.ti.teis.commongateway.proceedings.proceeding.ProceedingsInspectionDocumentsPublicResponse;
import ee.sm.ti.teis.commongateway.proceedings.proceeding.dto.ProceedingInspectionDocumentPublicDto;
import ee.sm.ti.teis.commongateway.weblink.CreateWebLinkRequest;
import ee.sm.ti.teis.commongateway.weblink.CreateWebLinkResponse;
import ee.sm.ti.teis.commongateway.weblink.DeleteWebLinkRequest;
import ee.sm.ti.teis.commongateway.weblink.DeleteWebLinkResponse;
import ee.sm.ti.teis.commongateway.weblink.WebLinkDto;
import ee.sm.ti.teis.commongateway.weblink.*;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
......@@ -37,7 +33,8 @@ public class ProceedingInspectionDocumentProcessingService {
}
public List<WebLinkDto> createWebLink(CreateWebLinkRequest requestDTO) {
CreateWebLinkResponse response = (CreateWebLinkResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
CreateWebLinkResponse response =
(CreateWebLinkResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
......@@ -46,7 +43,8 @@ public class ProceedingInspectionDocumentProcessingService {
public ProceedingInspectionDocumentPublicDto createDocument(CreateProceedingInspectionDocumentPublicRequest requestDTO) {
CreateProceedingsInspectionDocumentPublicResponse response =
(CreateProceedingsInspectionDocumentPublicResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
(CreateProceedingsInspectionDocumentPublicResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(),
requestDTO);
if (response != null) {
return response.processResponse();
}
......@@ -54,7 +52,17 @@ public class ProceedingInspectionDocumentProcessingService {
}
public WebLinkDto deleteWebLink(DeleteWebLinkRequest requestDTO) {
DeleteWebLinkResponse response = (DeleteWebLinkResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
DeleteWebLinkResponse response = (DeleteWebLinkResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(),
requestDTO);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId());
}
public List<WebLinkDto> getWebLinks(WebLinksTestRequest requestDTO) {
WebLinksTestResponse response =
(WebLinksTestResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (response != null) {
return response.processResponse();
}
......
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