From: Henri Yandell Date: Thu, 16 Nov 2006 22:54:32 +0000 (+0000) Subject: Applying Tom Huybrechts patch rom MRM-226. Stops the indexer blo X-Git-Tag: archiva-0.9-alpha-1~316 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a45320f77c38d583565811c191703662e25d1531;p=archiva.git Applying Tom Huybrechts patch rom MRM-226. Stops the indexer blo wing up when it hits it and thinks its a -sources for a foo-test artifact git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@475959 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultArtifactDiscoverer.java b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultArtifactDiscoverer.java index f72f82eed..86dbc9f62 100644 --- a/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultArtifactDiscoverer.java +++ b/archiva-discoverer/src/main/java/org/apache/maven/archiva/discoverer/DefaultArtifactDiscoverer.java @@ -87,6 +87,13 @@ public class DefaultArtifactDiscoverer type = "distribution-zip"; remainingFilename = remainingFilename.substring( 0, remainingFilename.length() - ".zip".length() ); } + else if ( remainingFilename.endsWith( "-test-sources.jar" ) ) + { + type = "java-source"; + classifier = "test-sources"; + remainingFilename = + remainingFilename.substring( 0, remainingFilename.length() - "-test-sources.jar".length() ); + } else if ( remainingFilename.endsWith( "-sources.jar" ) ) { type = "java-source"; diff --git a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/DefaultArtifactDiscovererTest.java b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/DefaultArtifactDiscovererTest.java index 5c1529f3d..6a386ae7c 100644 --- a/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/DefaultArtifactDiscovererTest.java +++ b/archiva-discoverer/src/test/java/org/apache/maven/archiva/discoverer/DefaultArtifactDiscovererTest.java @@ -364,6 +364,16 @@ public class DefaultArtifactDiscovererTest createArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources" ) ) ); } + public void testTestSourcesInclusion() + throws DiscovererException +{ + List artifacts = discoverArtifactsWithSnapshots(); + assertNotNull( "Check artifacts not null", artifacts ); + + assertTrue( "Check normal included", artifacts.contains( + createArtifact( "org.apache.maven", "testing", "1.0", "java-source", "test-sources" ) ) ); +} + public void testDistributionInclusion() throws DiscovererException { diff --git a/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0-test-sources.jar b/archiva-discoverer/src/test/repository/org/apache/maven/testing/1.0/testing-1.0-test-sources.jar new file mode 100644 index 000000000..e69de29bb