com.clarolab.bamboo.client.BambooServerClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bamboo-rest-api-client Show documentation
Show all versions of bamboo-rest-api-client Show documentation
This library allows to extract information from projects, plans and builds on Bamboo
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;
import org.apache.http.client.HttpResponseException;
@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 (HttpResponseException re) {
if(re.getStatusCode() == 401)
//It means that user should be authenticated, but the server is running
return true;
} catch (Exception e) {
log.info("There was an error trying to get information about bamboo server, or server is down.");
}
return false;
}
}