use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method getPlugins.
public List<PluginInstanceDetail> getPlugins(ApplicationId application) throws Exception {
DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, String.format("%s/apps/%s", getNamespacePath(application.getNamespace()), application.getApplication()));
request.setHeader(Constants.Gateway.API_KEY, "api-key-example");
MockResponder mockResponder = new MockResponder();
appLifecycleHttpHandler.getPluginsInfo(request, mockResponder, application.getNamespace(), application.getApplication());
verifyResponse(HttpResponseStatus.OK, mockResponder.getStatus(), "Getting app info failed");
return mockResponder.decodeResponseContent(new TypeToken<List<PluginInstanceDetail>>() {
}.getType(), GSON);
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method deleteAllApplications.
public void deleteAllApplications(NamespaceId namespaceId) throws Exception {
DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.DELETE, String.format("%s/apps", getNamespacePath(namespaceId.getNamespace())));
request.setHeader(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.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method getWorkflowToken.
public WorkflowTokenDetail getWorkflowToken(String namespaceId, String appId, String wflowId, String runId, @Nullable WorkflowToken.Scope scope, @Nullable String key) throws NotFoundException {
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/workflows/%s/runs/%s/token", getNamespacePath(namespaceId), appId, wflowId, runId);
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, scope.name(), key);
Type workflowTokenDetailType = new TypeToken<WorkflowTokenDetail>() {
}.getType();
WorkflowTokenDetail workflowTokenDetail = responder.decodeResponseContent(workflowTokenDetailType, GSON);
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Getting workflow token failed");
return workflowTokenDetail;
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method getHistory.
public List<RunRecord> getHistory(Id.Program programId, ProgramRunStatus status) throws Exception {
String namespaceId = programId.getNamespaceId();
String appId = programId.getApplicationId();
String programName = programId.getId();
String categoryName = programId.getType().getCategoryName();
MockResponder responder = new MockResponder();
String uri = String.format("%s/apps/%s/%s/%s/runs?status=" + status.name(), getNamespacePath(namespaceId), appId, categoryName, programName);
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri);
programLifecycleHttpHandler.programHistory(request, responder, namespaceId, appId, categoryName, programName, status.name(), null, null, 100);
verifyResponse(HttpResponseStatus.OK, responder.getStatus(), "Getting workflow history failed");
return responder.decodeResponseContent(RUN_RECORDS_TYPE);
}
use of org.jboss.netty.handler.codec.http.DefaultHttpRequest in project cdap by caskdata.
the class AppFabricClient method deployApplication.
public void deployApplication(ApplicationId appId, AppRequest appRequest) throws Exception {
DefaultHttpRequest requst = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, String.format("%s/apps/%s/versions/%s/create", getNamespacePath(appId.getNamespace()), appId.getApplication(), appId.getVersion()));
createApplication(appId, requst, appRequest);
}
Aggregations