Examples of ApiHostsRequest


Examples of com.vmware.bdd.plugin.ambari.api.model.ApiHostsRequest

import com.vmware.bdd.plugin.ambari.api.utils.ApiUtils;

public class TestAmUtils {
   @Test
   public void testCreateInstallComponentRequest() {
      ApiHostsRequest request = AmUtils.createInstallComponentsRequest();
      String json = ApiUtils.objectToJson(request);
      System.out.println("Got json: " + json);
      String expectedString = "{\"Body\":{\"HostRoles\":{\"state\":\"INSTALLED\"}},\"RequestInfo\":{\"context\":\"Installing components\",\"query\":\"HostRoles/state=INIT\"}}";
//      Assert.assertTrue(json.equals(expectedString), "Should get: " + expectedString);
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.model.ApiHostsRequest

      return apiHostList;
   }

   public ApiRequest stopAllComponentsInHosts(String clusterName,
         List<String> hostNames) throws AmbariApiException {
      ApiHostsRequest hostsRequest = new ApiHostsRequest();
      ApiHostComponents apiComponents = new ApiHostComponents();
      hostsRequest.setBody(apiComponents);
      ApiComponentInfo hostRoles = new ApiComponentInfo();
      hostRoles.setState("INSTALLED");
      apiComponents.setHostRoles(hostRoles);
      ApiHostsRequestInfo requestInfo = new ApiHostsRequestInfo();
      hostsRequest.setRequestInfo(requestInfo);
      requestInfo.setContext("Stop Hosts components");

      StringBuilder builder = new StringBuilder();
      builder.append("HostRoles/host_name.in(");
      for (String hostName : hostNames) {
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.model.ApiHostsRequest

   }

   public ApiRequest startComponents(String clusterName,
         List<String> hostNames, List<String> components)
         throws AmbariApiException {
      ApiHostsRequest hostsRequest = new ApiHostsRequest();
      ApiHostComponents apiComponents = new ApiHostComponents();
      hostsRequest.setBody(apiComponents);
      ApiComponentInfo hostRoles = new ApiComponentInfo();
      hostRoles.setState("STARTED");
      apiComponents.setHostRoles(hostRoles);
      ApiHostsRequestInfo requestInfo = new ApiHostsRequestInfo();
      hostsRequest.setRequestInfo(requestInfo);
      requestInfo.setContext("Start Hosts components");

      StringBuilder builder = new StringBuilder();
      builder.append("HostRoles/host_name.in(");
      for (String hostName : hostNames) {
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.model.ApiHostsRequest

   }

   public void addComponents(String clusterName, List<String> hostNames,
         ApiHostComponents components) throws AmbariApiException {
      logger.info("Adding components to hosts: " + hostNames);
      ApiHostsRequest hostsRequest = new ApiHostsRequest();
      hostsRequest.setBody(components);
      ApiHostsRequestInfo requestInfo = new ApiHostsRequestInfo();
      hostsRequest.setRequestInfo(requestInfo);
      requestInfo.setContext("Adding components");

      StringBuilder builder = new StringBuilder();
      builder.append("Hosts/host_name.in(");
      for (String hostName : hostNames) {
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.model.ApiHostsRequest

      }
      handleAmbariResponse(response);
   }

   public ApiRequest installComponents(String clusterName) throws AmbariApiException {
      ApiHostsRequest hostsRequest = AmUtils.createInstallComponentsRequest();
      String json = ApiUtils.objectToJson(hostsRequest);
      logger.debug("install component json: " + json);
      Response response = null;
      try {
         response = apiResourceRootV1.getClustersResource()
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.model.ApiHostsRequest

      Pattern rackPattern = Pattern.compile("(/[a-zA-Z0-9\\.\\-\\_]+)+");
      return rackPattern.matcher(rack).matches();
   }

   public static ApiHostsRequest createInstallComponentsRequest() {
      ApiHostsRequest hostsRequest = new ApiHostsRequest();
      ApiHostComponents components = new ApiHostComponents();
      hostsRequest.setBody(components);
      ApiComponentInfo hostRoles = new ApiComponentInfo();
      hostRoles.setState("INSTALLED");
      components.setHostRoles(hostRoles);
      ApiHostsRequestInfo requestInfo = new ApiHostsRequestInfo();
      hostsRequest.setRequestInfo(requestInfo);
      requestInfo.setContext("Installing components");
      requestInfo.setQueryString("HostRoles/state=INIT");
      return hostsRequest;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.