All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clarolab.bamboo.utils.Constants Maven / Gradle / Ivy

package com.clarolab.bamboo.utils;

public class Constants {

    public static final int DEFAULT_HTTP_MAX_RETRY= 5;
    public static final int AMOUNT_OF_ELEMENTS_TO_GET = 10;

    public static final String ADD_PARAMETER = "&";

    public static final String BAMBOO_STATE_OK = "running";

    public static final String BAMBOO_API = "/rest/api/latest";
    public static final String BAMBOO_AUTH_TYPE = "?os_authType=basic";

    public static final String BAMBOO_GENERAL_URL = "/browse/%s";

    public static final String BAMBOO_PLAN_OR_PROJECT_KEY_PLACEHOLDER = "/%s";

    public static final String LIMIT = "%%5B0:2%%5D";
    public static final String MAX_RESULTS = "%%5B:%d%%5D"; // equivalent to [:%d]
    public static final String LIMIT_START = "start-index=%d";
    public static final String LIMIT_MAX = "max-result=%d";
    public static final String LIMIT_RESULTS = ADD_PARAMETER + LIMIT_START + ADD_PARAMETER + LIMIT_MAX;

    public static final String BAMBOO_PROJECT = BAMBOO_API + "/project";
    public static final String BAMBOO_PLAN = BAMBOO_API + "/plan";
    public static final String BAMBOO_RESULT = BAMBOO_API + "/result";
    public static final String BAMBOO_INFO = BAMBOO_API + "/info";

    public static final String EXPAND_PROJECTS = "expand=projects.project";
    public static final String EXPAND_PLANS = "expand=plans.plan";
    //public static final String EXPAND_RESULTS = "expand=results" + MAX_RESULTS + ".result.artifacts";
    public static final String EXPAND_RESULTS = "expand=results.result.artifacts";
    public static final String EXPAND_RESULTS_WITH_STAGES = "expand=results.result.stages.stage.results.result.artifacts.artifacts";

    public static final String BAMBOO_EXPAND_PROJECT = BAMBOO_AUTH_TYPE + ADD_PARAMETER + EXPAND_PROJECTS;
    public static final String BAMBOO_EXPAND_PROJECT_WITH_LIMIT = BAMBOO_AUTH_TYPE + LIMIT_RESULTS + ADD_PARAMETER + EXPAND_PROJECTS;
    public static final String BAMBOO_EXPAND_PLAN = BAMBOO_AUTH_TYPE + ADD_PARAMETER + EXPAND_PLANS;
    public static final String BAMBOO_EXPAND_PLAN_WITH_LIMIT = BAMBOO_AUTH_TYPE + LIMIT_RESULTS + ADD_PARAMETER + EXPAND_PLANS;
    public static final String BAMBOO_EXPAND_RESULT = BAMBOO_AUTH_TYPE + ADD_PARAMETER + EXPAND_RESULTS + LIMIT_RESULTS;
    public static final String BAMBOO_EXPAND_RESULT_WITH_STAGES = BAMBOO_AUTH_TYPE + ADD_PARAMETER + EXPAND_RESULTS_WITH_STAGES + LIMIT_RESULTS;;

    public static final String BAMBOO_INFO_ENDPOINT = BAMBOO_INFO + BAMBOO_AUTH_TYPE;
    public static final String BAMBOO_PROJECT_SIZE_ENDPOINT = BAMBOO_PROJECT + BAMBOO_AUTH_TYPE + ADD_PARAMETER + String.format(LIMIT_MAX, 1);
    public static final String BAMBOO_PLAN_SIZE_ENDPOINT = BAMBOO_PLAN + BAMBOO_AUTH_TYPE + ADD_PARAMETER + String.format(LIMIT_MAX, 1);
    public static final String BAMBOO_PROJECT_ENDPOINT_LIMITED = BAMBOO_PROJECT + BAMBOO_EXPAND_PROJECT_WITH_LIMIT;
    public static final String BAMBOO_PROJECT_ENDPOINT = BAMBOO_PROJECT + BAMBOO_EXPAND_PROJECT;
    public static final String BAMBOO_PLAN_ENDPOINT = BAMBOO_PLAN + BAMBOO_EXPAND_PLAN;
    public static final String BAMBOO_PLAN_ENDPOINT_LIMITED = BAMBOO_PLAN + BAMBOO_EXPAND_PLAN_WITH_LIMIT;
    public static final String BAMBOO_RESULT_ENDPOINT = BAMBOO_RESULT + BAMBOO_PLAN_OR_PROJECT_KEY_PLACEHOLDER + BAMBOO_EXPAND_RESULT;
    public static final String BAMBOO_RESULT_WITH_STAGES_ENDPOINT = BAMBOO_RESULT + BAMBOO_PLAN_OR_PROJECT_KEY_PLACEHOLDER + BAMBOO_EXPAND_RESULT_WITH_STAGES;
//    public static StringBuilder getApiEndpoint(String url){
//        return UrlUtils.getEndpoint(url).append(JenkinsConstants.JENKINS_API_JSON_PRETTY_ENDPOINT);
//    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy