use of com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse in project cloudbreak by hortonworks.
the class StackCreationMock method addAmbariMappings.
public void addAmbariMappings(String clusterName) {
Map<String, CloudVmMetaDataStatus> instanceMap = getInstanceMap();
Service sparkService = getSparkService();
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/requests/:request", new AmbariStatusResponse());
sparkService.post(AMBARI_API_ROOT + "/views/:view/versions/1.0.0/instances/*", new EmptyAmbariResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters", (req, resp) -> {
ITResponse itResp = clusterCreated ? new AmbariClusterResponse(instanceMap, clusterName) : new EmptyAmbariClusterResponse();
return itResp.handle(req, resp);
});
sparkService.post(AMBARI_API_ROOT + "/clusters/:cluster/requests", new AmbariClusterRequestsResponse());
sparkService.post(AMBARI_API_ROOT + "/clusters/:cluster", (req, resp) -> {
clusterCreated = true;
return new EmptyAmbariResponse().handle(req, resp);
}, gson()::toJson);
sparkService.get(AMBARI_API_ROOT + "/clusters", new AmbariClusterResponse(instanceMap, clusterName));
sparkService.post(AMBARI_API_ROOT + "/clusters/:cluster/requests", new AmbariClusterRequestsResponse());
sparkService.post(AMBARI_API_ROOT + "/clusters/:cluster", new EmptyAmbariResponse());
sparkService.get(AMBARI_API_ROOT + "/services/AMBARI/components/AMBARI_SERVER", new AmbariServicesComponentsResponse(), gson()::toJson);
sparkService.get(AMBARI_API_ROOT + "/hosts", new AmbariHostsResponse(instanceMap), gson()::toJson);
sparkService.get(AMBARI_API_ROOT + "/blueprints/:blueprintname", (request, response) -> {
response.type("text/plain");
return responseFromJsonFile("blueprint/" + request.params("blueprintname") + ".bp");
});
sparkService.post(AMBARI_API_ROOT + "/blueprints/*", new EmptyAmbariResponse());
sparkService.put(AMBARI_API_ROOT + "/users/admin", new EmptyAmbariResponse());
sparkService.get(AMBARI_API_ROOT + "/check", new AmbariCheckResponse());
sparkService.post(AMBARI_API_ROOT + "/users", new EmptyAmbariResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts", new AmbariClustersHostsResponse(instanceMap, "SUCCESSFUL"));
sparkService.put(AMBARI_API_ROOT + "/stacks/HDP/versions/:version/operating_systems/:os/repositories/:hdpversion", new AmbariVersionDefinitionResponse());
sparkService.get(AMBARI_API_ROOT + "/version_definitions", new AmbariVersionDefinitionResponse());
sparkService.post(AMBARI_API_ROOT + "/version_definitions", new EmptyAmbariResponse());
}
use of com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse in project cloudbreak by hortonworks.
the class InstanceTerminationReplicationErrorMock method addAmbariMappings.
public void addAmbariMappings(String clusterName) {
Map<String, CloudVmMetaDataStatus> instanceMap = getInstanceMap();
Service sparkService = getSparkService();
int requestId = 100;
sparkService.delete(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname", new EmptyAmbariResponse());
sparkService.delete(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components/*", new EmptyAmbariResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components/*", new AmbariComponentStatusOnHostResponse());
sparkService.post(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests", new AmbariRequestIdRespone(requestId));
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests/100", new AmbariRequestStatusResponse(requestId, 100));
sparkService.put(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests/" + requestId, new EmptyAmbariClusterResponse());
sparkService.put(AMBARI_API_ROOT + "/clusters/" + clusterName + "/host_components", new AmbariStrRequestIdRespone(requestId));
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts", new AmbariHostComponentStateResponse(instanceMap));
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname", new AmbariHostResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters", new AmbariClusterResponse(instanceMap, clusterName));
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName, new AmbariClustersHostsResponse(instanceMap, "SUCCESSFUL"));
sparkService.post(AMBARI_API_ROOT + "/clusters/" + clusterName, new EmptyAmbariClusterResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components", new AmbariComponentStatusOnHostResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName + "/configurations/service_config_versions", new AmbariServiceConfigResponse(getMockServerAddress(), getMockPort()), gson()::toJson);
sparkService.get(AMBARI_API_ROOT + "/blueprints/:blueprintname", (request, response) -> {
response.type("text/plain");
return responseFromJsonFile("blueprint/" + request.params("blueprintname") + ".bp");
});
}
use of com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse in project cloudbreak by hortonworks.
the class InstanceTerminationReplicationMock method addAmbariMappings.
public void addAmbariMappings(String clusterName) {
Map<String, CloudVmMetaDataStatus> instanceMap = getInstanceMap();
Service sparkService = getSparkService();
int requestId = 100;
sparkService.delete(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname", new EmptyAmbariResponse());
sparkService.delete(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components/*", new EmptyAmbariResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components/*", new AmbariComponentStatusOnHostResponse());
sparkService.post(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests", new AmbariRequestIdRespone(requestId));
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests/100", new AmbariRequestStatusResponse(requestId, 100));
sparkService.put(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests/" + requestId, new EmptyAmbariClusterResponse());
sparkService.put(AMBARI_API_ROOT + "/clusters/" + clusterName + "/host_components", new AmbariStrRequestIdRespone(requestId));
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts", new AmbariHostComponentStateResponse(instanceMap));
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname", new AmbariHostResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters", new AmbariClusterResponse(instanceMap, clusterName));
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName, new AmbariClustersHostsResponse(instanceMap, "SUCCESSFUL"));
sparkService.post(AMBARI_API_ROOT + "/clusters/" + clusterName, new EmptyAmbariClusterResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components", new AmbariComponentStatusOnHostResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName + "/configurations/service_config_versions", new AmbariServiceConfigResponse(getMockServerAddress(), getMockPort()), gson()::toJson);
sparkService.get(AMBARI_API_ROOT + "/blueprints/:blueprintname", (request, response) -> {
response.type("text/plain");
return responseFromJsonFile("blueprint/" + request.params("blueprintname") + ".bp");
});
}
use of com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse in project cloudbreak by hortonworks.
the class InstanceTerminationUnknownMock method addAmbariMappings.
public void addAmbariMappings(String clusterName) {
Map<String, CloudVmMetaDataStatus> instanceMap = getInstanceMap();
Service sparkService = getSparkService();
int requestId = 100;
sparkService.delete(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname", new EmptyAmbariResponse());
sparkService.delete(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components/*", new EmptyAmbariResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components/*", new AmbariComponentStatusOnHostResponse());
sparkService.post(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests", new AmbariRequestIdRespone(requestId));
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests/100", new AmbariRequestStatusResponse(requestId, 100));
sparkService.put(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests/" + requestId, new EmptyAmbariClusterResponse());
sparkService.put(AMBARI_API_ROOT + "/clusters/" + clusterName + "/host_components", new AmbariStrRequestIdRespone(requestId));
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts", new AmbariHostComponentStateResponse(instanceMap));
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname", new AmbariHostResponse(AmbariHostResponse.UNKNOWN));
sparkService.get(AMBARI_API_ROOT + "/clusters", new AmbariClusterResponse(instanceMap, clusterName));
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName, new AmbariClustersHostsResponse(instanceMap, "SUCCESSFUL"));
sparkService.post(AMBARI_API_ROOT + "/clusters/" + clusterName, new EmptyAmbariClusterResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components", new AmbariComponentStatusOnHostResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName + "/configurations/service_config_versions", new AmbariServiceConfigResponse(getMockServerAddress(), getMockPort()), gson()::toJson);
sparkService.get(AMBARI_API_ROOT + "/blueprints/:blueprintname", (request, response) -> {
response.type("text/plain");
return responseFromJsonFile("blueprint/" + request.params("blueprintname") + ".bp");
});
}
use of com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse in project cloudbreak by hortonworks.
the class InstanceTerminationMock method addAmbariMappings.
public void addAmbariMappings(String clusterName) {
Map<String, CloudVmMetaDataStatus> instanceMap = getInstanceMap();
Service sparkService = getSparkService();
int requestId = 100;
sparkService.delete(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname", new EmptyAmbariResponse());
sparkService.delete(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components/*", new EmptyAmbariResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components/*", new AmbariComponentStatusOnHostResponse());
sparkService.post(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests", new AmbariRequestIdRespone(requestId));
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests/100", new AmbariRequestStatusResponse(requestId, 100));
sparkService.put(AMBARI_API_ROOT + "/clusters/" + clusterName + "/requests/" + requestId, new EmptyAmbariClusterResponse());
sparkService.put(AMBARI_API_ROOT + "/clusters/" + clusterName + "/host_components", new AmbariStrRequestIdRespone(requestId));
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts", new AmbariHostComponentStateResponse(instanceMap));
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname", new AmbariHostResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters", new AmbariClusterResponse(instanceMap, clusterName));
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName, new AmbariClustersHostsResponse(instanceMap, "SUCCESSFUL"));
sparkService.post(AMBARI_API_ROOT + "/clusters/" + clusterName, new EmptyAmbariClusterResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/:cluster/hosts/:hostname/host_components", new AmbariComponentStatusOnHostResponse());
sparkService.get(AMBARI_API_ROOT + "/clusters/" + clusterName + "/configurations/service_config_versions", new AmbariServiceConfigResponse(getMockServerAddress(), getMockPort()), gson()::toJson);
sparkService.get(AMBARI_API_ROOT + "/blueprints/:blueprintname", (request, response) -> {
response.type("text/plain");
return responseFromJsonFile("blueprint/" + request.params("blueprintname") + ".bp");
});
}
Aggregations