diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-11-19 18:04:49 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-11-19 18:05:27 +0100 |
commit | af92579129943acac73542f4e05e1c7faeda0994 (patch) | |
tree | efa76694deade25434fdfb359c130b278d6b608f /src/test/java/io | |
parent | 389b8373b7f04a5bdb039b9b690daa12a50fb144 (diff) | |
download | esper-testing-af92579129943acac73542f4e05e1c7faeda0994.tar.gz esper-testing-af92579129943acac73542f4e05e1c7faeda0994.tar.bz2 esper-testing-af92579129943acac73542f4e05e1c7faeda0994.tar.xz esper-testing-af92579129943acac73542f4e05e1c7faeda0994.zip |
o Adding logic to stop fetching pages when Gitorious returns non-XML response.
o Adding support for self-signed certificates with https.
o Moving client code to GitoriousClient.
o Adding Nexus client and an importer that fetches all artifacts.
o A nexus client that actually fetches the entire set of artifacts.
Diffstat (limited to 'src/test/java/io')
-rwxr-xr-x | src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java | 47 |
1 files changed, 47 insertions, 0 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 new file mode 100755 index 0000000..c9aba8d --- /dev/null +++ b/src/test/java/io/trygvis/esper/testing/nexus/TestXmlParsing.java @@ -0,0 +1,47 @@ +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 junit.framework.*; + +import java.io.*; +import java.util.*; + +public class TestXmlParsing extends TestCase { + public void testProjectParsing() throws Exception { + try (InputStream stream = getClass().getResourceAsStream("/nexus/search-1.xml")) { + ArtifactSearchResult result = NexusParser.parseDocument(stream); + + List<ArtifactXml> list = result.artifacts; + + assertNotNull(list); + assertEquals(132, list.size()); + + ArtifactXml artifact = list.get(0); + assertEquals("org.codehaus.mojo.hibernate3", artifact.groupId); + assertEquals("maven-hibernate3-jdk15", artifact.artifactId); + assertEquals("2.0-alpha-1", artifact.version); + + artifact = list.get(4); + assertEquals("org.codehaus.mojo.hibernate3", artifact.groupId); + assertEquals("maven-hibernate3", artifact.artifactId); + assertEquals("2.0-alpha-1", artifact.version); + assertEquals(2, artifact.hits.size()); + assertEquals("appfuse-releases", artifact.hits.get(0).repositoryId); + assertEquals(1, artifact.hits.get(0).files.size()); + assertTrue(artifact.hits.get(0).files.get(0).classifier.isNone()); + assertEquals("pom", artifact.hits.get(0).files.get(0).extension); + + assertEquals(2, artifact.hits.size()); + ArrayList<ArtifactXml> filtered = newArrayList(filter(list, repositoryFilter("appfuse-releases"))); + assertEquals(5, filtered.size()); + + FlatArtifact flatArtifact = filtered.get(0).flatten("appfuse-releases"); + assertEquals("org.codehaus.mojo.hibernate3", flatArtifact.groupId); + assertEquals("maven-hibernate3-jdk15", flatArtifact.artifactId); + assertEquals("2.0-alpha-1", flatArtifact.version); + assertEquals(2, flatArtifact.files.size()); + } + } +} |