new WebServiceListRoute(),
new BatchRoute(),
new BatchBootstrapRoute(),
- new ApiSourcesRoute(),
new ProfilesExportRoute());
@Override
}
}
- /**
- * SONAR-7852 /api/sources?resource url is still used
- */
- private static class ApiSourcesRoute implements Route {
-
- private static final String API_SOURCES_WS = "/api/sources";
-
- @Override
- public boolean test(String path) {
- return API_SOURCES_WS.equals(path);
- }
-
- @Override
- public String apply(HttpServletRequest request) {
- return format("%s%s/index?%s", request.getContextPath(), API_SOURCES_WS, request.getQueryString());
- }
- }
-
/**
* Old scanners were using /profiles/export url (see SVS-130)
*/
verifyRedirection("/batch_bootstrap/index/", null, "/sonarqube/batch/index");
}
- @Test
- public void send_redirect_when_url_contains_api_sources() throws Exception {
- verifyRedirection("/api/sources", "resource=my.project", "/sonarqube/api/sources/index?resource=my.project");
- verifyRedirection("/api/sources/", "resource=my.project", "/sonarqube/api/sources/index?resource=my.project");
- }
-
@Test
public void send_redirect_when_url_contains_profiles_export() throws Exception {
verifyRedirection("/profiles/export", "format=pmd", "/sonarqube/api/qualityprofiles/export?format=pmd");