Search in sources :

Example 1 with Route

use of org.opensearch.rest.RestHandler.Route in project OpenSearch by opensearch-project.

the class BaseRestHandlerTests method testReplaceRoutesMethod.

public void testReplaceRoutesMethod() throws Exception {
    List<Route> routes = Arrays.asList(new Route(Method.GET, "/path/test"), new Route(Method.PUT, "/path2/test"));
    List<ReplacedRoute> replacedRoutes = RestHandler.replaceRoutes(routes, "/prefix", "/deprecatedPrefix");
    for (int i = 0; i < routes.size(); i++) {
        assertEquals("/prefix" + routes.get(i).getPath(), replacedRoutes.get(i).getPath());
        assertEquals(routes.get(i).getMethod(), replacedRoutes.get(i).getMethod());
        assertEquals("/deprecatedPrefix" + routes.get(i).getPath(), replacedRoutes.get(i).getDeprecatedPath());
    }
}
Also used : ReplacedRoute(org.opensearch.rest.RestHandler.ReplacedRoute) ReplacedRoute(org.opensearch.rest.RestHandler.ReplacedRoute) Route(org.opensearch.rest.RestHandler.Route)

Aggregations

ReplacedRoute (org.opensearch.rest.RestHandler.ReplacedRoute)1 Route (org.opensearch.rest.RestHandler.Route)1