From 1ea35251a26d48b30e2d72409e43f890f7ac0870 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Fri, 3 Feb 2017 20:40:50 +0100 Subject: [PATCH] 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. --- jenkins-client-it-docker/pom.xml | 13 ------------- .../com/offbytwo/jenkins/integration/Constant.java | 6 ++---- .../java/com/offbytwo/jenkins/JenkinsServer.java | 5 +++-- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/jenkins-client-it-docker/pom.xml b/jenkins-client-it-docker/pom.xml index 977fb045..72752fee 100644 --- a/jenkins-client-it-docker/pom.xml +++ b/jenkins-client-it-docker/pom.xml @@ -102,20 +102,7 @@ - - http://127.0.0.1:8080 - - - - - env.TRAVIS - - - - http://127.0.0.1:8080/ - - run-docker-its diff --git a/jenkins-client-it-docker/src/test/java/com/offbytwo/jenkins/integration/Constant.java b/jenkins-client-it-docker/src/test/java/com/offbytwo/jenkins/integration/Constant.java index 12961c4e..400a85ac 100644 --- a/jenkins-client-it-docker/src/test/java/com/offbytwo/jenkins/integration/Constant.java +++ b/jenkins-client-it-docker/src/test/java/com/offbytwo/jenkins/integration/Constant.java @@ -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/"); } diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java index 0ae72b67..b9147ad3 100644 --- a/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java +++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java @@ -188,11 +188,12 @@ public Map getViews() throws IOException { * @throws IOException in case of an error. */ public Map getViews(FolderJob folder) throws IOException { - List 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 views = client.get(toBaseUrl(folder) + "?tree=views[name,url,jobs[name,url]]", MainView.class).getViews(); return Maps.uniqueIndex(views, new Function() { @Override public String apply(View view) { - view.setClient(client); // TODO: Think about the following? Does there exists a // simpler/more elegant method?