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 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
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) {
log.info("Delete Timer arrived: " + paymentTokens);
receiptTimerService.cancelScheduledMessage(paymentTokens);

public void deleteTimer(@RequestParam() String paymentTokens) {
List<String> tokens = Arrays.asList(paymentTokens.split(","));
log.info("Delete Timer arrived: " + tokens);
Dismissed Show dismissed Hide dismissed
receiptTimerService.cancelScheduledMessage(tokens);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,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 @@ -135,7 +135,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