예제 #1
0
 public String retrieveDownloadVersionForJob(final String jobName)
     throws IOException, JSONException {
   releasePostfix = bookmakerConfig.getReleasePostfix();
   final String retrieveDownloadVersionsUrl =
       String.format(
           JENKINS_JOB_DOWNLOAD_VERSION_URL,
           bookmakerConfig.getHost(),
           bookmakerConfig.getPort(),
           jobName,
           releasePostfix);
   final String content = retrieveUrlContent(retrieveDownloadVersionsUrl);
   return retrieveDownloadVersionFromJson(content);
 }
예제 #2
0
 public List<String> retrieveJobNames() throws IOException, JSONException {
   releasePostfix = bookmakerConfig.getReleasePostfix();
   final List<String> jobNames = new ArrayList<>();
   final String content =
       retrieveUrlContent(
           String.format(JENKINS_JOBS_URL, bookmakerConfig.getHost(), bookmakerConfig.getPort()));
   final JSONObject json = new JSONObject(content);
   final JSONArray jobs = json.getJSONArray("jobs");
   for (int i = 0; i < jobs.length(); i++) {
     final JSONObject job = jobs.getJSONObject(i);
     final String jobName = job.getString("name");
     if (jobName.endsWith(releasePostfix)) {
       jobNames.add(job.getString("name").replace(releasePostfix, ""));
     }
   }
   return jobNames;
 }