use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.
the class AppFabricClient method getWorkerInstances.
public Instances getWorkerInstances(String namespaceId, String appId, String workerId) throws Exception {
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/worker/%s/instances", getNamespacePath(namespaceId), appId, workerId);
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri);
programLifecycleHttpHandler.getWorkerInstances(request, responder, namespaceId, appId, workerId);
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Get worker instances failed");
return responder.decodeResponseContent(Instances.class);
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.
the class AppFabricClient method getInfo.
public ApplicationDetail getInfo(ApplicationId appId) throws Exception {
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, String.format("%s/apps/%s", getNamespacePath(appId.getNamespace()), appId.getApplication()));
request.headers().set(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.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.
the class AppFabricClient method getWorkflowToken.
public WorkflowTokenNodeDetail getWorkflowToken(String namespaceId, String appId, String wflowId, String runId, String nodeName, @Nullable WorkflowToken.Scope scope, @Nullable String key) throws NotFoundException {
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/workflows/%s/runs/%s/nodes/%s/token", getNamespacePath(namespaceId), appId, wflowId, runId, nodeName);
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri);
scope = scope == null ? WorkflowToken.Scope.USER : scope;
key = key == null ? "" : key;
workflowHttpHandler.getWorkflowToken(request, responder, namespaceId, appId, wflowId, runId, nodeName, scope.name(), key);
Type workflowTokenNodeDetailType = new TypeToken<WorkflowTokenNodeDetail>() {
}.getType();
WorkflowTokenNodeDetail workflowTokenDetail = responder.decodeResponseContent(workflowTokenNodeDetailType, GSON);
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Getting workflow token at node failed");
return workflowTokenDetail;
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.
the class AppFabricClient method deleteAllApplications.
public void deleteAllApplications(NamespaceId namespaceId) throws Exception {
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.DELETE, String.format("%s/apps", getNamespacePath(namespaceId.getNamespace())));
request.headers().set(Constants.Gateway.API_KEY, "api-key-example");
MockResponder mockResponder = new MockResponder();
appLifecycleHttpHandler.deleteAllApps(request, mockResponder, namespaceId.getNamespace());
verifyResponse(HttpResponseStatus.OK, mockResponder.getStatus(), "Deleting all apps failed");
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest in project cdap by caskdata.
the class AppFabricClient method doGetHistory.
private List<RunRecord> doGetHistory(String namespace, String application, String applicationVersion, String programName, String categoryName, ProgramRunStatus status) throws Exception {
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/versions/%s/%s/runs?status=" + status.name(), getNamespacePath(namespace), application, applicationVersion, categoryName, programName);
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri);
programLifecycleHttpHandler.programHistory(request, responder, namespace, application, applicationVersion, categoryName, programName, status.name(), null, null, 100);
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Getting workflow history failed");
return responder.decodeResponseContent(RUN_RECORDS_TYPE);
}
Aggregations