more test coverage

PR: MRM-9

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@349703 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2005-11-29 10:53:28 +00:00
parent 5040db2f65
commit 8c5813308d
4 changed files with 49 additions and 0 deletions

View File

@ -150,6 +150,26 @@ public class DefaultArtifactDiscovererTest
} }
} }
public void testKickoutWithNoType()
{
List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false );
assertNotNull( "Check artifacts not null", artifacts );
boolean found = false;
for ( Iterator i = discoverer.getKickedOutPathsIterator(); i.hasNext() && !found; )
{
String path = (String) i.next();
found = path.replace( '\\', '/' ).equals( "invalid/invalid/1/invalid-1" );
}
assertTrue( "Check kickout was found", found );
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
{
Artifact a = (Artifact) i.next();
assertFalse( "Check not 'invalid-1'", a.getFile().getName().equals( "invalid-1" ) );
}
}
public void testKickoutWithWrongVersion() public void testKickoutWithWrongVersion()
{ {
List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false ); List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false );
@ -170,6 +190,26 @@ public class DefaultArtifactDiscovererTest
} }
} }
public void testKickoutWithLongerVersion()
{
List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false );
assertNotNull( "Check artifacts not null", artifacts );
boolean found = false;
for ( Iterator i = discoverer.getKickedOutPathsIterator(); i.hasNext() && !found; )
{
String path = (String) i.next();
found = path.replace( '\\', '/' ).equals( "invalid/invalid/1.0/invalid-1.0b.jar" );
}
assertTrue( "Check kickout was found", found );
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
{
Artifact a = (Artifact) i.next();
assertFalse( "Check not 'invalid-1.0b.jar'", a.getFile().getName().equals( "invalid-1.0b.jar" ) );
}
}
public void testKickoutWithWrongSnapshotVersion() public void testKickoutWithWrongSnapshotVersion()
{ {
List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false ); List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false );
@ -261,6 +301,15 @@ public class DefaultArtifactDiscovererTest
artifacts.contains( createArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1" ) ) ); artifacts.contains( createArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1" ) ) );
} }
public void testSnapshotInclusionWithClassifier()
{
List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, true );
assertNotNull( "Check artifacts not null", artifacts );
assertTrue( "Check snapshot included", artifacts.contains(
createArtifact( "org.apache.maven", "test", "1.0-20050611.112233-1", "jar", "javadoc" ) ) );
}
public void testSnapshotExclusion() public void testSnapshotExclusion()
{ {
List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false ); List artifacts = discoverer.discoverArtifacts( repositoryLocation, null, false );