Skip to content

Commit

Permalink
Fixed #220 Followup
Browse files Browse the repository at this point in the history
     o getViews() default api/json?depth=1 cause timeout
       but that change has caused in a failing integration
       test case which is now fixed by using tree=.. parameters.
  • Loading branch information
khmarbaise committed Feb 3, 2017
1 parent 330dcb6 commit 1ea3525
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
13 changes: 0 additions & 13 deletions jenkins-client-it-docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,7 @@
</plugin>
</plugins>
</build>
<properties>
<docker.container.network>http://127.0.0.1:8080</docker.container.network>
</properties>
<profiles>
<profile>
<activation>
<property>
<name>env.TRAVIS</name>
</property>
</activation>
<properties>
<docker.container.network>http://127.0.0.1:8080/</docker.container.network>
</properties>
</profile>
<profile>
<id>run-docker-its</id>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ public final class Constant {

/**
* The URL for the running Jenkins server (currently a Docker image). On
* travis it is localhost (127.0.0.1) on my machine it is different. At the
* moment it is solved by a profile in pom..but could that somehow
* identified by docker itself ?
* travis it is localhost (127.0.0.1).
*/
public static final URI JENKINS_URI = URI.create(System.getProperty("docker.container.network"));
public static final URI JENKINS_URI = URI.create("http://127.0.0.1:8080/");

}
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,12 @@ 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), MainView.class).getViews();
// This is much better than using &depth=2
// http://localhost:8080/api/json?pretty&tree=views[name,url,jobs[name,url]]
List<View> views = client.get(toBaseUrl(folder) + "?tree=views[name,url,jobs[name,url]]", MainView.class).getViews();
return Maps.uniqueIndex(views, new Function<View, String>() {
@Override
public String apply(View view) {

view.setClient(client);
// TODO: Think about the following? Does there exists a
// simpler/more elegant method?
Expand Down

0 comments on commit 1ea3525

Please sign in to comment.