aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java9
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java18
2 files changed, 18 insertions, 9 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java b/src/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java
index 8ca2521..5b0619a 100755
--- a/src/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java
+++ b/src/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java
@@ -206,7 +206,8 @@ public class CoreResource extends AbstractResource {
protected final SqlF<BuildDto, BuildJson> getBuildJson = new SqlF<BuildDto, BuildJson>() {
public BuildJson apply(BuildDto dto) throws SQLException {
- return new BuildJson(dto.uuid, dto.createdDate, dto.timestamp, dto.success);
+ return new BuildJson(dto.uuid, dto.createdDate, dto.timestamp, dto.success, "jenkins",
+ dto.ref.uuid);
}
};
@@ -252,12 +253,16 @@ class BuildJson {
public final DateTime createdDate;
public final DateTime timestamp;
public final boolean success;
+ public final String serverType;
+ public final UUID buildUuid;
- public BuildJson(UUID uuid, DateTime createdDate, DateTime timestamp, boolean success) {
+ BuildJson(UUID uuid, DateTime createdDate, DateTime timestamp, boolean success, String serverType, UUID buildUuid) {
this.uuid = uuid;
this.createdDate = createdDate;
this.timestamp = timestamp;
this.success = success;
+ this.serverType = serverType;
+ this.buildUuid = buildUuid;
}
}
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 a6d8e8e..ff6b085 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
@@ -84,8 +84,10 @@ public class JenkinsResource extends AbstractResource {
return da.inTransaction(new JenkinsDaosCallback<List<JenkinsBuildJson>>() {
protected List<JenkinsBuildJson> run() throws SQLException {
List<JenkinsBuildJson> builds = new ArrayList<>();
- for (JenkinsBuildDto dto : daos.jenkinsDao.selectBuildByJob(job, page)) {
- builds.add(getJenkinsBuildJson.apply(dto));
+ if(job != null) {
+ for (JenkinsBuildDto dto : daos.jenkinsDao.selectBuildByJob(job, page)) {
+ builds.add(getJenkinsBuildJson.apply(dto));
+ }
}
return builds;
}
@@ -122,12 +124,12 @@ public class JenkinsResource extends AbstractResource {
}
}
- abstract class JenkinsDaosCallback<T> implements DatabaseAccess.DaosCallback<T> {
+ public static abstract class JenkinsDaosCallback<T> implements DatabaseAccess.DaosCallback<T> {
protected Daos daos;
protected abstract T run() throws SQLException;
- private final XmlParser xmlParser = new XmlParser();
+ private static final XmlParser xmlParser = new XmlParser();
public T run(Daos daos) throws SQLException {
this.daos = daos;
@@ -168,13 +170,13 @@ public class JenkinsResource extends AbstractResource {
bind(JenkinsBuildXml.parse);
if(xmlO.isNone()) {
- return new JenkinsBuildJson(dto.uuid, dto.createdDate, new DateTime(dto.createdDate),
+ return new JenkinsBuildJson(dto.uuid, dto.createdDate, dto.job, new DateTime(dto.createdDate),
"unknown", 0, 0);
}
JenkinsBuildXml xml = xmlO.some();
- return new JenkinsBuildJson(dto.uuid, dto.createdDate, new DateTime(xml.timestamp),
+ return new JenkinsBuildJson(dto.uuid, dto.createdDate, dto.job, new DateTime(xml.timestamp),
xml.result.orSome("unknown"), xml.number, xml.duration);
}
};
@@ -248,14 +250,16 @@ class JenkinsJobDetailJson {
class JenkinsBuildJson {
public final UUID uuid;
public final DateTime createdDate;
+ public final UUID job;
public final DateTime timestamp;
public final String result;
public final int number;
public final int duration;
- JenkinsBuildJson(UUID uuid, DateTime createdDate, DateTime timestamp, String result, int number, int duration) {
+ JenkinsBuildJson(UUID uuid, DateTime createdDate, UUID job, DateTime timestamp, String result, int number, int duration) {
this.uuid = uuid;
this.createdDate = createdDate;
+ this.job = job;
this.timestamp = timestamp;
this.result = result;
this.number = number;