Search in sources :

Example 1 with AmbariServicesComponentsResponse

use of com.sequenceiq.it.spark.ambari.AmbariServicesComponentsResponse 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());
}
Also used : AmbariVersionDefinitionResponse(com.sequenceiq.it.spark.ambari.AmbariVersionDefinitionResponse) AmbariHostsResponse(com.sequenceiq.it.spark.ambari.AmbariHostsResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) Service(spark.Service) AmbariClusterRequestsResponse(com.sequenceiq.it.spark.ambari.AmbariClusterRequestsResponse) AmbariStatusResponse(com.sequenceiq.it.spark.ambari.AmbariStatusResponse) 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.AmbariClustersHostsResponse) AmbariServicesComponentsResponse(com.sequenceiq.it.spark.ambari.AmbariServicesComponentsResponse) ITResponse(com.sequenceiq.it.spark.ITResponse) AmbariCheckResponse(com.sequenceiq.it.spark.ambari.AmbariCheckResponse)

Example 2 with AmbariServicesComponentsResponse

use of com.sequenceiq.it.spark.ambari.AmbariServicesComponentsResponse in project cloudbreak by hortonworks.

the class MockClusterCreationWithSaltFailTest method addAmbariMappings.

private void addAmbariMappings(Map<String, CloudVmMetaDataStatus> instanceMap) {
    get(AMBARI_API_ROOT + "/clusters/:cluster/requests/:request", new AmbariStatusResponse());
    post(AMBARI_API_ROOT + "/views/:view/versions/1.0.0/instances/*", new EmptyAmbariResponse());
    get(AMBARI_API_ROOT + "/clusters", new AmbariClusterResponse(instanceMap));
    post(AMBARI_API_ROOT + "/clusters/:cluster/requests", new AmbariClusterRequestsResponse());
    post(AMBARI_API_ROOT + "/clusters/:cluster", new EmptyAmbariResponse(), gson()::toJson);
    get(AMBARI_API_ROOT + "/services/AMBARI/components/AMBARI_SERVER", new AmbariServicesComponentsResponse(), gson()::toJson);
    get(AMBARI_API_ROOT + "/hosts", new AmbariHostsResponse(instanceMap), gson()::toJson);
    get(AMBARI_API_ROOT + "/blueprints/*", new AmbariBlueprintsResponse());
    post(AMBARI_API_ROOT + "/blueprints/*", new EmptyAmbariResponse());
    put(AMBARI_API_ROOT + "/users/admin", new EmptyAmbariResponse());
    get(AMBARI_API_ROOT + "/check", new AmbariCheckResponse());
    get(AMBARI_API_ROOT + "/clusters/:cluster/hosts", new AmbariClustersHostsResponse(instanceMap, "SUCCESSFUL"));
}
Also used : AmbariStatusResponse(com.sequenceiq.it.spark.ambari.AmbariStatusResponse) EmptyAmbariResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariResponse) AmbariClusterResponse(com.sequenceiq.it.spark.ambari.AmbariClusterResponse) AmbariHostsResponse(com.sequenceiq.it.spark.ambari.AmbariHostsResponse) AmbariClustersHostsResponse(com.sequenceiq.it.spark.ambari.AmbariClustersHostsResponse) AmbariServicesComponentsResponse(com.sequenceiq.it.spark.ambari.AmbariServicesComponentsResponse) AmbariBlueprintsResponse(com.sequenceiq.it.spark.ambari.AmbariBlueprintsResponse) AmbariCheckResponse(com.sequenceiq.it.spark.ambari.AmbariCheckResponse) AmbariClusterRequestsResponse(com.sequenceiq.it.spark.ambari.AmbariClusterRequestsResponse)

Example 3 with AmbariServicesComponentsResponse

use of com.sequenceiq.it.spark.ambari.AmbariServicesComponentsResponse in project cloudbreak by hortonworks.

the class MockSparkServer method addAmbariMappings.

