/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
@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(); } }
@Before public void setUp() throws Exception { client = new JenkinsHttpClient(new URI("http://localhost:8080")); server = new JenkinsServer(client); executor = Executors.newCachedThreadPool(); }