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 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/test/java/io/trygvis') 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); + } + } } -- cgit v1.2.3