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

fix: Update deleteTimer RequestParam #32

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import it.gov.pagopa.wispconverter.controller.model.ReceiptTimerRequest;
import it.gov.pagopa.wispconverter.service.ReceiptTimerService;
import it.gov.pagopa.wispconverter.util.Trace;
import java.util.Arrays;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -53,9 +54,9 @@ public void createTimer(@RequestBody ReceiptTimerRequest request) {
produces = MediaType.APPLICATION_JSON_VALUE
)
@Trace(businessProcess = BP_TIMER_DELETE, reEnabled = true)
public void deleteTimer(@RequestParam List<String> paymentTokens) {
public void deleteTimer(@RequestParam() String tokens) {
List<String> paymentTokens = Arrays.asList(tokens.split(","));
log.info("Delete Timer arrived: " + paymentTokens);
receiptTimerService.cancelScheduledMessage(paymentTokens);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import it.gov.pagopa.wispconverter.Application;
import it.gov.pagopa.wispconverter.controller.model.ReceiptTimerRequest;
import it.gov.pagopa.wispconverter.repository.CacheRepository;
import it.gov.pagopa.wispconverter.repository.RPTRequestRepository;
import it.gov.pagopa.wispconverter.repository.RTRequestRepository;
import it.gov.pagopa.wispconverter.repository.ReEventRepository;
import it.gov.pagopa.wispconverter.repository.*;
import it.gov.pagopa.wispconverter.service.ConfigCacheService;
import it.gov.pagopa.wispconverter.service.PaaInviaRTSenderService;
import it.gov.pagopa.wispconverter.service.ReceiptTimerService;
Expand Down Expand Up @@ -82,6 +79,8 @@ public class ReceiptTimerTest {
private MockMvc mockMvc;
@MockBean
private ReceiptTimerService receiptTimerService;
@MockBean
private IdempotencyKeyRepository idempotencyKeyRepository;

/*
* CREATE receipt/timer
Expand Down Expand Up @@ -122,7 +121,7 @@ public void testDeleteTimer() throws Exception {
List<String> paymentTokens = List.of("token1", "token2");

mockMvc.perform(delete("/receipt/timer")
.param("paymentTokens", "token1", "token2")
.param("paymentTokens", "token1,token2")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());

Expand All @@ -137,7 +136,7 @@ public void testDeleteTimerServiceException() throws Exception {
doThrow(new RuntimeException("Service exception")).when(receiptTimerService).cancelScheduledMessage(Mockito.eq(paymentTokens));

mockMvc.perform(delete("/receipt/timer")
.param("paymentTokens", "token1", "token2")
.param("paymentTokens", "token1,token2")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isInternalServerError());

Expand Down
Loading