diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-12 11:03:21 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-12 11:25:28 +0100 |
commit | 19a0b028278652f3e48b2647ed71d8e7b9371939 (patch) | |
tree | c0c68b82297b99008930b1e4d7ca80ce807d174b /src | |
parent | 9be611045bc0eba133be8d318abac9042e9888c7 (diff) | |
download | esper-testing-19a0b028278652f3e48b2647ed71d8e7b9371939.tar.gz esper-testing-19a0b028278652f3e48b2647ed71d8e7b9371939.tar.bz2 esper-testing-19a0b028278652f3e48b2647ed71d8e7b9371939.tar.xz esper-testing-19a0b028278652f3e48b2647ed71d8e7b9371939.zip |
o Adding "name" to JenkinsServer.
Diffstat (limited to 'src')
5 files changed, 19 insertions, 6 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsDao.java b/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsDao.java index 9ecb78a..781df13 100755 --- a/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsDao.java +++ b/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsDao.java @@ -20,7 +20,7 @@ public class JenkinsDao { private final Connection c; - public static final String JENKINS_SERVER = "uuid, created_date, url, enabled"; + public static final String JENKINS_SERVER = "uuid, created_date, name, url, enabled"; public static final String JENKINS_JOB = "uuid, created_date, server, file, url, job_type, display_name"; @@ -36,6 +36,7 @@ public class JenkinsDao { return new JenkinsServerDto( UUID.fromString(rs.getString(i++)), new DateTime(rs.getTimestamp(i++).getTime()), + rs.getString(i++), URI.create(rs.getString(i++)), rs.getBoolean(i)); } diff --git a/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsImporter.java b/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsImporter.java index fb72a99..a5308f5 100644 --- a/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsImporter.java +++ b/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsImporter.java @@ -1,6 +1,7 @@ package io.trygvis.esper.testing.jenkins; import com.jolbox.bonecp.*; +import fj.data.*; import io.trygvis.esper.testing.*; import io.trygvis.esper.testing.util.object.*; import io.trygvis.esper.testing.util.*; @@ -8,7 +9,7 @@ import org.apache.abdera.*; import org.codehaus.httpcache4j.cache.*; import java.sql.*; -import java.util.*; +import java.util.HashSet; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -28,7 +29,7 @@ public class JenkinsImporter { ObjectManager<JenkinsServerDto, ActorRef<JenkinsServerActor>> serverManager = new ObjectManager<>("JenkinsServerOld", servers, new ObjectFactory<JenkinsServerDto, ActorRef<JenkinsServerActor>>() { public ActorRef<JenkinsServerActor> create(JenkinsServerDto server) { - String name = "Jenkins: " + server.url; + String name = "Jenkins: " + Option.fromNull(server.name).orSome(server.url.toASCIIString()); return threadedActor(name, config.jenkinsUpdateInterval, boneCp, name, new JenkinsServerActor(jenkinsClient, server)); } }); diff --git a/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsServerDto.java b/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsServerDto.java index 8195f01..d85554d 100755 --- a/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsServerDto.java +++ b/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsServerDto.java @@ -7,11 +7,13 @@ import java.net.*; import java.util.*; public class JenkinsServerDto extends AbstractEntity { + public final String name; public final URI url; public final boolean enabled; - JenkinsServerDto(UUID uuid, DateTime createdDate, URI url, boolean enabled) { + public JenkinsServerDto(UUID uuid, DateTime createdDate, String name, URI url, boolean enabled) { super(uuid, createdDate); + this.name = name; this.url = url; this.enabled = enabled; } diff --git a/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java b/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java index 3169096..21bfe19 100755 --- a/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java +++ b/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java @@ -132,7 +132,7 @@ public class JenkinsResource extends AbstractResource { jobs.add(getJenkinsJobJson.apply(jobDto)); } - return new JenkinsServerJson(server.uuid, server.createdDate, server.url, server.enabled, count, jobs); + return new JenkinsServerJson(server.uuid, server.createdDate, server.name, server.url, server.enabled, count, jobs); } }; @@ -191,14 +191,16 @@ public class JenkinsResource extends AbstractResource { class JenkinsServerJson { public final UUID uuid; public final DateTime createdDate; + public final String name; public final URI url; public final boolean enabled; public final int jobCount; public final List<JenkinsJobJson> recentJobs; - JenkinsServerJson(UUID uuid, DateTime createdDate, URI url, boolean enabled, int jobCount, List<JenkinsJobJson> recentJobs) { + JenkinsServerJson(UUID uuid, DateTime createdDate, String name, URI url, boolean enabled, int jobCount, List<JenkinsJobJson> recentJobs) { this.uuid = uuid; this.createdDate = createdDate; + this.name = name; this.url = url; this.enabled = enabled; this.jobCount = jobCount; diff --git a/src/main/sql/dbdelta/3-jenkins_server-add-name.sql b/src/main/sql/dbdelta/3-jenkins_server-add-name.sql new file mode 100644 index 0000000..4d6a58f --- /dev/null +++ b/src/main/sql/dbdelta/3-jenkins_server-add-name.sql @@ -0,0 +1,7 @@ +ALTER TABLE jenkins_server ADD name VARCHAR(100); + +UPDATE jenkins_server SET name = regexp_replace(url, '^https?://([^/]*).*', '\1'); + +--//@UNDO + +ALTER TABLE jenkins_server DROP name; |