diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-12-12 17:46:33 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-12-12 17:46:33 +0100 |
commit | c3730fc1cbad2f3747b14bab39beff90fbf66f72 (patch) | |
tree | 063092a45571f3dfede5e1727e120f0e02040cd3 /src/main/java/io | |
parent | 17f6eaadeb91057cb37309271c0b6e79439f64aa (diff) | |
download | esper-testing-c3730fc1cbad2f3747b14bab39beff90fbf66f72.tar.gz esper-testing-c3730fc1cbad2f3747b14bab39beff90fbf66f72.tar.bz2 esper-testing-c3730fc1cbad2f3747b14bab39beff90fbf66f72.tar.xz esper-testing-c3730fc1cbad2f3747b14bab39beff90fbf66f72.zip |
o Parsing out data from svn as well.
Diffstat (limited to 'src/main/java/io')
-rwxr-xr-x | src/main/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXml.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXml.java b/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXml.java index e80097b..169a65c 100755 --- a/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXml.java +++ b/src/main/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXml.java @@ -8,6 +8,7 @@ import org.jdom2.Element; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,6 +21,7 @@ import static fj.data.Option.none; import static fj.data.Option.some; import static fj.data.Option.somes; import static io.trygvis.esper.testing.Util.childText; +import static io.trygvis.esper.testing.Util.parseInt; import static io.trygvis.esper.testing.jenkins.JenkinsBuildXml.ChangeSetItemXml.parseChangeSetItem; import static io.trygvis.esper.testing.jenkins.JenkinsBuildXml.RevisionXml.parseRevision; @@ -120,13 +122,20 @@ public class JenkinsBuildXml { } private static final F<String, Option<DateTime>> parseDate = new F<String, Option<DateTime>>() { + // This variant is used by git DateTimeFormatter parser = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss Z"); + // and this by subversion + DateTimeFormatter parser2 = ISODateTimeFormat.dateTime(); public Option<DateTime> f(String s) { try { return some(parser.parseDateTime(s)); } catch (IllegalArgumentException e) { - return none(); + try { + return some(parser2.parseDateTime(s)); + } catch (IllegalArgumentException e2) { + return none(); + } } } }; @@ -150,9 +159,9 @@ public class JenkinsBuildXml { public static class RevisionXml { public final String module; - public final String revision; + public final int revision; - public RevisionXml(String module, String revision) { + public RevisionXml(String module, int revision) { this.module = module; this.revision = revision; } @@ -160,7 +169,7 @@ public class JenkinsBuildXml { public static final F<Element, Option<RevisionXml>> parseRevision = new F<Element, Option<RevisionXml>>() { public Option<RevisionXml> f(Element e) { Option<String> module = childText(e, "module"); - Option<String> revision = childText(e, "revision"); + Option<Integer> revision = childText(e, "revision").bind(parseInt); if (module.isNone() || revision.isNone()) { return none(); |