use of com.sequenceiq.ambari.client.AmbariClient in project cloudbreak by hortonworks.
the class AmbariHostsLeaveStatusCheckerTask method checkStatus.
@Override
public boolean checkStatus(AmbariHostsWithNames hosts) {
try {
AmbariClient ambariClient = hosts.getAmbariClient();
List<String> hostNames = hosts.getHostNames();
Map<String, String> hostStatuses = ambariClient.getHostStatuses();
for (String hostName : hostNames) {
String status = hostStatuses.get(hostName);
if (!LEFT_STATE.equals(status)) {
LOGGER.info("{} didn't leave the cluster yet", hostName);
return false;
}
}
} catch (Exception e) {
LOGGER.error("Failed to check the left hosts", e);
return false;
}
return true;
}
use of com.sequenceiq.ambari.client.AmbariClient in project cloudbreak by hortonworks.
the class ScalingUtil method getNodeCountAmbari.
public static int getNodeCountAmbari(StackEndpoint stackV1Endpoint, String port, String stackId, String ambariUser, String ambariPassword, IntegrationTestContext itContext) {
String ambariIp = CloudbreakUtil.getAmbariIp(stackV1Endpoint, stackId, itContext);
ServiceAndHostService ambariClient = new AmbariClient(ambariIp, port, ambariUser, ambariPassword);
return ambariClient.getClusterHosts().size();
}
use of com.sequenceiq.ambari.client.AmbariClient in project cloudbreak by hortonworks.
the class ScalingUtil method checkClusterScaled.
private static void checkClusterScaled(String ambariIp, String port, String ambariUser, String ambariPassword, int expectedNodeCount, StackResponse stackResponse) {
Assert.assertEquals(stackResponse.getCluster().getStatus(), Status.AVAILABLE, "The cluster hasn't been started!");
Assert.assertEquals(stackResponse.getStatus(), Status.AVAILABLE, "The stack hasn't been started!");
AmbariClient ambariClient = new AmbariClient(ambariIp, port, ambariUser, ambariPassword);
Assert.assertEquals(ambariClient.healthCheck(), "RUNNING", "The Ambari server is not running!");
Assert.assertEquals(expectedNodeCount, ambariClient.getClusterHosts().size(), "After scaling, the number of the nodes registered in ambari differs from the expected number!");
}
Aggregations