diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-14 16:19:45 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-14 16:19:45 +0100 |
commit | 1ec9c1078e7b901ac19b649e2a21c8f0e1206ba3 (patch) | |
tree | a6d9e379f6d081644762a9b122b155b502671be2 | |
parent | 2baffc8c6a5aeef86a994c72d885f770f574a017 (diff) | |
download | esper-testing-1ec9c1078e7b901ac19b649e2a21c8f0e1206ba3.tar.gz esper-testing-1ec9c1078e7b901ac19b649e2a21c8f0e1206ba3.tar.bz2 esper-testing-1ec9c1078e7b901ac19b649e2a21c8f0e1206ba3.tar.xz esper-testing-1ec9c1078e7b901ac19b649e2a21c8f0e1206ba3.zip |
o More asserts in jenkins build xml parser.
-rwxr-xr-x | src/test/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXmlTest.java | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/test/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXmlTest.java b/src/test/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXmlTest.java index 62e27d2..29c8dac 100755 --- a/src/test/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXmlTest.java +++ b/src/test/java/io/trygvis/esper/testing/jenkins/JenkinsBuildXmlTest.java @@ -13,6 +13,7 @@ import io.trygvis.esper.testing.jenkins.xml.JenkinsBuildXml; import io.trygvis.esper.testing.util.XmlParser; import junit.framework.TestCase; +import static fj.data.Option.some; import static org.joda.time.DateTimeZone.forOffsetHours; import static org.joda.time.DateTimeZone.forOffsetHoursMinutes; import static org.joda.time.chrono.ISOChronology.getInstance; @@ -25,6 +26,11 @@ public class JenkinsBuildXmlTest extends TestCase { ISOChronology plus530 = getInstance(forOffsetHoursMinutes(5, 30)); ISOChronology utc = getInstanceUTC(); + Option<JenkinsBuildXml.AuthorXml> con = some(new JenkinsBuildXml.AuthorXml("http://ci.jruby.org/user/Charles%20Oliver%20Nutter", "Charles Oliver Nutter")); + Option<JenkinsBuildXml.AuthorXml> csonpatki = some(new JenkinsBuildXml.AuthorXml("http://ci.jruby.org/user/csonpatki", "csonpatki")); + Option<JenkinsBuildXml.AuthorXml> hasari = some(new JenkinsBuildXml.AuthorXml("http://ci.jruby.org/user/hasari", "Hiro Asari")); + Option<JenkinsBuildXml.AuthorXml> markrmiller = some(new JenkinsBuildXml.AuthorXml("https://builds.apache.org/user/markrmiller", "markrmiller")); + public Option<Document> f(InputStream inputStream) { return parser.parseDocument(inputStream); } @@ -45,14 +51,14 @@ public class JenkinsBuildXmlTest extends TestCase { assertTrue(changeSet.revision.isNone()); assertEquals(8, changeSet.items.size()); - assertItem(changeSet.items.get(0), "df6d3e8773dff6cc727a6ca4d8eaa8b5f970138d", "Add missing jnr-enxio to NB project.", new DateTime(2012, 12, 5, 10, 40, 58, 0, minus6)); - assertItem(changeSet.items.get(1), "54f6ce8c6e9a2c068c6b1bdfa096dcabb4e0ef1c", "Added description for vertexFor method", new DateTime(2012, 12, 5, 10, 56, 3, 0, plus530)); - assertItem(changeSet.items.get(2), "b6edf4a29157ef5ecd4e050c79f9353200ed0daf", "Added spec for allData method of DirectedGraph.java", new DateTime(2012, 12, 5, 10, 56, 3, 0, plus530)); - assertItem(changeSet.items.get(3), "9deef648a66d8fd4ed1b119419410b28492b87b4", "Added spec for removeEdge(Edge edge) method in DirectedGraph.java", new DateTime(2012, 12, 5, 11, 7, 34, 0, plus530)); - assertItem(changeSet.items.get(4), "9a3eb797ce136349f3866fc2ae9b35be360fb3df", "Added spec for getInorderData method of DirectedGraph.java", new DateTime(2012, 12, 5, 11, 20, 17, 0, plus530)); - assertItem(changeSet.items.get(5), "41b5de23dd2d7ccbc170252a43b8996316b93075", "No need to look up TZ here. In all cases leading up to here,", new DateTime(2012, 12, 6, 0, 5, 37, 0, minus5)); - assertItem(changeSet.items.get(6), "def4c054ae82848c92b015a3267ace2c2cedd193", "Identify the correct JIRA ticket.", new DateTime(2012, 12, 6, 0, 8, 8, 0, minus5)); - assertItem(changeSet.items.get(7), "82f12220d01c2c07398107fa5f5a2d50feb7c8c4", "As ugly as it might be, maintaining a map of exceptional time zone", new DateTime(2012, 12, 6, 0, 17, 26, 0, minus5)); + assertItem(changeSet.items.get(0), "df6d3e8773dff6cc727a6ca4d8eaa8b5f970138d", "Add missing jnr-enxio to NB project.", new DateTime(2012, 12, 5, 10, 40, 58, 0, minus6), con); + assertItem(changeSet.items.get(1), "54f6ce8c6e9a2c068c6b1bdfa096dcabb4e0ef1c", "Added description for vertexFor method", new DateTime(2012, 12, 5, 10, 56, 3, 0, plus530), csonpatki); + assertItem(changeSet.items.get(2), "b6edf4a29157ef5ecd4e050c79f9353200ed0daf", "Added spec for allData method of DirectedGraph.java", new DateTime(2012, 12, 5, 10, 56, 3, 0, plus530), csonpatki); + assertItem(changeSet.items.get(3), "9deef648a66d8fd4ed1b119419410b28492b87b4", "Added spec for removeEdge(Edge edge) method in DirectedGraph.java", new DateTime(2012, 12, 5, 11, 7, 34, 0, plus530), csonpatki); + assertItem(changeSet.items.get(4), "9a3eb797ce136349f3866fc2ae9b35be360fb3df", "Added spec for getInorderData method of DirectedGraph.java", new DateTime(2012, 12, 5, 11, 20, 17, 0, plus530), csonpatki); + assertItem(changeSet.items.get(5), "41b5de23dd2d7ccbc170252a43b8996316b93075", "No need to look up TZ here. In all cases leading up to here,", new DateTime(2012, 12, 6, 0, 5, 37, 0, minus5), hasari); + assertItem(changeSet.items.get(6), "def4c054ae82848c92b015a3267ace2c2cedd193", "Identify the correct JIRA ticket.", new DateTime(2012, 12, 6, 0, 8, 8, 0, minus5), hasari); + assertItem(changeSet.items.get(7), "82f12220d01c2c07398107fa5f5a2d50feb7c8c4", "As ugly as it might be, maintaining a map of exceptional time zone", new DateTime(2012, 12, 6, 0, 17, 26, 0, minus5), hasari); assertTrue(changeSet.items.get(0).author.isSome()); assertEquals("http://ci.jruby.org/user/Charles%20Oliver%20Nutter", changeSet.items.get(0).author.some().absoluteUrl); @@ -77,15 +83,21 @@ public class JenkinsBuildXmlTest extends TestCase { assertEquals(1419960, changeSet.revision.some().revision); assertEquals(3, changeSet.items.size()); - assertItem(changeSet.items.get(0), "1419960", "SOLR-2986: Add MoreLikeThis to warning about features that require uniqueKey. Also, change the warning to warn log level.", new DateTime(2012, 12, 11, 1, 8, 10, 682, utc)); - assertItem(changeSet.items.get(1), "1419953", "SOLR-4071: Validate that name is pass to Collections API create, and behave the same way as on startup when collection.configName is not explicitly passed.", new DateTime(2012, 12, 11, 0, 56, 19, 684, utc)); - assertItem(changeSet.items.get(2), "1419940", "SOLR-3948: Calculate/display deleted documents in admin interface.", new DateTime(2012, 12, 11, 0, 10, 12, 700, utc)); + assertItem(changeSet.items.get(0), "1419960", "SOLR-2986: Add MoreLikeThis to warning about features that require uniqueKey. Also, change the warning to warn log level.", new DateTime(2012, 12, 11, 1, 8, 10, 682, utc), markrmiller); + assertItem(changeSet.items.get(1), "1419953", "SOLR-4071: Validate that name is pass to Collections API create, and behave the same way as on startup when collection.configName is not explicitly passed.", new DateTime(2012, 12, 11, 0, 56, 19, 684, utc), markrmiller); + assertItem(changeSet.items.get(2), "1419940", "SOLR-3948: Calculate/display deleted documents in admin interface.", new DateTime(2012, 12, 11, 0, 10, 12, 700, utc), markrmiller); } } - private void assertItem(JenkinsBuildXml.ChangeSetItemXml item, String commitId, String msg, DateTime date) { + private void assertItem(JenkinsBuildXml.ChangeSetItemXml item, String commitId, String msg, DateTime date, Option<JenkinsBuildXml.AuthorXml> author) { assertEquals(commitId, item.commitId); assertEquals(msg, item.msg); assertEquals(date.toDateTime(item.date.getZone()), item.date); + + assertEquals("author.isSome()", author.isSome(), item.author.isSome()); + if(item.author.isSome()) { + assertEquals(author.some().absoluteUrl, item.author.some().absoluteUrl); + assertEquals(author.some().fullName, item.author.some().fullName); + } } } |