Skip to content

Commit

Permalink
Fixed #220
Browse files Browse the repository at this point in the history
 o getViews() default api/json?depth=1 cause timeout
  • Loading branch information
khmarbaise committed Jan 2, 2017
1 parent 02caf94 commit 49fb2af
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
6 changes: 5 additions & 1 deletion ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## Release 0.3.8 (NOT RELEASED YET)

* ?
* [Fixed Issue 220][issue-220]

`getViews()` Do not use `api/json?depth=1` cause timeout.


### API Changes

Expand Down Expand Up @@ -949,6 +952,7 @@ TestReport testReport = mavenJob.getLastSuccessfulBuild().getTestReport();
[issue-209]: https://github.com/jenkinsci/java-client-api/issues/209
[issue-211]: https://github.com/jenkinsci/java-client-api/issues/211
[issue-215]: https://github.com/jenkinsci/java-client-api/issues/215
[issue-220]: https://github.com/jenkinsci/java-client-api/issues/220
[pull-123]: https://github.com/jenkinsci/java-client-api/pull/123
[pull-149]: https://github.com/jenkinsci/java-client-api/pull/149
[pull-158]: https://github.com/jenkinsci/java-client-api/pull/158
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public Map<String, View> getViews() throws IOException {
* @throws IOException in case of an error.
*/
public Map<String, View> getViews(FolderJob folder) throws IOException {
List<View> views = client.get(toBaseUrl(folder) + "?depth=1", MainView.class).getViews();
List<View> views = client.get(toBaseUrl(folder), MainView.class).getViews();
return Maps.uniqueIndex(views, new Function<View, String>() {
@Override
public String apply(View view) {
Expand All @@ -203,7 +203,6 @@ public String apply(View view) {
item.setClient(client);
}

// return view.getName().toLowerCase();
return view.getName();
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
package com.offbytwo.jenkins;

import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.junit.Ignore;
import org.junit.Test;

import com.offbytwo.jenkins.model.Build;
import com.offbytwo.jenkins.model.JobWithDetails;
import com.offbytwo.jenkins.model.TestReport;
import com.offbytwo.jenkins.model.TestResult;
import com.offbytwo.jenkins.model.TestSuites;
import com.offbytwo.jenkins.model.View;

public class JenkinsTestManualTestReport {

@Test
@Ignore
public void firstTest() throws Exception {

JenkinsServer js = new JenkinsServer(URI.create("http://localhost:10090/buildserver/"), "admin", "admin");
Expand All @@ -37,4 +42,15 @@ public void firstTest() throws Exception {
List<TestSuites> suites = testResult.getSuites();

}

@Test
public void anotherTest() throws IOException {
JenkinsServer js = new JenkinsServer(URI.create("http://localhost:10090/buildserver/"), "admin", "admin");
Map<String, View> views = js.getViews();
for (Entry<String, View> item : views.entrySet()) {
View value = item.getValue();
System.out.println("URL: " + value.getUrl());
}

}
}

0 comments on commit 49fb2af

Please sign in to comment.