diff options
Diffstat (limited to 'src/test')
-rwxr-xr-x | src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java | 19 | ||||
-rwxr-xr-x | src/test/resources/nexus/recentlyDeployedArtifacts.xml | 24 | ||||
-rwxr-xr-x | src/test/resources/nexus/search-1.xml | 1 |
3 files changed, 43 insertions, 1 deletions
diff --git a/src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java b/src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java index 6495d86..038de34 100755 --- a/src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java +++ b/src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java @@ -3,7 +3,9 @@ package io.trygvis.esper.testing.nexus; import static com.google.common.collect.Iterables.*; import static com.google.common.collect.Lists.*; import static io.trygvis.esper.testing.nexus.ArtifactXml.repositoryFilter; +import io.trygvis.esper.testing.util.*; import junit.framework.*; +import org.jdom2.*; import java.io.*; import java.util.*; @@ -44,4 +46,21 @@ public class TestXmlParsing extends TestCase { assertEquals(2, flatArtifact.files.size()); } } + + public void testTimelineParsing() throws Exception { + XmlParser parser = new XmlParser(); + + try (InputStream stream = getClass().getResourceAsStream("/nexus/recentlyDeployedArtifacts.xml")) { + Document document = parser.parseDocument(stream).some(); + + NexusEvent event = NexusFeedParser.parseEvent(document.getRootElement().getChild("channel").getChild("item")).some(); + + assertTrue(event instanceof NewSnapshotEvent); + NewSnapshotEvent nse = (NewSnapshotEvent) event; + assertEquals("org.example", nse.artifactId.groupId); + assertEquals("example", nse.artifactId.artifactId); + assertEquals("1.0-SNAPSHOT", nse.artifactId.version); + assertEquals("20121204.122640-536", nse.snapshotTimestamp); + } + } } diff --git a/src/test/resources/nexus/recentlyDeployedArtifacts.xml b/src/test/resources/nexus/recentlyDeployedArtifacts.xml new file mode 100755 index 0000000..1fe22d9 --- /dev/null +++ b/src/test/resources/nexus/recentlyDeployedArtifacts.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> + <channel> + <title>New deployed artifacts</title> + <link>http://localhost:8081/repository/service/local/feeds/recentlyDeployedArtifacts</link> + <description>New deployed artifacts in all Nexus repositories (deployed).</description> + <pubDate>Tue, 04 Dec 2012 12:26:41 GMT</pubDate> + <dc:creator>Nexus 1.9.2.3</dc:creator> + <dc:date>2012-12-04T12:26:41Z</dc:date> + <item> + <title>org.example:example:1.0-20121204.122640-536</title> + <link>http://hostname/repository/content/repositories/snapshots/org/example/example/1.0-SNAPSHOT/example-1.0-20121204.122640-536.pom</link> + <description> + The artifact 'org.example:example:1.0-20121204.122640-536' in repository 'Snapshots' was + deployed.Action was initiated by user "developer". + Request originated from IP address 1.2.3.4. + </description> + <pubDate>Tue, 04 Dec 2012 12:26:40 GMT</pubDate> + <guid>http://hostname/repository/content/repositories/snapshots/org/example/example/1.0-SNAPSHOT/example-1.0-20121204.122640-536.pom</guid> + <dc:creator>developer</dc:creator> + <dc:date>2012-12-04T12:26:40Z</dc:date> + </item> + </channel> +</rss> diff --git a/src/test/resources/nexus/search-1.xml b/src/test/resources/nexus/search-1.xml index b501491..75bfdc9 100755 --- a/src/test/resources/nexus/search-1.xml +++ b/src/test/resources/nexus/search-1.xml @@ -2674,4 +2674,3 @@ </artifact> </data> </searchNGResponse> -- |