@@ -58,32 +58,49 @@ public class BrowsesResourceControllerIT extends AbstractControllerIntegrationTe
5858
5959 @ Test
6060 public void findAll () throws Exception {
61- //When we call the root endpoint
61+ // Save the original configuration value
62+ String [] originalValue = configurationService .getArrayProperty ("webui.browse.vocabularies.disabled" );
63+ try {
64+ // Override the configuration specifically for this test to use 'srsc'
65+ configurationService .setProperty ("webui.browse.vocabularies.disabled" , "srsc" );
66+ // Clear cache to ensure the configuration change takes effect
67+ metadataAuthorityService .clearCache ();
68+ //When we call the root endpoint
6269 getClient ().perform (get ("/api/discover/browses" ))
63- //The status has to be 200 OK
64- .andExpect (status ().isOk ())
65- //We expect the content type to be "application/hal+json;charset=UTF-8"
66- .andExpect (content ().contentType (contentType ))
70+ //The status has to be 200 OK
71+ .andExpect (status ().isOk ())
72+ //We expect the content type to be "application/hal+json;charset=UTF-8"
73+ .andExpect (content ().contentType (contentType ))
6774
68- //Our default Discovery config has 6 browse indexes, so we expect this to be reflected in the page
69- // object
70- .andExpect (jsonPath ("$.page.size" , is (20 )))
71- .andExpect (jsonPath ("$.page.totalElements" , is (5 )))
72- .andExpect (jsonPath ("$.page.totalPages" , is (1 )))
73- .andExpect (jsonPath ("$.page.number" , is (0 )))
75+ //Our default Discovery config has 6 browse indexes, so we expect this to be reflected in the page
76+ // object
77+ .andExpect (jsonPath ("$.page.size" , is (20 )))
78+ .andExpect (jsonPath ("$.page.totalElements" , is (5 )))
79+ .andExpect (jsonPath ("$.page.totalPages" , is (1 )))
80+ .andExpect (jsonPath ("$.page.number" , is (0 )))
7481
75- //The array of browse index should have a size 6
76- .andExpect (jsonPath ("$._embedded.browses" , hasSize (6 )))
77-
78- //Check that all (and only) the default browse indexes are present
79- .andExpect (jsonPath ("$._embedded.browses" , containsInAnyOrder (
80- BrowseIndexMatcher .dateIssuedBrowseIndex ("asc" ),
81- BrowseIndexMatcher .contributorBrowseIndex ("asc" ),
82- BrowseIndexMatcher .titleBrowseIndex ("asc" ),
83- BrowseIndexMatcher .subjectBrowseIndex ("asc" ),
84- BrowseIndexMatcher .languageBrowseIndex ("asc" )
85- )))
82+ //The array of browse index should have a size 6
83+ .andExpect (jsonPath ("$._embedded.browses" , hasSize (5 )))
84+
85+ //Check that all (and only) the default browse indexes are present
86+ .andExpect (jsonPath ("$._embedded.browses" , containsInAnyOrder (
87+ BrowseIndexMatcher .dateIssuedBrowseIndex ("asc" ),
88+ BrowseIndexMatcher .contributorBrowseIndex ("asc" ),
89+ BrowseIndexMatcher .titleBrowseIndex ("asc" ),
90+ BrowseIndexMatcher .subjectBrowseIndex ("asc" ),
91+ BrowseIndexMatcher .languageBrowseIndex ("asc" )
92+ )))
8693 ;
94+ } finally {
95+ // Restore the original configuration value
96+ if (originalValue != null ) {
97+ configurationService .setProperty ("webui.browse.vocabularies.disabled" , originalValue );
98+ } else {
99+ configurationService .setProperty ("webui.browse.vocabularies.disabled" , (String ) null );
100+ }
101+ // Clear cache to ensure the original configuration is restored
102+ metadataAuthorityService .clearCache ();
103+ }
87104 }
88105
89106 @ Test
0 commit comments