private static void addAmbariMappings(Map<String, CloudVmMetaDataStatus> instanceMap) {
    post(AMBARI_API_ROOT + "/views/:view/versions/1.0.0/instances/*", new EmptyAmbariResponse());
    get(AMBARI_API_ROOT + "/views/*", new AmbariViewResponse(MOCK_SERVER_ADDRESS));
    get(AMBARI_API_ROOT + "/clusters", new AmbariClusterResponse(instanceMap));
    get(AMBARI_API_ROOT + "/clusters/:cluster", (req, resp) -> {
        ITResponse itResp = CLUSTER_CREATED.contains(Integer.valueOf(req.params(":cluster"))) ? new AmbariClusterResponse(instanceMap) : new EmptyAmbariClusterResponse();
        return itResp.handle(req, resp);
    });
    get(AMBARI_API_ROOT + "/clusters/:cluster/hosts", new AmbariClustersHostsResponse(instanceMap, "SUCCESSFUL"));
    post(AMBARI_API_ROOT + "/clusters/:cluster/requests", new AmbariClusterRequestsResponse());
    get(AMBARI_API_ROOT + "/clusters/:cluster/requests/:request", new AmbariStatusResponse());
    post(AMBARI_API_ROOT + "/clusters/:cluster", (req, resp) -> {
        CLUSTER_CREATED.add(Integer.valueOf(req.params(":cluster")));
        return new EmptyAmbariResponse().handle(req, resp);
    }, GSON::toJson);
    get(AMBARI_API_ROOT + "/services/AMBARI/components/AMBARI_SERVER", new AmbariServicesComponentsResponse(), GSON::toJson);
    get(AMBARI_API_ROOT + "/hosts", new AmbariHostsResponse(instanceMap), GSON::toJson);
    get(AMBARI_API_ROOT + "/blueprints/:blueprintname", (request, response) -> {
        response.type("text/plain");
        return responseFromJsonFile("blueprint/" + request.params("blueprintname") + ".bp");
    });
    post(AMBARI_API_ROOT + "/blueprints/*", new EmptyAmbariResponse());
    put(AMBARI_API_ROOT + "/users/admin", new EmptyAmbariResponse());
    post(AMBARI_API_ROOT + "/users", new EmptyAmbariResponse());
    get(AMBARI_API_ROOT + "/check", new AmbariCheckResponse());
    put(AMBARI_API_ROOT + "/stacks/HDP/versions/:version/operating_systems/:os/repositories/:hdpversion", new EmptyAmbariResponse());
    get(AMBARI_API_ROOT + "/version_definitions", new AmbariVersionDefinitionResponse());
    post(AMBARI_API_ROOT + "/version_definitions", new EmptyAmbariResponse());
}
Also used : AmbariVersionDefinitionResponse(com.sequenceiq.it.spark.ambari.AmbariVersionDefinitionResponse) AmbariHostsResponse(com.sequenceiq.it.spark.ambari.AmbariHostsResponse) AmbariViewResponse(com.sequenceiq.it.spark.ambari.AmbariViewResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) AmbariClusterRequestsResponse(com.sequenceiq.it.spark.ambari.AmbariClusterRequestsResponse) AmbariStatusResponse(com.sequenceiq.it.spark.ambari.AmbariStatusResponse) EmptyAmbariResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariResponse) EmptyAmbariClusterResponse(com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse) AmbariClusterResponse(com.sequenceiq.it.spark.ambari.AmbariClusterResponse) AmbariClustersHostsResponse(com.sequenceiq.it.spark.ambari.AmbariClustersHostsResponse) AmbariServicesComponentsResponse(com.sequenceiq.it.spark.ambari.AmbariServicesComponentsResponse) AmbariCheckResponse(com.sequenceiq.it.spark.ambari.AmbariCheckResponse)

Aggregations

AmbariCheckResponse (com.sequenceiq.it.spark.ambari.AmbariCheckResponse)3 AmbariClusterRequestsResponse (com.sequenceiq.it.spark.ambari.AmbariClusterRequestsResponse)3 AmbariClusterResponse (com.sequenceiq.it.spark.ambari.AmbariClusterResponse)3 AmbariClustersHostsResponse (com.sequenceiq.it.spark.ambari.AmbariClustersHostsResponse)3 AmbariHostsResponse (com.sequenceiq.it.spark.ambari.AmbariHostsResponse)3 AmbariServicesComponentsResponse (com.sequenceiq.it.spark.ambari.AmbariServicesComponentsResponse)3 AmbariStatusResponse (com.sequenceiq.it.spark.ambari.AmbariStatusResponse)3 EmptyAmbariResponse (com.sequenceiq.it.spark.ambari.EmptyAmbariResponse)3 AmbariVersionDefinitionResponse (com.sequenceiq.it.spark.ambari.AmbariVersionDefinitionResponse)2 EmptyAmbariClusterResponse (com.sequenceiq.it.spark.ambari.EmptyAmbariClusterResponse)2 CloudVmMetaDataStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus)1 ITResponse (com.sequenceiq.it.spark.ITResponse)1 AmbariBlueprintsResponse (com.sequenceiq.it.spark.ambari.AmbariBlueprintsResponse)1 AmbariViewResponse (com.sequenceiq.it.spark.ambari.AmbariViewResponse)1 Service (spark.Service)1