aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-12-06 08:58:12 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2012-12-07 20:06:57 +0100
commit8ac0faa2b83dde165d45ab62c932ba0f26f42e54 (patch)
tree6f5656e783c5bb9de425e718690732ce796b5603 /src/test
parent1c2c16858e95db9ae90726fa0da69b88457c1807 (diff)
downloadesper-testing-8ac0faa2b83dde165d45ab62c932ba0f26f42e54.tar.gz
esper-testing-8ac0faa2b83dde165d45ab62c932ba0f26f42e54.tar.bz2
esper-testing-8ac0faa2b83dde165d45ab62c932ba0f26f42e54.tar.xz
esper-testing-8ac0faa2b83dde165d45ab62c932ba0f26f42e54.zip
o Adding support for new release events.
Diffstat (limited to 'src/test')
-rwxr-xr-xsrc/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java24
-rwxr-xr-xsrc/test/resources/nexus/recentlyDeployedArtifacts.xml26
2 files changed, 48 insertions, 2 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 038de34..8382fd3 100755
--- a/src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java
+++ b/src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java
@@ -53,14 +53,34 @@ public class TestXmlParsing extends TestCase {
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();
+ List<Element> items = document.getRootElement().getChild("channel").getChildren("item");
+ NexusEvent event = NexusFeedParser.parseEvent(items.get(0)).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);
+ assertEquals("20121204.122640", nse.snapshotTimestamp);
+ assertEquals("536", nse.buildNumber);
+
+ event = NexusFeedParser.parseEvent(items.get(1)).some();
+ assertTrue(event instanceof 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", nse.snapshotTimestamp);
+ assertEquals("536", nse.buildNumber);
+
+ event = NexusFeedParser.parseEvent(items.get(2)).some();
+ assertTrue(event instanceof NewReleaseEvent);
+ NewReleaseEvent nre = (NewReleaseEvent) event;
+ assertEquals("org.example", nre.artifactId.groupId);
+ assertEquals("example", nre.artifactId.artifactId);
+ assertEquals("1.10", nre.artifactId.version);
+
+ assertEquals(3, items.size());
}
}
}
diff --git a/src/test/resources/nexus/recentlyDeployedArtifacts.xml b/src/test/resources/nexus/recentlyDeployedArtifacts.xml
index 1fe22d9..c1751dc 100755
--- a/src/test/resources/nexus/recentlyDeployedArtifacts.xml
+++ b/src/test/resources/nexus/recentlyDeployedArtifacts.xml
@@ -7,6 +7,7 @@
<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>
+ <!-- normal snapshot -->
<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>
@@ -20,5 +21,30 @@
<dc:creator>developer</dc:creator>
<dc:date>2012-12-04T12:26:40Z</dc:date>
</item>
+ <!-- classifier -->
+ <item>
+ <title>org.example:example:1.0-20121204.122640-536:tests</title>
+ <link>http://hostname/repository/content/repositories/snapshots/org/example/example/1.0-SNAPSHOT/example-1.0-20121204.122640-536-tests.jar</link>
+ <description>
+ The artifact 'org.example:example:1.0-20121204.122640-536:tests' 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:tests.jar</guid>
+ <dc:creator>developer</dc:creator>
+ <dc:date>2012-12-04T12:26:40Z</dc:date>
+ </item>
+ <!-- normal release -->
+ <item>
+ <title>org.example:example:1.10</title>
+ <link>http://hostname/repository/content/repositories/releases/org/example/example/1.10/example-1.10.pom</link>
+ <description>The artifact 'org.example:example:1.10' in repository 'Releases' was deployed.Action was initiated by user "foo".
+ Request originated from IP address 172.21.3.60.</description>
+ <pubDate>Wed, 05 Dec 2012 13:33:47 GMT</pubDate>
+ <guid>http://hostname/repository/content/repositories/releases/org/example/example/1.10/example-1.10.pom</guid>
+ <dc:creator>foo</dc:creator>
+ <dc:date>2012-12-05T13:33:47Z</dc:date>
+ </item>
</channel>
</rss>