Commit e72796c5 authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge branch 'hotfix/TEIS-2399' into 'master'

Resolve TEIS-2399 "Hotfix/"

See merge request teis/common-api-gateway!236
parents 1a303ae6 eb5cc3f9
# Changelog
## [1.26.1] - 2021-08-18
* TEIS-2399: add new endpoint GET /public/parameters
## [1.26.0] - 2021-06-14
* TEIS-2109: improved integration tests. removed unnecessary isSingle from PatchTaskDto. refactored PersonProcessingService.
......
package ee.sm.ti.teis.commongateway.parameter;
import com.fasterxml.jackson.core.type.TypeReference;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import ee.sm.ti.teis.commongateway.parameter.dto.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.request.ParametersRequest;
import ee.sm.ti.teis.gatewaycommon.MockMvcUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.test.context.support.WithMockUser;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Set;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@WithMockUser
public class ParameterControllerTest extends CommonApiGatewayTestBase {
private static final String BASE_URL = "/parameters";
@MockBean
public ParameterProcessingService service;
@Autowired
ParameterController controller;
MockMvcUtil mockMvcUtil;
@Test
void getParameters() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getParameters(new RequestMetaDTO()));
when(service.getParameters(any(ParametersRequest.class)))
.thenReturn(Set.of(new ParameterDto()));
mockMvcUtil.testGet(BASE_URL, null, new TypeReference<Set<ParameterDto>>() {
});
verify(service).getParameters(any(ParametersRequest.class));
}
}
package ee.sm.ti.teis.commongateway.parameter;
import com.fasterxml.jackson.core.type.TypeReference;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.parameter.dto.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.request.ParametersRequest;
import ee.sm.ti.teis.gatewaycommon.MockMvcUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import java.util.Set;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class ParameterPublicControllerTest extends CommonApiGatewayTestBase {
private static final String BASE_URL = "/public/parameters";
@MockBean
public ParameterProcessingService service;
@Autowired
MockMvcUtil mockMvcUtil;
@Test
void getPublicParameters() {
when(service.getParameters(any(ParametersRequest.class)))
.thenReturn(Set.of(new ParameterDto()));
mockMvcUtil.testGet(BASE_URL, null, new TypeReference<Set<ParameterDto>>() {
});
verify(service).getParameters(any(ParametersRequest.class));
}
}
package ee.sm.ti.teis.commongateway.parameter;
import ee.sm.ti.teis.commongateway.parameter.dto.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.request.ParametersRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Set;
import static ee.sm.ti.teis.types.enums.ScopeType.PUBLIC;
@RestController
@RequestMapping("public/parameters")
@RequiredArgsConstructor
public class ParameterPublicController extends TeisBaseController {
private final ParameterProcessingService service;
@ApiOperation(value = "${teis.api.parameters.get-public}", response = ParameterDto.class)
@GetMapping
public Set<ParameterDto> getParameters( RequestMetaDTO requestMetaDTO) {
ParametersRequest request = new ParametersRequest();
request.setPayload(PUBLIC, requestMetaDTO);
return service.getParameters(request);
}
}
......@@ -120,6 +120,7 @@ teis.api.signings.sign-file-by-id: Teenus allkirjastab olemasoleva faili.
teis.api.signings.sign-file-stream: Teenus allkirjastab päringuga saadetud faili.
teis.api.parameters.get: Teenus, mis tagastab süsteemi erinevate parameetrite väärtused.
teis.api.parameters.get-public: Teenus, mis tagastab süsteemi erinevate parameetrite väärtused autentimata kasutajate jaoks.
teis.api.parameters.get-admin: Tegemist on API-ga, mis tagastab süsteemi parameetrid väärtuste haldamise kasutajaliidese jaoks.
teis.api.admin.reset-message-email: Admin teenus testimise jaoks. Tühjendab teate e-maili saatmise andmed (staatus tagasi DRAFT-i, e-mail saatmise kuupäev null-i).
......
theGroup=ee.sm.ti.teis
theVersion=1.26.0
theVersion=1.26.1
commonsVersion=1.26.0
pluginVersion=1.3.0
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