mirror of https://github.com/apache/archiva.git
clean up discoverer tests - nulls no longer possible here
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@425029 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7927d9a184
commit
a12af7203c
|
@ -492,7 +492,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "invalid/invalid-1.0.jar" );
|
discoverer.buildArtifact( "invalid/invalid-1.0.jar" );
|
||||||
|
|
||||||
fail( "Artifact should be null for short paths" );
|
fail( "Artifact should be null for short paths" );
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar" );
|
discoverer.buildArtifact( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar" );
|
||||||
|
|
||||||
fail( "Artifact should be null for wrong ArtifactId" );
|
fail( "Artifact should be null for wrong ArtifactId" );
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "invalid/invalid/1/invalid-1" );
|
discoverer.buildArtifact( "invalid/invalid/1/invalid-1" );
|
||||||
|
|
||||||
fail( "Artifact should be null for no type" );
|
fail( "Artifact should be null for no type" );
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "invalid/invalid/1.0/invalid-2.0.jar" );
|
discoverer.buildArtifact( "invalid/invalid/1.0/invalid-2.0.jar" );
|
||||||
|
|
||||||
fail( "Artifact should be null for wrong version" );
|
fail( "Artifact should be null for wrong version" );
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "invalid/invalid/1.0/invalid-1.0b.jar" );
|
discoverer.buildArtifact( "invalid/invalid/1.0/invalid-1.0b.jar" );
|
||||||
|
|
||||||
fail( "Artifact should be null for long version" );
|
fail( "Artifact should be null for long version" );
|
||||||
}
|
}
|
||||||
|
@ -568,7 +568,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar" );
|
discoverer.buildArtifact( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar" );
|
||||||
|
|
||||||
fail( "Artifact should be null for wrong snapshot version" );
|
fail( "Artifact should be null for wrong snapshot version" );
|
||||||
}
|
}
|
||||||
|
@ -583,7 +583,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar" );
|
discoverer.buildArtifact( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar" );
|
||||||
|
|
||||||
fail( "Artifact should be null for snapshot base version" );
|
fail( "Artifact should be null for snapshot base version" );
|
||||||
}
|
}
|
||||||
|
@ -598,9 +598,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar";
|
String testPath = "org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Artifact path with classifier error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven", "some-ejb", "1.0", "jar", "client" ), artifact );
|
assertEquals( createArtifact( "org.apache.maven", "some-ejb", "1.0", "jar", "client" ), artifact );
|
||||||
}
|
}
|
||||||
|
@ -610,9 +608,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "org/apache/maven/testing/1.0/testing-1.0-sources.jar";
|
String testPath = "org/apache/maven/testing/1.0/testing-1.0-sources.jar";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Artifact path with java source inclusion error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources" ), artifact );
|
assertEquals( createArtifact( "org.apache.maven", "testing", "1.0", "java-source", "sources" ), artifact );
|
||||||
}
|
}
|
||||||
|
@ -622,17 +618,13 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "org/apache/maven/testing/1.0/testing-1.0.tar.gz";
|
String testPath = "org/apache/maven/testing/1.0/testing-1.0.tar.gz";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "tar.gz distribution artifact error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven", "testing", "1.0", "distribution-tgz" ), artifact );
|
assertEquals( createArtifact( "org.apache.maven", "testing", "1.0", "distribution-tgz" ), artifact );
|
||||||
|
|
||||||
testPath = "org/apache/maven/testing/1.0/testing-1.0.zip";
|
testPath = "org/apache/maven/testing/1.0/testing-1.0.zip";
|
||||||
|
|
||||||
artifact = getArtifactFromPath( testPath );
|
artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "zip distribution artifact error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven", "testing", "1.0", "distribution-zip" ), artifact );
|
assertEquals( createArtifact( "org.apache.maven", "testing", "1.0", "distribution-zip" ), artifact );
|
||||||
}
|
}
|
||||||
|
@ -642,17 +634,13 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar";
|
String testPath = "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Artifact path with invalid snapshot error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven", "test", "1.0-SNAPSHOT" ), artifact );
|
assertEquals( createArtifact( "org.apache.maven", "test", "1.0-SNAPSHOT" ), artifact );
|
||||||
|
|
||||||
testPath = "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1.jar";
|
testPath = "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1.jar";
|
||||||
|
|
||||||
artifact = getArtifactFromPath( testPath );
|
artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Artifact path with snapshot error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1" ), artifact );
|
assertEquals( createArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1" ), artifact );
|
||||||
}
|
}
|
||||||
|
@ -662,9 +650,7 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "javax/sql/jdbc/2.0/jdbc-2.0.jar";
|
String testPath = "javax/sql/jdbc/2.0/jdbc-2.0.jar";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Normal artifact path error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "javax.sql", "jdbc", "2.0" ), artifact );
|
assertEquals( createArtifact( "javax.sql", "jdbc", "2.0" ), artifact );
|
||||||
}
|
}
|
||||||
|
@ -674,17 +660,9 @@ public class DefaultArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar";
|
String testPath = "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Artifact path with snapshot and classifier error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1", "jar", "javadoc" ),
|
assertEquals( createArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1", "jar", "javadoc" ),
|
||||||
artifact );
|
artifact );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Artifact getArtifactFromPath( String path )
|
|
||||||
throws DiscovererException
|
|
||||||
{
|
|
||||||
return discoverer.buildArtifact( path );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,7 +396,7 @@ public class LegacyArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "org.apache.maven.test/jars/artifactId-1.0.jar.md5" );
|
discoverer.buildArtifact( "org.apache.maven.test/jars/artifactId-1.0.jar.md5" );
|
||||||
|
|
||||||
fail( "Artifact should be null for wrong package extension" );
|
fail( "Artifact should be null for wrong package extension" );
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ public class LegacyArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "groupId/jars/-1.0.jar" );
|
discoverer.buildArtifact( "groupId/jars/-1.0.jar" );
|
||||||
|
|
||||||
fail( "Artifact should be null when artifactId is missing" );
|
fail( "Artifact should be null when artifactId is missing" );
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ public class LegacyArtifactDiscovererTest
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "groupId/jars/1.0.jar" );
|
discoverer.buildArtifact( "groupId/jars/1.0.jar" );
|
||||||
|
|
||||||
fail( "Artifact should be null when artifactId is missing" );
|
fail( "Artifact should be null when artifactId is missing" );
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ public class LegacyArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArtifactFromPath( "invalid/invalid/1/invalid-1" );
|
discoverer.buildArtifact( "invalid/invalid/1/invalid-1" );
|
||||||
|
|
||||||
fail( "Artifact should be null for no type" );
|
fail( "Artifact should be null for no type" );
|
||||||
}
|
}
|
||||||
|
@ -452,9 +452,7 @@ public class LegacyArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "org.apache.maven.test/jars/maven-model-1.0-SNAPSHOT.jar";
|
String testPath = "org.apache.maven.test/jars/maven-model-1.0-SNAPSHOT.jar";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Artifact path with invalid snapshot error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven.test", "maven-model", "1.0-SNAPSHOT" ), artifact );
|
assertEquals( createArtifact( "org.apache.maven.test", "maven-model", "1.0-SNAPSHOT" ), artifact );
|
||||||
}
|
}
|
||||||
|
@ -464,9 +462,7 @@ public class LegacyArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "org.apache.maven.test/jars/maven-model-1.0-final-20060606.jar";
|
String testPath = "org.apache.maven.test/jars/maven-model-1.0-final-20060606.jar";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Artifact path with invalid snapshot error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "org.apache.maven.test", "maven-model", "1.0-final-20060606" ), artifact );
|
assertEquals( createArtifact( "org.apache.maven.test", "maven-model", "1.0-final-20060606" ), artifact );
|
||||||
}
|
}
|
||||||
|
@ -476,16 +472,8 @@ public class LegacyArtifactDiscovererTest
|
||||||
{
|
{
|
||||||
String testPath = "javax.sql/jars/jdbc-2.0.jar";
|
String testPath = "javax.sql/jars/jdbc-2.0.jar";
|
||||||
|
|
||||||
Artifact artifact = getArtifactFromPath( testPath );
|
Artifact artifact = discoverer.buildArtifact( testPath );
|
||||||
|
|
||||||
assertNotNull( "Normal artifact path error", artifact );
|
|
||||||
|
|
||||||
assertEquals( createArtifact( "javax.sql", "jdbc", "2.0" ), artifact );
|
assertEquals( createArtifact( "javax.sql", "jdbc", "2.0" ), artifact );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Artifact getArtifactFromPath( String path )
|
|
||||||
throws DiscovererException
|
|
||||||
{
|
|
||||||
return discoverer.buildArtifact( path );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue