Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into MCIL-23-update-terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoGiuliani authored Apr 19, 2024
2 parents c9565da + edc7535 commit ff8aaa9
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-merge-postman-test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull request review
name: Postman Test

on:
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ repositories {

dependencies {
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-resteasy-reactive-jackson'
implementation 'io.quarkus:quarkus-resteasy-reactive'
implementation 'io.quarkus:quarkus-resteasy-reactive-jackson'
implementation 'io.quarkus:quarkus-arc'
implementation "org.projectlombok:lombok:${lombokVersion}"
implementation 'io.quarkus:quarkus-hibernate-validator'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ quarkusPlatformVersion=3.7.3
lombokVersion=1.18.30
jacocoToolVersion=0.8.11

sonarPluginVersion=4.4.1.3373
sonarPluginVersion=5.0.0.4638
sonarProjectKey=pagopa_mil-terminal-registry

projectVersion=1.3.0
13 changes: 13 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4902,6 +4902,11 @@
<sha256 value="37b316009dad2438e5102910e54ddb414a755cab23213d7dc9a712e35d8eabbf" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarqube" name="org.sonarqube.gradle.plugin" version="5.0.0.4638">
<artifact name="org.sonarqube.gradle.plugin-5.0.0.4638.pom">
<sha256 value="46558329c0f7c7cedb888778cbab2e9e327fc12ced6b4f4f55032f2bf9925b79" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarsource.parent" name="parent" version="59.0.29">
<artifact name="parent-59.0.29.pom">
<sha1 value="16417adadfb28cbb1094184257cf952975c79e11" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -4942,6 +4947,14 @@
<sha256 value="11206426c9be18ce39741b8c7d1721bfe414e99d964f69153c1796f1fb837bcc" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonarsource.scanner.gradle" name="sonarqube-gradle-plugin" version="5.0.0.4638">
<artifact name="sonarqube-gradle-plugin-5.0.0.4638.jar">
<sha256 value="9fab1df676229a432cff70f168497c5ff12d8c11776b6a54ac3de862094670cb" origin="Generated by Gradle"/>
</artifact>
<artifact name="sonarqube-gradle-plugin-5.0.0.4638.module">
<sha256 value="1cc22402989d76af0905ab0d29f23532161c78b0099327d37e5637e4b1425228" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.sonatype.oss" name="oss-parent" version="5">
<artifact name="oss-parent-5.pom">
<sha1 value="3ae20880ad3d5da6b1caec19e3de7e70dd2dd762" origin="Generated by Gradle"/>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/it/pagopa/swclient/mil/dao/PageMetadata.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package it.pagopa.swclient.mil.dao;

import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection
public record PageMetadata(int size, long totalElements, int totalPages) {
}
4 changes: 4 additions & 0 deletions src/main/java/it/pagopa/swclient/mil/dao/TerminalEntity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package it.pagopa.swclient.mil.dao;

import io.quarkus.mongodb.panache.common.MongoEntity;
import org.bson.codecs.pojo.annotations.BsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -15,10 +16,13 @@
public class TerminalEntity {

@BsonId
@BsonProperty("terminalUuid")
private String terminalUuid;

@BsonProperty("terminalHandler")
private String terminalHandler;

@BsonProperty("serviceProviderId")
private String serviceProviderId;

private Terminal terminal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package it.pagopa.swclient.mil.dao;

import java.util.List;
import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection
public record TerminalPageResponse(List<TerminalEntity> terminals, PageMetadata page) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,25 @@ void testCreateTerminal_Failure() {

@Test
void whenGetTerminalListThenSuccess() {
TerminalEntity terminalEntity1 = new TerminalEntity();
TerminalEntity terminalEntity2 = new TerminalEntity();
terminalEntity1.terminalUuid = "uuid1";
terminalEntity1.serviceProviderId = "serviceProviderId";
terminalEntity2.terminalUuid = "uuid2";
terminalEntity2.serviceProviderId = "serviceProviderId";
List<TerminalEntity> terminalEntities= List.of(terminalEntity1,terminalEntity2);

ReactivePanacheQuery<TerminalEntity> query = Mockito.mock(ReactivePanacheQuery.class);
Mockito.when(query.page(anyInt(), anyInt())).thenReturn(query);
Mockito.when(query.list()).thenReturn(Uni.createFrom().item(mockedList()));
Mockito.when(query.list()).thenReturn(Uni.createFrom().item(terminalEntities));
Mockito.when(terminalRepository.find("serviceProviderId", "serviceProviderId")).thenReturn(query);

var terminalList = terminalService.getTerminalListPaged("serviceProviderId", 0, 10);

terminalList
.subscribe()
.withSubscriber(UniAssertSubscriber.create())
.assertItem(mockedList());
.assertItem(terminalEntities);

}

@Test
Expand All @@ -98,7 +106,7 @@ void whenGetTerminalCountThenSuccess() {
.withSubscriber(UniAssertSubscriber.create())
.assertItem(10L);
}

@Test
void testFindTerminal_Success() {
ReactivePanacheQuery<TerminalEntity> query = Mockito.mock(ReactivePanacheQuery.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static TerminalEntity getCorrectTerminalEntity() {
terminalEntity.setTerminalUuid("c7a1b24b0583477292ebdbaa");
terminalEntity.setTerminalHandler("45856");
terminalEntity.setTerminal(terminal);

return terminalEntity;
}
}
94 changes: 82 additions & 12 deletions src/test/postman/mil-terminal-registry.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"item": [
{
"name": "getTerminalRegistryAccessToken",
"name": "Get Terminal Registry Access Token",
"event": [
{
"listen": "test",
Expand Down Expand Up @@ -57,7 +57,7 @@
"header": [
{
"key": "RequestId",
"value": "{{$guid}}",
"value": "{{requestId}}",
"type": "text"
},
{
Expand Down Expand Up @@ -99,22 +99,29 @@
"response": []
},
{
"name": "createTerminal",
"name": "Create New Terminal",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 201\", function () {",
" pm.response.to.have.status(201);",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [
{
"description": "(Required) Request Id that will be logged by services",
"key": "RequestId",
"value": "{{$guid}}"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
"value": "{{requestId}}"
}
],
"body": {
Expand All @@ -138,6 +145,57 @@
"description": "Creates a new terminal"
},
"response": []
},
{
"name": "Get Terminal List",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "GET",
"header": [
{
"description": "(Required) Request Id that will be logged by services",
"key": "RequestId",
"value": "{{requestId}}"
}
],
"url": {
"raw": "{{MIL_TR_BASE_URL}}/terminals?page={{getTerminalPage}}&size={{getTerminalPageSize}}",
"host": [
"{{MIL_TR_BASE_URL}}"
],
"path": [
"terminals"
],
"query": [
{
"key": "page",
"value": "{{getTerminalPage}}",
"description": "(Required) Number of the requested page of data"
},
{
"key": "size",
"value": "{{getTerminalPageSize}}",
"description": "(Required) Size of the requested page of data"
}
]
},
"description": "Returns a page of terminals"
},
"response": []
}
],
"auth": {
Expand Down Expand Up @@ -224,6 +282,18 @@
{
"key": "mil_auth_api_version",
"value": "1.0.0"
},
{
"key": "getTerminalPage",
"value": "0"
},
{
"key": "getTerminalPageSize",
"value": "10"
},
{
"key": "requestId",
"value": "d0d654e6-97da-4848-b568-99fedccb642b"
}
]
}

0 comments on commit ff8aaa9

Please sign in to comment.