Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/pn 11619 #549

Open
wants to merge 5 commits into
base: feature/TECH-BINGQ3.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/openapi/external/consolidatore-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ components:
required:
- requestId
- requestSenderId
- requestPAId
- requestPaId
- clientRequestTimeStamp
- eventType
- productType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class PaperRequestMetadata {

String iun;
String requestPaid;
String requestPaId;
String productType;
String printType;
Map<String, String> vas;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import it.pagopa.pn.ec.repositorymanager.model.entity.RequestPersonal;
import it.pagopa.pn.ec.rest.v1.dto.*;
import it.pagopa.pn.ec.testutils.annotation.SpringBootTestWebEnv;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand All @@ -23,6 +24,7 @@
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable;
import software.amazon.awssdk.enhanced.dynamodb.TableSchema;

import javax.validation.constraints.AssertTrue;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import java.util.ArrayList;
Expand Down Expand Up @@ -433,4 +435,39 @@ void updateMessageIdInRequestMetadataNotFound() {
.expectStatus()
.isNotFound();
}
}

private static Stream<Arguments> provideNewDigitalAndPaperRequestToInsert() {
return Stream.of(Arguments.of(digitalRequest, "newIdDigitalToInsert"), Arguments.of(paperRequest, "newIdPaperToInsert"));
}

@ParameterizedTest
@MethodSource("provideNewDigitalAndPaperRequestToInsert")
void digitalAndPaperEntityAndDtoComparisonTest(RequestDto requestDto, String newId) {

requestDto.setRequestIdx(newId);

RequestDto toCompare = webClient.post().uri(gestoreRepositoryEndpointProperties.postRequest()).bodyValue(requestDto).exchange()
.expectBody(RequestDto.class).returnResult().getResponseBody();
// Paper comparison
if (requestDto.getRequestMetadata().getPaperRequestMetadata() != null) {
Assertions.assertEquals(toCompare.getRequestMetadata().getPaperRequestMetadata().getRequestPaId(), requestDto.getRequestMetadata().getPaperRequestMetadata().getRequestPaId());
Assertions.assertEquals(toCompare.getRequestMetadata().getPaperRequestMetadata().getIun(), requestDto.getRequestMetadata().getPaperRequestMetadata().getIun());
Assertions.assertEquals(toCompare.getRequestMetadata().getPaperRequestMetadata().getProductType(), requestDto.getRequestMetadata().getPaperRequestMetadata().getProductType());
Assertions.assertEquals(toCompare.getRequestMetadata().getPaperRequestMetadata().getVas(), requestDto.getRequestMetadata().getPaperRequestMetadata().getVas());
Assertions.assertEquals(toCompare.getRequestMetadata().getPaperRequestMetadata().getPrintType(), requestDto.getRequestMetadata().getPaperRequestMetadata().getPrintType());
}
// Digital comparison
else if (requestDto.getRequestMetadata().getDigitalRequestMetadata() != null) {
Assertions.assertEquals(toCompare.getRequestMetadata().getDigitalRequestMetadata().getEventType(), requestDto.getRequestMetadata().getDigitalRequestMetadata().getEventType());
Assertions.assertEquals(toCompare.getRequestMetadata().getDigitalRequestMetadata().getCorrelationId(), requestDto.getRequestMetadata().getDigitalRequestMetadata().getCorrelationId());
Assertions.assertEquals(toCompare.getRequestMetadata().getDigitalRequestMetadata().getMessageContentType(), requestDto.getRequestMetadata().getDigitalRequestMetadata().getMessageContentType());
Assertions.assertEquals(toCompare.getRequestMetadata().getDigitalRequestMetadata().getTags(), requestDto.getRequestMetadata().getDigitalRequestMetadata().getTags());
}

Assertions.assertEquals(toCompare.getxPagopaExtchCxId(), requestDto.getxPagopaExtchCxId());
Assertions.assertEquals(toCompare.getMessageId(), requestDto.getMessageId());
Assertions.assertEquals(toCompare.getRequestIdx(), requestDto.getRequestIdx());
Assertions.assertEquals(toCompare.getStatusRequest(), requestDto.getStatusRequest());
}

}