Search in sources :

Example 66 with HttpRequest

use of io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.

the class RouterPathTest method testRouterFlowPathLookUp.

@Test
public void testRouterFlowPathLookUp() throws Exception {
    String flowPath = "/v3/namespaces/default//apps/ResponseCodeAnalytics/flows/LogAnalyticsFlow/status";
    HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), flowPath);
    RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, flowPath, httpRequest);
    Assert.assertEquals(RouterPathLookup.APP_FABRIC_HTTP, result);
}
Also used : DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpRequest(io.netty.handler.codec.http.HttpRequest) DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpMethod(io.netty.handler.codec.http.HttpMethod) Test(org.junit.Test)

Example 67 with HttpRequest

use of io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.

the class RouterPathTest method testMetricsPath.

private void testMetricsPath(String path) {
    HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), path);
    RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, path, httpRequest);
    Assert.assertEquals(RouterPathLookup.METRICS, result);
}
Also used : DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpRequest(io.netty.handler.codec.http.HttpRequest) DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpMethod(io.netty.handler.codec.http.HttpMethod)

Example 68 with HttpRequest

use of io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.

the class RouterPathTest method testRouterFeedsLookup.

@Test
public void testRouterFeedsLookup() {
    final String namespacePath = "/v3//feeds/test";
    HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("PUT"), namespacePath);
    RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, namespacePath, httpRequest);
    Assert.assertEquals(null, result);
}
Also used : DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpRequest(io.netty.handler.codec.http.HttpRequest) DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpMethod(io.netty.handler.codec.http.HttpMethod) Test(org.junit.Test)

Example 69 with HttpRequest

use of io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.

the class RouterPathTest method testAppFabricPath.

@Test
public void testAppFabricPath() throws Exception {
    // Default destination for URIs will APP_FABRIC_HTTP
    String path = "/v3/ping/";
    HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), path);
    RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, path, httpRequest);
    Assert.assertEquals(RouterPathLookup.APP_FABRIC_HTTP, result);
    path = "/status";
    httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("GET"), path);
    result = pathLookup.getRoutingService(FALLBACKSERVICE, path, httpRequest);
    Assert.assertEquals(RouterPathLookup.APP_FABRIC_HTTP, result);
    path = "/v3/monitor///abcd/";
    httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("POST"), path);
    result = pathLookup.getRoutingService(FALLBACKSERVICE, path, httpRequest);
    Assert.assertEquals(RouterPathLookup.APP_FABRIC_HTTP, result);
}
Also used : DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpRequest(io.netty.handler.codec.http.HttpRequest) DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpMethod(io.netty.handler.codec.http.HttpMethod) Test(org.junit.Test)

Example 70 with HttpRequest

use of io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.

the class RouterPathTest method testRouterDeployPathLookUp.

@Test
public void testRouterDeployPathLookUp() throws Exception {
    String path = "/v3/namespaces/default//apps/";
    HttpRequest httpRequest = new DefaultHttpRequest(VERSION, new HttpMethod("PUT"), path);
    RouteDestination result = pathLookup.getRoutingService(FALLBACKSERVICE, path, httpRequest);
    Assert.assertEquals(RouterPathLookup.APP_FABRIC_HTTP, result);
}
Also used : DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpRequest(io.netty.handler.codec.http.HttpRequest) DefaultHttpRequest(io.netty.handler.codec.http.DefaultHttpRequest) HttpMethod(io.netty.handler.codec.http.HttpMethod) Test(org.junit.Test)

Aggregations

HttpRequest (io.netty.handler.codec.http.HttpRequest)292 DefaultHttpRequest (io.netty.handler.codec.http.DefaultHttpRequest)105 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)95 Test (org.junit.Test)86 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)67 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)53 HttpResponse (io.netty.handler.codec.http.HttpResponse)50 FullHttpResponse (io.netty.handler.codec.http.FullHttpResponse)38 ByteBuf (io.netty.buffer.ByteBuf)35 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)35 Test (org.junit.jupiter.api.Test)34 LastHttpContent (io.netty.handler.codec.http.LastHttpContent)31 HttpContent (io.netty.handler.codec.http.HttpContent)30 Channel (io.netty.channel.Channel)29 URI (java.net.URI)27 HttpMethod (io.netty.handler.codec.http.HttpMethod)26 DefaultFullHttpResponse (io.netty.handler.codec.http.DefaultFullHttpResponse)25 IOException (java.io.IOException)23 NioSocketChannel (io.netty.channel.socket.nio.NioSocketChannel)19 DefaultHttpHeaders (io.netty.handler.codec.http.DefaultHttpHeaders)19