diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java | 26 | ||||
-rw-r--r-- | src/test/resources/gitorious/esper-test-project.atom | 120 |
2 files changed, 146 insertions, 0 deletions
diff --git a/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java b/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java index 2d5945e..a6ba2f7 100644 --- a/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java +++ b/src/test/java/io/trygvis/esper/testing/gitorious/TestXmlParsing.java @@ -1,10 +1,12 @@ package io.trygvis.esper.testing.gitorious; +import fj.data.*; import junit.framework.*; import org.dom4j.*; import java.io.*; import java.util.*; +import java.util.List; public class TestXmlParsing extends TestCase { public void testProjectParsing() throws Exception { @@ -21,4 +23,28 @@ public class TestXmlParsing extends TestCase { assertEquals(2, project.repositories.size()); } } + + public void testEventParsing() throws Exception { + GitoriousAtomFeedParser parser = new GitoriousAtomFeedParser(); + try (InputStream stream = getClass().getResourceAsStream("/gitorious/esper-test-project.atom")) { + + List<GitoriousEvent> events = parser.parseStream(stream, Option.<Date>none(), "esper-test-project", "esper-test-project"); + + assertEquals(5, events.size()); + + GitoriousPush p0 = (GitoriousPush) events.get(0); + assertEquals("tag:gitorious.org,2005:Event/43390557", p0.entryId); + assertEquals("trygvis", p0.who); + assertEquals("dd6f41a45587f3f4d81ba7c0a874fcaf94e67365", p0.from); + assertEquals("0d3de9c126c6f84e46e3f92244b4d99a4a3a3aa5", p0.to); + assertEquals("my-branch", p0.branch); + + GitoriousPush p3 = (GitoriousPush) events.get(3); + assertEquals("tag:gitorious.org,2005:Event/43390409", p3.entryId); + assertEquals("trygvis", p3.who); + assertEquals("7054468bc18ae6e66aeccecc87896a90b21f2101", p3.from); + assertEquals("4aa8a70c00a9527035e3f9b2fb69bbc4779aa090", p3.to); + assertEquals("master", p3.branch); + } + } } diff --git a/src/test/resources/gitorious/esper-test-project.atom b/src/test/resources/gitorious/esper-test-project.atom new file mode 100644 index 0000000..44d9113 --- /dev/null +++ b/src/test/resources/gitorious/esper-test-project.atom @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:gts="http://gitorious.org/schema"> + <id>tag:gitorious.org,2005:/esper-test-project/esper-test-project</id> + <link type="text/html" rel="alternate" href="http://gitorious.org"/> + <link type="application/atom+xml" rel="self" href="http://gitorious.org/esper-test-project/esper-test-project.atom"/> + <title>Gitorious: esper-test-project/esper-test-project activity</title> + <updated>2012-11-09T14:06:33Z</updated> + <entry> + <id>tag:gitorious.org,2005:Event/43390557</id> + <published>2012-11-09T14:06:33Z</published> + <updated>2012-11-09T14:06:33Z</updated> + <link type="text/html" rel="alternate" href="http://gitorious.org/esper-test-project/esper-test-project/commits"/> + <title>Trygve Laugstøl pushed 1 commit to esper-test-project/esper-test-project:my-branch. View diff</title> + <content type="html"><p><a href="/~trygvis">trygvis</a> pushed <a href="/esper-test-project/esper-test-project/commits/my-branch" class="commit_event_toggler" gts:id="43390557" gts:url="/events/43390557/commits" id="commits_in_event_43390557_toggler">1 commit</a> to <a href="/esper-test-project/esper-test-project/commits/my-branch">esper-test-project/esper-test-project:my-branch</a>. <a href="/esper-test-project/esper-test-project/commit/dd6f41a45587f3f4d81ba7c0a874fcaf94e67365/diffs/0d3de9c126c6f84e46e3f92244b4d99a4a3a3aa5">View diff</a></p> +<p>my-branch changed from dd6f41a to 0d3de9c<p> +<p></p> +</content> + <author> + <name>Trygve Laugstøl</name> + </author> + </entry> + <entry> + <id>tag:gitorious.org,2005:Event/43390538</id> + <published>2012-11-09T13:58:05Z</published> + <updated>2012-11-09T13:58:05Z</updated> + <link type="text/html" rel="alternate" href="http://gitorious.org/esper-test-project/esper-test-project/commits"/> + <title>Trygve Laugstøl created branch my-branch on esper-test-project/esper-test-project</title> + <content type="html"><p><a href="/~trygvis">trygvis</a> created branch <a href="/esper-test-project/esper-test-project/commits/my-branch">my-branch</a> on <a href="/esper-test-project">esper-test-project</a>/<a href="http://gitorious.org/esper-test-project/esper-test-project">esper-test-project</a></p> +<p><p> +<p></p> +</content> + <author> + <name>Trygve Laugstøl</name> + </author> + </entry> + <entry> + <id>tag:gitorious.org,2005:Event/43390537</id> + <published>2012-11-09T13:57:31Z</published> + <updated>2012-11-09T13:57:31Z</updated> + <link type="text/html" rel="alternate" href="http://gitorious.org/esper-test-project/esper-test-project/commits"/> + <title>Trygve Laugstøl pushed 1 commit to esper-test-project/esper-test-project:master. View diff</title> + <content type="html"><p><a href="/~trygvis">trygvis</a> pushed <a href="/esper-test-project/esper-test-project/commits/master" class="commit_event_toggler" gts:id="43390537" gts:url="/events/43390537/commits" id="commits_in_event_43390537_toggler">1 commit</a> to <a href="/esper-test-project/esper-test-project/commits/master">esper-test-project/esper-test-project:master</a>. <a href="/esper-test-project/esper-test-project/commit/776cb0a8b1c8f56cb0f2ec919bee87665bfdc3b7/diffs/3f0ef74c1a660e9adc7d9b6668de657bdabe245a">View diff</a></p> +<p>master changed from 776cb0a to 3f0ef74<p> +<p></p> +</content> + <author> + <name>Trygve Laugstøl</name> + </author> + </entry> + <entry> + <id>tag:gitorious.org,2005:Event/43390416</id> + <published>2012-11-09T12:26:09Z</published> + <updated>2012-11-09T12:26:09Z</updated> + <link type="text/html" rel="alternate" href="http://gitorious.org/esper-test-project/esper-test-project/commits"/> + <title>Trygve Laugstøl pushed 1 commit to esper-test-project/esper-test-project:master. View diff</title> + <content type="html"><p><a href="/~trygvis">trygvis</a> pushed <a href="/esper-test-project/esper-test-project/commits/master" class="commit_event_toggler" gts:id="43390416" gts:url="/events/43390416/commits" id="commits_in_event_43390416_toggler">1 commit</a> to <a href="/esper-test-project/esper-test-project/commits/master">esper-test-project/esper-test-project:master</a>. <a href="/esper-test-project/esper-test-project/commit/4aa8a70c00a9527035e3f9b2fb69bbc4779aa090/diffs/776cb0a8b1c8f56cb0f2ec919bee87665bfdc3b7">View diff</a></p> +<p>master changed from 4aa8a70 to 776cb0a<p> +<p></p> +</content> + <author> + <name>Trygve Laugstøl</name> + </author> + </entry> + <entry> + <id>tag:gitorious.org,2005:Event/43390409</id> + <published>2012-11-09T12:22:07Z</published> + <updated>2012-11-09T12:22:07Z</updated> + <link type="text/html" rel="alternate" href="http://gitorious.org/esper-test-project/esper-test-project/commits"/> + <title>Trygve Laugstøl pushed 3 commits to esper-test-project/esper-test-project:master. View diff</title> + <content type="html"><p><a href="/~trygvis">trygvis</a> pushed <a href="/esper-test-project/esper-test-project/commits/master" class="commit_event_toggler" gts:id="43390409" gts:url="/events/43390409/commits" id="commits_in_event_43390409_toggler">3 commits</a> to <a href="/esper-test-project/esper-test-project/commits/master">esper-test-project/esper-test-project:master</a>. <a href="/esper-test-project/esper-test-project/commit/7054468bc18ae6e66aeccecc87896a90b21f2101/diffs/4aa8a70c00a9527035e3f9b2fb69bbc4779aa090">View diff</a></p> +<p>master changed from 7054468 to 4aa8a70<p> +<p></p> +</content> + <author> + <name>Trygve Laugstøl</name> + </author> + </entry> + <entry> + <id>tag:gitorious.org,2005:Event/43390405</id> + <published>2012-11-09T12:21:29Z</published> + <updated>2012-11-09T12:21:29Z</updated> + <link type="text/html" rel="alternate" href="http://gitorious.org/esper-test-project/esper-test-project/commits"/> + <title>Trygve Laugstøl pushed 2 commits to esper-test-project/esper-test-project:master. View diff</title> + <content type="html"><p><a href="/~trygvis">trygvis</a> pushed <a href="/esper-test-project/esper-test-project/commits/master" class="commit_event_toggler" gts:id="43390405" gts:url="/events/43390405/commits" id="commits_in_event_43390405_toggler">2 commits</a> to <a href="/esper-test-project/esper-test-project/commits/master">esper-test-project/esper-test-project:master</a>. <a href="/esper-test-project/esper-test-project/commit/80c5808f3dd2e32abf94a06d27e4eb3a0b6590d1/diffs/7054468bc18ae6e66aeccecc87896a90b21f2101">View diff</a></p> +<p>master changed from 80c5808 to 7054468<p> +<p></p> +</content> + <author> + <name>Trygve Laugstøl</name> + </author> + </entry> + <entry> + <id>tag:gitorious.org,2005:Event/43390404</id> + <published>2012-11-09T12:19:57Z</published> + <updated>2012-11-09T12:19:57Z</updated> + <link type="text/html" rel="alternate" href="http://gitorious.org/esper-test-project/esper-test-project/commits"/> + <title>Trygve Laugstøl started development of esper-test-project/esper-test-project</title> + <content type="html"><p><a href="/~trygvis">trygvis</a> started development of <a href="/esper-test-project">esper-test-project</a>/<a href="http://gitorious.org/esper-test-project/esper-test-project">esper-test-project</a></p> +<p><p> +<p></p> +</content> + <author> + <name>Trygve Laugstøl</name> + </author> + </entry> + <entry> + <id>tag:gitorious.org,2005:Event/43390388</id> + <published>2012-11-09T12:05:04Z</published> + <updated>2012-11-09T12:05:04Z</updated> + <link type="text/html" rel="alternate" href="http://gitorious.org/esper-test-project/esper-test-project/commits"/> + <title>Trygve Laugstøl created repository esper-test-project in esper-test-project</title> + <content type="html"><p><a href="/~trygvis">trygvis</a> created repository <a href="/esper-test-project/esper-test-project">esper-test-project</a> in <a href="/esper-test-project">esper-test-project</a></p> +<p><p> +<p></p> +</content> + <author> + <name>Trygve Laugstøl</name> + </author> + </entry> +</feed> |