use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpMethod in project cdap by caskdata.
the class RouterPathTest method testRouterWorkFlowPathLookUp.
@Test
public void testRouterWorkFlowPathLookUp() throws Exception {
String path = "/v3/namespaces/default/apps///PurchaseHistory///workflows/PurchaseHistoryWorkflow/status";
HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), path);
RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, path, httpRequest);
Assert.assertEquals(RouterPathLookup.APP_FABRIC_HTTP, result);
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpMethod in project cdap by caskdata.
the class RouterPathTest method assertRouting.
private void assertRouting(String path, RouteDestination destination) {
for (HttpMethod method : ImmutableList.of(HttpMethod.GET, HttpMethod.POST, HttpMethod.DELETE)) {
HttpRequest httpRequest = new DefaultHttpRequest(VERSION, method, path);
RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, path, httpRequest);
Assert.assertEquals(destination, result);
}
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpMethod in project cdap by caskdata.
the class RouterPathTest method testMetricsPath.
@Test
public void testMetricsPath() throws Exception {
// Following URIs might not give actual results but we want to test resilience of Router Path Lookup
String flowPath = "/v3///metrics/system/apps/InvalidApp//";
HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), flowPath);
RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, flowPath, httpRequest);
Assert.assertEquals(RouterPathLookup.METRICS, result);
flowPath = "/v3/metrics";
httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("DELETE"), flowPath);
result = pathLookup.getRoutingService(FALLBACKSERVICE, flowPath, httpRequest);
Assert.assertEquals(RouterPathLookup.METRICS, result);
flowPath = "/v3/metrics//";
httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("POST"), flowPath);
result = pathLookup.getRoutingService(FALLBACKSERVICE, flowPath, httpRequest);
Assert.assertEquals(RouterPathLookup.METRICS, result);
testMetricsPath("/v3/metrics/search?target=tag&tag=namespace:user");
testMetricsPath("/v3/metrics/search?target=tag&tag=app:PurchaeHistory&tag=flow:PurchaseFlow");
testMetricsPath("/v3/metrics/search?target=metric&tag=app:PurchaeHistory&tag=flow:PurchaseFlow");
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpMethod in project cdap by caskdata.
the class RouterPathTest method testRouterWebAppPathLookUp.
@Test
public void testRouterWebAppPathLookUp() throws Exception {
// Calls to webapp service with appName in the first split of URI will be routed to webappService
// But if it has v2 then use the regular router lookup logic to find the appropriate service
final String webAppService = "webapp$HOST";
String path = "/sentiApp/abcd/efgh///";
HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), path);
RouteDestination result = pathLookup.getRoutingService(webAppService, path, httpRequest);
Assert.assertEquals(new RouteDestination(webAppService), result);
path = "/v3//metrics///";
httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), path);
result = pathLookup.getRoutingService(webAppService, path, httpRequest);
Assert.assertEquals(RouterPathLookup.METRICS, result);
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpMethod in project cdap by caskdata.
the class RouterPathTest method testRouterExploreStatusPathLookUp.
@Test
public void testRouterExploreStatusPathLookUp() throws Exception {
String explorePath = "/v3/explore/status";
HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), explorePath);
RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, explorePath, httpRequest);
Assert.assertEquals(RouterPathLookup.EXPLORE_HTTP_USER_SERVICE, result);
}
Aggregations