Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
urgi-is
FAIDARE
Commits
697e6f1a
Commit
697e6f1a
authored
Nov 19, 2021
by
Jean-Baptiste Nizet
Browse files
feat: support legacy path for germplasm card
parent
d35cead5
Changes
2
Show whitespace changes
Inline
Side-by-side
backend/src/main/java/fr/inra/urgi/faidare/web/germplasm/GermplasmController.java
View file @
697e6f1a
...
@@ -39,10 +39,13 @@ import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBo
...
@@ -39,10 +39,13 @@ import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBo
/**
/**
* Controller used to display a germplasm card based on its ID.
* 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
* @author JB Nizet
*/
*/
@Controller
(
"webGermplasmController"
)
@Controller
(
"webGermplasmController"
)
@RequestMapping
(
"/germplasms"
)
@RequestMapping
(
{
"/germplasms"
,
"/germplasm"
}
)
public
class
GermplasmController
{
public
class
GermplasmController
{
private
final
GermplasmRepository
germplasmRepository
;
private
final
GermplasmRepository
germplasmRepository
;
...
...
backend/src/test/java/fr/inra/urgi/faidare/web/germplasm/GermplasmControllerTest.java
View file @
697e6f1a
...
@@ -160,6 +160,18 @@ public class GermplasmControllerTest {
...
@@ -160,6 +160,18 @@ public class GermplasmControllerTest {
verify
(
mockGermplasmRepository
).
find
(
argThat
(
criteriaMatcher
));
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
@Test
void
shouldGenerateSitemap
()
throws
Exception
{
void
shouldGenerateSitemap
()
throws
Exception
{
List
<
GermplasmSitemapVO
>
germplasms
=
Arrays
.
asList
(
List
<
GermplasmSitemapVO
>
germplasms
=
Arrays
.
asList
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment