use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project opentsdb by OpenTSDB.
the class TestTreeRpc method handleBranchBadMethod.
@Test(expected = BadRequestException.class)
public void handleBranchBadMethod() throws Exception {
final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.TRACE, "/api/tree/branch");
final HttpQuery query = new HttpQuery(tsdb, req, NettyMocks.fakeChannel());
rpc.execute(tsdb, query);
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project opentsdb by OpenTSDB.
the class TestTreeRpc method handleTreeBadMethod.
@Test(expected = BadRequestException.class)
public void handleTreeBadMethod() throws Exception {
final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.TRACE, "/api/tree");
final HttpQuery query = new HttpQuery(tsdb, req, NettyMocks.fakeChannel());
rpc.execute(tsdb, query);
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method getInfo.
public ApplicationDetail getInfo(ApplicationId appId) throws Exception {
DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, String.format("%s/apps/%s", getNamespacePath(appId.getNamespace()), appId.getApplication()));
request.setHeader(Constants.Gateway.API_KEY, "api-key-example");
MockResponder mockResponder = new MockResponder();
appLifecycleHttpHandler.getAppInfo(request, mockResponder, appId.getNamespace(), appId.getApplication());
verifyResponse(HttpResponseStatus.OK, mockResponder.getStatus(), "Getting app info failed");
return mockResponder.decodeResponseContent(new TypeToken<ApplicationDetail>() {
}.getType(), GSON);
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method getStatus.
public String getStatus(String namespaceId, String appId, String programId, ProgramType type) throws Exception {
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/%s/%s/status", getNamespacePath(namespaceId), appId, type, programId);
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri);
programLifecycleHttpHandler.getStatus(request, responder, namespaceId, appId, type.getCategoryName(), programId);
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Get status " + type + " failed");
Map<String, String> json = responder.decodeResponseContent(MAP_TYPE);
return json.get("status");
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method suspend.
public void suspend(String namespaceId, String appId, String scheduleName) throws Exception {
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/schedules/%s/suspend", getNamespacePath(namespaceId), appId, scheduleName);
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri);
programLifecycleHttpHandler.performAction(request, responder, namespaceId, appId, "schedules", scheduleName, "suspend");
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Suspend workflow schedules failed");
}
Aggregations