Commit 762dd09d authored by Siiri Tann's avatar Siiri Tann
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Siiri Tann

See merge request teis/xroad-gateway!113
parents 4fecaf66 13ea0c98
# Changelog
## [1.15.0] - 2022-04-08
* TEIS-2587: updated getting accident case certificates from KIRST
* TEIS-2907: moved torti ms request classes to service client
* TEIS-2910: added methods to get torti file
## [1.14.0] - 2022-03-28
* TEIS-2791: implemented functionality for updating classifier item cache in batches
......
theGroup=ee.sm.ti.teis
theVersion=1.14.0
commonsVersion=1.33.0
commonApiGatewayVersion=1.33.0
theVersion=1.15.0
commonsVersion=1.34.0
commonApiGatewayVersion=1.34.0
pluginVersion=1.5.0
jaxbVersion=2.3.1
package ee.sm.ti.teis.xroadgateway.torti;
import ee.sm.ti.teis.XroadGatewayAppTestBase;
import ee.sm.ti.teis.commongateway.xroadgateway.torti.request.GetFileFromTORTIXroadTestRequest;
import ee.sm.ti.teis.commongateway.xroadgateway.torti.response.GetFileFromTORTIXroadTestResponse;
import ee.sm.ti.teis.domain.torti.TORTIFileResponse;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import ee.sm.ti.teis.xroadgateway.torti.listener.TORTIGwTestListener;
import ee.sm.ti.teis.xroadgateway.torti.service.TORTIXroadService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import java.io.IOException;
import java.util.List;
import static ee.sm.ti.teis.servicerequest.UserType.OFFICIAL_USER;
import static ee.sm.ti.teis.types.enums.RolePrivilegeCode.TI_MANAGE_COMPANIES;
import static ee.sm.ti.teis.utils.TestUtils.createRequestMeta;
import static java.util.UUID.randomUUID;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
public class GetFileFromTORTIGwTestListenerTest extends XroadGatewayAppTestBase {
@Autowired
TORTIGwTestListener listener;
@MockBean
TORTIXroadService tortiXroadService;
GetFileFromTORTIXroadTestRequest request;
GetFileFromTORTIXroadTestResponse response;
RequestMetaDTO requestMetaDTO;
@BeforeEach
void setUp() {
requestMetaDTO = createRequestMeta(null, OFFICIAL_USER, randomUUID().toString(),
List.of(TI_MANAGE_COMPANIES.name()));
request = new GetFileFromTORTIXroadTestRequest();
request.setRequestMetaDTO(requestMetaDTO);
TORTIFileResponse result = new TORTIFileResponse();
result.setResultResponseCode("0");
doReturn(result).when(tortiXroadService).getTORTIFile(any());
}
@Test
void get_success() throws IOException {
request.setPayload(randomUUID(), requestMetaDTO);
response = listener.getFile(request);
assertThat(response.getPayload().getResultResponseCode()).isEqualTo("0");
assertThat(response.getPayload().getFile()).isNull();
}
}
package ee.sm.ti.teis.xroadgateway.torti;
import ee.sm.ti.teis.XroadGatewayAppTestBase;
import ee.sm.ti.teis.domain.torti.GetFileFromTORTI;
import ee.sm.ti.teis.domain.torti.TORTIFileResponse;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import ee.sm.ti.teis.xroadgateway.torti.listener.TORTIMsListener;
import ee.sm.ti.teis.xroadgateway.torti.service.TORTIXroadService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import java.util.List;
import static ee.sm.ti.teis.serviceclient.xroad.XroadTORTIServiceClient.GetFileFromTORTIMsRequest;
import static ee.sm.ti.teis.serviceclient.xroad.XroadTORTIServiceClient.GetFileFromTORTIMsResponse;
import static ee.sm.ti.teis.servicerequest.UserType.OFFICIAL_USER;
import static ee.sm.ti.teis.types.enums.RolePrivilegeCode.TI_MANAGE_COMPANIES;
import static ee.sm.ti.teis.utils.TestUtils.assertBadRequest;
import static ee.sm.ti.teis.utils.TestUtils.createRequestMeta;
import static java.util.UUID.randomUUID;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
public class GetFileFromTORTIMsListenerTest extends XroadGatewayAppTestBase {
@Autowired
TORTIMsListener listener;
@MockBean
TORTIXroadService tortiXroadService;
GetFileFromTORTIMsRequest request;
GetFileFromTORTIMsResponse response;
GetFileFromTORTI payload;
RequestMetaDTO requestMetaDTO;
@BeforeEach
void setUp() {
requestMetaDTO = createRequestMeta(null, OFFICIAL_USER, randomUUID().toString(),
List.of(TI_MANAGE_COMPANIES.name()));
request = new GetFileFromTORTIMsRequest();
payload = new GetFileFromTORTI();
request.setRequestMetaDTO(requestMetaDTO);
TORTIFileResponse result = new TORTIFileResponse();
result.setResultResponseCode("0");
doReturn(result).when(tortiXroadService).getTORTIFile(any());
}
@Test
void get_success() {
payload.setInitialResponseId(randomUUID());
request.setPayload(payload, requestMetaDTO);
response = listener.getFile(request);
assertThat(response.getPayload().getResultResponseCode()).isEqualTo("0");
assertThat(response.getPayload().getFile()).isNull();
}
@Test
void get_noInitialResponseIdGiven_badRequest() {
request.setPayload(new GetFileFromTORTI(), requestMetaDTO);
response = listener.getFile(request);
assertBadRequest(response.getError());
assertThat(response.getError().getViolations().stream()
.anyMatch(violation -> violation.getMessage().contains("must not be null")))
.isTrue();
}
}
......@@ -13,11 +13,11 @@ import org.springframework.boot.test.mock.mockito.MockBean;
import java.util.List;
import static ee.sm.ti.teis.serviceclient.xroad.XroadTORTIServiceClient.GetIdFromTORTIMsRequest;
import static ee.sm.ti.teis.serviceclient.xroad.XroadTORTIServiceClient.GetIdFromTORTIMsResponse;
import static ee.sm.ti.teis.servicerequest.UserType.OFFICIAL_USER;
import static ee.sm.ti.teis.types.enums.RolePrivilegeCode.TI_MANAGE_COMPANIES;
import static ee.sm.ti.teis.utils.TestUtils.createRequestMeta;
import static ee.sm.ti.teis.xroadgateway.config.TORTIQueueConfig.GetIdFromTORTIMsRequest;
import static ee.sm.ti.teis.xroadgateway.config.TORTIQueueConfig.GetIdFromTORTIMsResponse;
import static java.util.UUID.randomUUID;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.doReturn;
......
......@@ -2,9 +2,10 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.03.16 at 02:04:38 PM CET
// Generated on: 2022.03.28 at 12:01:47 PM CEST
//
package ee.sm.ti.teis.generated.torti;
import javax.xml.bind.annotation.*;
......@@ -39,8 +40,10 @@ public class Notes {
/**
* Gets the value of the value property.
*
* @return possible object is
* {@link String }
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
......@@ -49,8 +52,10 @@ public class Notes {
/**
* Sets the value of the value property.
*
* @param value allowed object is
* {@link String }
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
......@@ -59,8 +64,10 @@ public class Notes {
/**
* Gets the value of the lang property.
*
* @return possible object is
* {@link String }
* @return
* possible object is
* {@link String }
*
*/
public String getLang() {
if (lang == null) {
......@@ -73,8 +80,10 @@ public class Notes {
/**
* Sets the value of the lang property.
*
* @param value allowed object is
* {@link String }
* @param value
* allowed object is
* {@link String }
*
*/
public void setLang(String value) {
this.lang = value;
......
......@@ -2,9 +2,10 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.03.16 at 02:04:38 PM CET
// Generated on: 2022.03.28 at 12:01:47 PM CEST
//
package ee.sm.ti.teis.generated.torti;
import javax.xml.bind.annotation.*;
......@@ -39,8 +40,10 @@ public class RequestHash {
/**
* Gets the value of the value property.
*
* @return possible object is
* {@link String }
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
......@@ -49,8 +52,10 @@ public class RequestHash {
/**
* Sets the value of the value property.
*
* @param value allowed object is
* {@link String }
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
......@@ -59,8 +64,10 @@ public class RequestHash {
/**
* Gets the value of the algorithmId property.
*
* @return possible object is
* {@link String }
* @return
* possible object is
* {@link String }
*
*/
public String getAlgorithmId() {
return algorithmId;
......@@ -69,8 +76,10 @@ public class RequestHash {
/**
* Sets the value of the algorithmId property.
*
* @param value allowed object is
* {@link String }
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlgorithmId(String value) {
this.algorithmId = value;
......
......@@ -2,9 +2,10 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.03.16 at 02:04:38 PM CET
// Generated on: 2022.03.28 at 12:01:47 PM CEST
//
package ee.sm.ti.teis.generated.torti;
import javax.xml.bind.annotation.*;
......@@ -39,8 +40,10 @@ public class TOOTREG {
/**
* Gets the value of the request property.
*
* @return possible object is
* {@link TootregRequestType }
* @return
* possible object is
* {@link TootregRequestType }
*
*/
public TootregRequestType getRequest() {
return request;
......@@ -49,8 +52,10 @@ public class TOOTREG {
/**
* Sets the value of the request property.
*
* @param value allowed object is
* {@link TootregRequestType }
* @param value
* allowed object is
* {@link TootregRequestType }
*
*/
public void setRequest(TootregRequestType value) {
this.request = value;
......
......@@ -2,9 +2,10 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.03.16 at 02:04:38 PM CET
// Generated on: 2022.03.28 at 12:01:47 PM CEST
//
package ee.sm.ti.teis.generated.torti;
import javax.xml.bind.annotation.*;
......@@ -39,8 +40,10 @@ public class TOOTREGAMETNIK {
/**
* Gets the value of the request property.
*
* @return possible object is
* {@link TootregAmetnikRequestType }
* @return
* possible object is
* {@link TootregAmetnikRequestType }
*
*/
public TootregAmetnikRequestType getRequest() {
return request;
......@@ -49,8 +52,10 @@ public class TOOTREGAMETNIK {
/**
* Sets the value of the request property.
*
* @param value allowed object is
* {@link TootregAmetnikRequestType }
* @param value
* allowed object is
* {@link TootregAmetnikRequestType }
*
*/
public void setRequest(TootregAmetnikRequestType value) {
this.request = value;
......
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.03.28 at 12:01:47 PM CEST
//
package ee.sm.ti.teis.generated.torti;
import javax.xml.bind.annotation.*;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="request" type="{http://emta-v6.x-road.eu}tootregAmetnikRequestType"/&gt;
* &lt;element name="response" type="{http://emta-v6.x-road.eu}tootregAmetnikResponseType"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"request",
"response"
})
@XmlRootElement(name = "TOOTREG_AMETNIKResponse")
public class TOOTREGAMETNIKResponse {
@XmlElement(required = true)
protected TootregAmetnikRequestType request;
@XmlElement(required = true)
protected TootregAmetnikResponseType response;
/**
* Gets the value of the request property.
*
* @return possible object is
* {@link TootregAmetnikRequestType }
*/
public TootregAmetnikRequestType getRequest() {
return request;
}
/**
* Sets the value of the request property.
*
* @param value allowed object is
* {@link TootregAmetnikRequestType }
*/
public void setRequest(TootregAmetnikRequestType value) {
this.request = value;
}
/**
* Gets the value of the response property.
*
* @return possible object is
* {@link TootregAmetnikResponseType }
*/
public TootregAmetnikResponseType getResponse() {
return response;
}
/**
* Sets the value of the response property.
*
* @param value allowed object is
* {@link TootregAmetnikResponseType }
*/
public void setResponse(TootregAmetnikResponseType value) {
this.response = value;
}
}
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.03.28 at 12:01:47 PM CEST
//
package ee.sm.ti.teis.generated.torti;
import javax.xml.bind.annotation.*;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="request" type="{http://emta-v6.x-road.eu}tootregRequestType"/&gt;
* &lt;element name="response" type="{http://emta-v6.x-road.eu}tootregResponseType"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"request",
"response"
})
@XmlRootElement(name = "TOOTREGResponse")
public class TOOTREGResponse {
@XmlElement(required = true)
protected TootregRequestType request;
@XmlElement(required = true)
protected TootregResponseType response;
/**
* Gets the value of the request property.
*
* @return possible object is
* {@link TootregRequestType }
*/
public TootregRequestType getRequest() {
return request;
}
/**
* Sets the value of the request property.
*
* @param value allowed object is
* {@link TootregRequestType }
*/
public void setRequest(TootregRequestType value) {
this.request = value;
}
/**
* Gets the value of the response property.
*
* @return possible object is
* {@link TootregResponseType }
*/
public TootregResponseType getResponse() {
return response;
}
/**
* Sets the value of the response property.
*
* @param value allowed object is
* {@link TootregResponseType }
*/
public void setResponse(TootregResponseType value) {
this.response = value;
}
}
......@@ -2,9 +2,10 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.03.16 at 02:04:38 PM CET
// Generated on: 2022.03.28 at 12:01:47 PM CEST
//
package ee.sm.ti.teis.generated.torti;
import javax.xml.bind.annotation.*;
......@@ -39,8 +40,10 @@ public class TORIK {
/**
* Gets the value of the request property.
*
* @return possible object is
* {@link TorikRequestType }
* @return
* possible object is
* {@link TorikRequestType }
*
*/
public TorikRequestType getRequest() {
return request;
......@@ -49,8 +52,10 @@ public class TORIK {
/**
* Sets the value of the request property.
*
* @param value allowed object is
* {@link TorikRequestType }
* @param value
* allowed object is
* {@link TorikRequestType }
*
*/
public void setRequest(TorikRequestType value) {
this.request = value;
......
......@@ -2,9 +2,10 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.03.16 at 02:04:38 PM CET