com.clarolab.bamboo.client.BambooServerClient Maven / Gradle / Ivy
package com.clarolab.bamboo.client;
import com.clarolab.bamboo.entities.BambooInfo;
import com.clarolab.bamboo.utils.Constants;
import lombok.Builder;
import lombok.Data;
import lombok.extern.java.Log;
@Log
@Data
public class BambooServerClient extends BambooClient{
@Builder
public BambooServerClient(BambooApiClient bambooApiClient) {
super(bambooApiClient, Constants.AMOUNT_OF_ELEMENTS_TO_GET);
}
public String getServerVersion() throws Exception {
return perform(Constants.BAMBOO_INFO, BambooInfo.class).getVersion();
}
public boolean isServerRunning(){
try {
return perform(Constants.BAMBOO_INFO, BambooInfo.class).getState().toLowerCase().equals(Constants.BAMBOO_STATE_OK);
} catch (Exception e) {
log.info("There was an error trying to get information about bamboo server, or server is down.");
return false;
}
}
}