Search in sources :

Example 1 with AmbariStrRequestIdRespone

use of com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone 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");
    });
}
Also used : AmbariHostResponse(com.sequenceiq.it.spark.ambari.v2.AmbariHostResponse) AmbariComponentStatusOnHostResponse(com.sequenceiq.it.spark.ambari.AmbariComponentStatusOnHostResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) Service(spark.Service) AmbariRequestStatusResponse(com.sequenceiq.it.spark.ambari.v2.AmbariRequestStatusResponse) AmbariStrRequestIdRespone(com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone) AmbariRequestIdRespone(com.sequenceiq.it.spark.ambari.v2.AmbariRequestIdRespone) EmptyAmbariResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) AmbariClusterResponse(com.sequenceiq.it.spark.ambari.AmbariClusterResponse) CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus) AmbariClustersHostsResponse(com.sequenceiq.it.spark.ambari.v2.AmbariClustersHostsResponse) AmbariServiceConfigResponse(com.sequenceiq.it.spark.ambari.AmbariServiceConfigResponse) AmbariHostComponentStateResponse(com.sequenceiq.it.spark.ambari.v2.AmbariHostComponentStateResponse)

Example 2 with AmbariStrRequestIdRespone

use of com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone 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");
    });
}
Also used : AmbariHostResponse(com.sequenceiq.it.spark.ambari.v2.AmbariHostResponse) AmbariComponentStatusOnHostResponse(com.sequenceiq.it.spark.ambari.AmbariComponentStatusOnHostResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) Service(spark.Service) AmbariRequestStatusResponse(com.sequenceiq.it.spark.ambari.v2.AmbariRequestStatusResponse) AmbariStrRequestIdRespone(com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone) AmbariRequestIdRespone(com.sequenceiq.it.spark.ambari.v2.AmbariRequestIdRespone) EmptyAmbariResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) AmbariClusterResponse(com.sequenceiq.it.spark.ambari.AmbariClusterResponse) CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus) AmbariClustersHostsResponse(com.sequenceiq.it.spark.ambari.v2.AmbariClustersHostsResponse) AmbariServiceConfigResponse(com.sequenceiq.it.spark.ambari.AmbariServiceConfigResponse) AmbariHostComponentStateResponse(com.sequenceiq.it.spark.ambari.v2.AmbariHostComponentStateResponse)

Example 3 with AmbariStrRequestIdRespone

use of com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone 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");
    });
}
Also used : AmbariHostResponse(com.sequenceiq.it.spark.ambari.v2.AmbariHostResponse) AmbariComponentStatusOnHostResponse(com.sequenceiq.it.spark.ambari.AmbariComponentStatusOnHostResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) Service(spark.Service) AmbariRequestStatusResponse(com.sequenceiq.it.spark.ambari.v2.AmbariRequestStatusResponse) AmbariStrRequestIdRespone(com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone) AmbariRequestIdRespone(com.sequenceiq.it.spark.ambari.v2.AmbariRequestIdRespone) EmptyAmbariResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) AmbariClusterResponse(com.sequenceiq.it.spark.ambari.AmbariClusterResponse) CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus) AmbariClustersHostsResponse(com.sequenceiq.it.spark.ambari.v2.AmbariClustersHostsResponse) AmbariServiceConfigResponse(com.sequenceiq.it.spark.ambari.AmbariServiceConfigResponse) AmbariHostComponentStateResponse(com.sequenceiq.it.spark.ambari.v2.AmbariHostComponentStateResponse)

Example 4 with AmbariStrRequestIdRespone

use of com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone 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");
    });
}
Also used : AmbariHostResponse(com.sequenceiq.it.spark.ambari.v2.AmbariHostResponse) AmbariComponentStatusOnHostResponse(com.sequenceiq.it.spark.ambari.AmbariComponentStatusOnHostResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) Service(spark.Service) AmbariRequestStatusResponse(com.sequenceiq.it.spark.ambari.v2.AmbariRequestStatusResponse) AmbariStrRequestIdRespone(com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone) AmbariRequestIdRespone(com.sequenceiq.it.spark.ambari.v2.AmbariRequestIdRespone) EmptyAmbariResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) AmbariClusterResponse(com.sequenceiq.it.spark.ambari.AmbariClusterResponse) CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus) AmbariClustersHostsResponse(com.sequenceiq.it.spark.ambari.v2.AmbariClustersHostsResponse) AmbariServiceConfigResponse(com.sequenceiq.it.spark.ambari.AmbariServiceConfigResponse) AmbariHostComponentStateResponse(com.sequenceiq.it.spark.ambari.v2.AmbariHostComponentStateResponse)

Aggregations

CloudVmMetaDataStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus)4 AmbariClusterResponse (com.sequenceiq.it.spark.ambari.AmbariClusterResponse)4 AmbariComponentStatusOnHostResponse (com.sequenceiq.it.spark.ambari.AmbariComponentStatusOnHostResponse)4 AmbariServiceConfigResponse (com.sequenceiq.it.spark.ambari.AmbariServiceConfigResponse)4 EmptyAmbariClusterResponse (com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse)4 EmptyAmbariResponse (com.sequenceiq.it.spark.ambari.EmptyAmbariResponse)4 AmbariClustersHostsResponse (com.sequenceiq.it.spark.ambari.v2.AmbariClustersHostsResponse)4 AmbariHostComponentStateResponse (com.sequenceiq.it.spark.ambari.v2.AmbariHostComponentStateResponse)4 AmbariHostResponse (com.sequenceiq.it.spark.ambari.v2.AmbariHostResponse)4 AmbariRequestIdRespone (com.sequenceiq.it.spark.ambari.v2.AmbariRequestIdRespone)4 AmbariRequestStatusResponse (com.sequenceiq.it.spark.ambari.v2.AmbariRequestStatusResponse)4 AmbariStrRequestIdRespone (com.sequenceiq.it.spark.ambari.v2.AmbariStrRequestIdRespone)4 Service (spark.Service)4