From a742500840276ec694a6d25230ee52c05b385661 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 9 Nov 2012 15:26:55 +0100 Subject: wip --- .../esper/testing/gitorious/TestXmlParsing.java | 26 +++++ .../resources/gitorious/esper-test-project.atom | 120 +++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 src/test/resources/gitorious/esper-test-project.atom (limited to 'src/test') 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 events = parser.parseStream(stream, Option.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 @@ + + + tag:gitorious.org,2005:/esper-test-project/esper-test-project + + + Gitorious: esper-test-project/esper-test-project activity + 2012-11-09T14:06:33Z + + tag:gitorious.org,2005:Event/43390557 + 2012-11-09T14:06:33Z + 2012-11-09T14:06:33Z + + Trygve Laugstøl pushed 1 commit to esper-test-project/esper-test-project:my-branch. View diff + <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> + + + Trygve Laugstøl + + + + tag:gitorious.org,2005:Event/43390538 + 2012-11-09T13:58:05Z + 2012-11-09T13:58:05Z + + Trygve Laugstøl created branch my-branch on esper-test-project/esper-test-project + <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> + + + Trygve Laugstøl + + + + tag:gitorious.org,2005:Event/43390537 + 2012-11-09T13:57:31Z + 2012-11-09T13:57:31Z + + Trygve Laugstøl pushed 1 commit to esper-test-project/esper-test-project:master. View diff + <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> + + + Trygve Laugstøl + + + + tag:gitorious.org,2005:Event/43390416 + 2012-11-09T12:26:09Z + 2012-11-09T12:26:09Z + + Trygve Laugstøl pushed 1 commit to esper-test-project/esper-test-project:master. View diff + <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> + + + Trygve Laugstøl + + + + tag:gitorious.org,2005:Event/43390409 + 2012-11-09T12:22:07Z + 2012-11-09T12:22:07Z + + Trygve Laugstøl pushed 3 commits to esper-test-project/esper-test-project:master. View diff + <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> + + + Trygve Laugstøl + + + + tag:gitorious.org,2005:Event/43390405 + 2012-11-09T12:21:29Z + 2012-11-09T12:21:29Z + + Trygve Laugstøl pushed 2 commits to esper-test-project/esper-test-project:master. View diff + <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> + + + Trygve Laugstøl + + + + tag:gitorious.org,2005:Event/43390404 + 2012-11-09T12:19:57Z + 2012-11-09T12:19:57Z + + Trygve Laugstøl started development of esper-test-project/esper-test-project + <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> + + + Trygve Laugstøl + + + + tag:gitorious.org,2005:Event/43390388 + 2012-11-09T12:05:04Z + 2012-11-09T12:05:04Z + + Trygve Laugstøl created repository esper-test-project in esper-test-project + <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> + + + Trygve Laugstøl + + + -- cgit v1.2.3