Skip to content
Snippets Groups Projects
Verified Commit 625150b3 authored by Jean-Baptiste Nizet's avatar Jean-Baptiste Nizet Committed by Raphaël Flores
Browse files

feat: support legacy path for germplasm card

parent e1117f65
No related branches found
No related tags found
1 merge request!82Epic/merge faidare dd
......@@ -39,10 +39,13 @@ import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBo
/**
* Controller used to display a germplasm card based on its ID.
* Note that this controller is mapped to the /germplasm path in addition to
* the canonical /germplasms path in order to still honor legacy URLs used
* in external applications
* @author JB Nizet
*/
@Controller("webGermplasmController")
@RequestMapping("/germplasms")
@RequestMapping({"/germplasms", "/germplasm"})
public class GermplasmController {
private final GermplasmRepository germplasmRepository;
......
......@@ -160,6 +160,18 @@ public class GermplasmControllerTest {
verify(mockGermplasmRepository).find(argThat(criteriaMatcher));
}
@Test
void shouldSupportLegacyPath() throws Exception {
PaginatedList<GermplasmVO> puiList = new PaginatedList<>(null, Collections.singletonList(germplasm));
when(mockGermplasmRepository.find(any())).thenReturn(puiList);
mockMvc.perform(get("/germplasm").param("pui", germplasm.getGermplasmPUI()))
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_HTML))
.andExpect(htmlContent().hasTitle("Germplasm: BLE BARBU DU ROUSSILLON"))
.andExpect(htmlContent().endsCorrectly());
}
@Test
void shouldGenerateSitemap() throws Exception {
List<GermplasmSitemapVO> germplasms = Arrays.asList(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment