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

[PAGOPA-2086] feat: add endpoint for expose static error page #85

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
@@ -0,0 +1,15 @@
package it.gov.pagopa.wispconverter.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller()
@RequestMapping("/static")
public class StaticPagesController {

@GetMapping(path = "/error")
public String error() {
return "error";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package it.gov.pagopa.wispconverter.endpoint;

import com.azure.cosmos.CosmosClientBuilder;
import com.azure.messaging.servicebus.ServiceBusSenderClient;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.gov.pagopa.wispconverter.Application;
import it.gov.pagopa.wispconverter.repository.*;
import it.gov.pagopa.wispconverter.service.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.core.metrics.ApplicationStartup;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.client.RestClient;

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@ActiveProfiles(profiles = "test")
@SpringBootTest(classes = Application.class)
@AutoConfigureMockMvc
public class StaticPagesTest {
@Autowired
ObjectMapper objectMapper;
@Autowired
private MockMvc mvc;
@Autowired
private ConfigCacheService configCacheService;
@MockBean
private ApplicationStartup applicationStartup;
@MockBean
private RPTRequestRepository rptRequestRepository;
@MockBean
private RTRetryRepository rtRetryRepository;
@MockBean
private RTRepository rtRepository;
@MockBean
private it.gov.pagopa.gen.wispconverter.client.iuvgenerator.invoker.ApiClient iuveneratorClient;
@MockBean
private it.gov.pagopa.gen.wispconverter.client.gpd.invoker.ApiClient gpdClient;
@MockBean
private it.gov.pagopa.gen.wispconverter.client.checkout.invoker.ApiClient checkoutClient;
@MockBean
private it.gov.pagopa.gen.wispconverter.client.cache.invoker.ApiClient cacheClient;
@MockBean
private it.gov.pagopa.gen.wispconverter.client.decouplercaching.invoker.ApiClient decouplerCachingClient;
@MockBean
private PaaInviaRTSenderService paaInviaRTService;
@MockBean
private ServiceBusService paaInviaRTServiceBusService;
@MockBean
private ServiceBusSenderClient serviceBusSenderClient;
@MockBean
private RestClient.Builder restClientBuilder;
@MockBean
private CosmosClientBuilder cosmosClientBuilder;
@Qualifier("redisSimpleTemplate")
@MockBean
private RedisTemplate<String, Object> redisSimpleTemplate;
@MockBean
private ReEventRepository reEventRepository;
@MockBean
private CacheRepository cacheRepository;
@MockBean
private IdempotencyKeyRepository idempotencyKeyRepository;
@Autowired
private MockMvc mockMvc;
@MockBean
private ReceiptTimerService receiptTimerService;
@MockBean
private ReceiptService receiptService;

/*
* CREATE receipt/timer
andrea-deri marked this conversation as resolved.
Show resolved Hide resolved
* */
@Test
public void testCreateTimer() throws Exception {
andrea-deri marked this conversation as resolved.
Show resolved Hide resolved

mockMvc.perform(get("/static/error"))
.andExpect(status().isOk())
.andExpect(content().contentType("text/html;charset=UTF-8"));
}
}
Loading