Skip to content

Commit 1ea3525

Browse files
committed
Fixed #220 Followup
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.
1 parent 330dcb6 commit 1ea3525

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

jenkins-client-it-docker/pom.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,7 @@
102102
</plugin>
103103
</plugins>
104104
</build>
105-
<properties>
106-
<docker.container.network>http://127.0.0.1:8080</docker.container.network>
107-
</properties>
108105
<profiles>
109-
<profile>
110-
<activation>
111-
<property>
112-
<name>env.TRAVIS</name>
113-
</property>
114-
</activation>
115-
<properties>
116-
<docker.container.network>http://127.0.0.1:8080/</docker.container.network>
117-
</properties>
118-
</profile>
119106
<profile>
120107
<id>run-docker-its</id>
121108
<build>

jenkins-client-it-docker/src/test/java/com/offbytwo/jenkins/integration/Constant.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ public final class Constant {
66

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

1513
}

jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ public Map<String, View> getViews() throws IOException {
188188
* @throws IOException in case of an error.
189189
*/
190190
public Map<String, View> getViews(FolderJob folder) throws IOException {
191-
List<View> views = client.get(toBaseUrl(folder), MainView.class).getViews();
191+
// This is much better than using &depth=2
192+
// http://localhost:8080/api/json?pretty&tree=views[name,url,jobs[name,url]]
193+
List<View> views = client.get(toBaseUrl(folder) + "?tree=views[name,url,jobs[name,url]]", MainView.class).getViews();
192194
return Maps.uniqueIndex(views, new Function<View, String>() {
193195
@Override
194196
public String apply(View view) {
195-
196197
view.setClient(client);
197198
// TODO: Think about the following? Does there exists a
198199
// simpler/more elegant method?

0 commit comments

Comments
 (0)