com.offbytwo.jenkins.client.JenkinsHttpClient Java Examples

The following examples show how to use com.offbytwo.jenkins.client.JenkinsHttpClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BentenJenkinsClient.java    From benten with MIT License 7 votes vote down vote up
@PostConstruct
public void init(){
    try{

        jenkins = new JenkinsServer(new URI(jenkinsProperties.getBaseurl()), jenkinsProperties.getUsername(), jenkinsProperties.getPassword());

        jenkinsHttpClient = new JenkinsHttpClient(new URI(jenkinsProperties.getBaseurl()),jenkinsProperties.getUsername(),jenkinsProperties.getPassword());

       // logger.info("Connection to Jenkins Server returned: " + jenkins.isRunning());
       // logger.info("Version returned from Jenkins http Client: " + jenkinsHttpClient.getJenkinsVersion());
    }catch (Exception e){
        logger.error("Failed to Connect to Jenkins Instance");
        e.printStackTrace();
    }

}
 
Example #2
Source File: JenkinsClient.java    From seppb with MIT License 4 votes vote down vote up
public JenkinsClient(JenkinsServer jenkinsServer, JenkinsHttpClient client) {
    this.jenkinsServer = jenkinsServer;
    this.client = client;
}
 
Example #3
Source File: JenkinsClient.java    From seppb with MIT License 4 votes vote down vote up
public JenkinsClient(String url, String username, String password, HttpClientBuilder builder) {
    this.client = new JenkinsHttpClient(URI.create(url), builder, username, password);
    this.jenkinsServer = new JenkinsServer(client);
}
 
Example #4
Source File: CustomJenkinsServer.java    From blueocean-plugin with MIT License 4 votes vote down vote up
public CustomJenkinsServer(URI serverUri, JenkinsUser admin) {
    super(serverUri, admin.username, admin.password);
    // since JenkinsServer's "client" is private, we must create another one
    // use authenticated client so that user's credentials can be accessed
    client = new JenkinsHttpClient(serverUri, admin.username, admin.password);
}
 
Example #5
Source File: JenkinsServerIntegration.java    From verigreen with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
    client = new JenkinsHttpClient(new URI("http://localhost:8080"));
    server = new JenkinsServer(client);
    executor = Executors.newCachedThreadPool();
}
 
Example #6
Source File: BaseModel.java    From verigreen with Apache License 2.0 4 votes vote down vote up
public JenkinsHttpClient getClient() {
    return client;
}
 
Example #7
Source File: BaseModel.java    From verigreen with Apache License 2.0 4 votes vote down vote up
public void setClient(JenkinsHttpClient client) {
    this.client = client;
}
 
Example #8
Source File: JenkinsServer.java    From verigreen with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new Jenkins server reference given only the server address
 *
 * @param serverUri address of jenkins server (ex. http://localhost:8080/jenkins)
 */
public JenkinsServer(URI serverUri) {
    this(new JenkinsHttpClient(serverUri));
}
 
Example #9
Source File: JenkinsServer.java    From verigreen with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new Jenkins server reference given the address and credentials
 *
 * @param serverUri address of jenkins server (ex. http://localhost:8080/jenkins)
 * @param username username to use when connecting
 * @param passwordOrToken password (not recommended) or token (recommended)
 */
public JenkinsServer(URI serverUri, String username, String passwordOrToken) {
    this(new JenkinsHttpClient(serverUri, username, passwordOrToken));
}
 
Example #10
Source File: JenkinsServer.java    From verigreen with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new Jenkins server directly from an HTTP client (ADVANCED)
 *
 * @param client Specialized client to use.
 */
public JenkinsServer(JenkinsHttpClient client) {
    this.client = client;
}