Added the role-hint for md5 Digester to the plexus test config.

Re-initialize the reporter in every testcase as it isn't reset
and the internal error/succes etc. lists can contain values from
previous testcases.


git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@430624 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2006-08-11 02:19:29 +00:00
parent 92753d6b7d
commit 61c4bb7f1d
2 changed files with 12 additions and 3 deletions

View File

@ -33,8 +33,6 @@ import java.util.Collections;
public class DuplicateArtifactFileReportProcessorTest public class DuplicateArtifactFileReportProcessorTest
extends AbstractRepositoryReportsTestCase extends AbstractRepositoryReportsTestCase
{ {
private MockArtifactReporter reporter;
private Artifact artifact; private Artifact artifact;
private Model model; private Model model;
@ -55,7 +53,6 @@ public class DuplicateArtifactFileReportProcessorTest
artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
artifact = createArtifact( "groupId", "artifactId", "1.0-alpha-1", "1.0-alpha-1", "jar" ); artifact = createArtifact( "groupId", "artifactId", "1.0-alpha-1", "1.0-alpha-1", "jar" );
reporter = new MockArtifactReporter();
model = new Model(); model = new Model();
RepositoryArtifactIndexFactory factory = RepositoryArtifactIndexFactory factory =
@ -76,6 +73,8 @@ public class DuplicateArtifactFileReportProcessorTest
{ {
artifact.setFile( null ); artifact.setFile( null );
MockArtifactReporter reporter = new MockArtifactReporter();
processor.processArtifact( model, artifact, reporter, repository ); processor.processArtifact( model, artifact, reporter, repository );
assertEquals( "Check no successes", 0, reporter.getSuccesses() ); assertEquals( "Check no successes", 0, reporter.getSuccesses() );
@ -86,6 +85,8 @@ public class DuplicateArtifactFileReportProcessorTest
public void testSuccessOnAlreadyIndexedArtifact() public void testSuccessOnAlreadyIndexedArtifact()
throws Exception throws Exception
{ {
MockArtifactReporter reporter = new MockArtifactReporter();
processor.processArtifact( model, artifact, reporter, repository ); processor.processArtifact( model, artifact, reporter, repository );
assertEquals( "Check no successes", 1, reporter.getSuccesses() ); assertEquals( "Check no successes", 1, reporter.getSuccesses() );
@ -96,6 +97,8 @@ public class DuplicateArtifactFileReportProcessorTest
public void testSuccessOnDifferentGroupId() public void testSuccessOnDifferentGroupId()
throws Exception throws Exception
{ {
MockArtifactReporter reporter = new MockArtifactReporter();
artifact.setGroupId( "different.groupId" ); artifact.setGroupId( "different.groupId" );
processor.processArtifact( model, artifact, reporter, repository ); processor.processArtifact( model, artifact, reporter, repository );
@ -109,6 +112,8 @@ public class DuplicateArtifactFileReportProcessorTest
{ {
Artifact newArtifact = createArtifact( "groupId", "artifactId", "1.0-alpha-1", "1.0-alpha-1", "pom" ); Artifact newArtifact = createArtifact( "groupId", "artifactId", "1.0-alpha-1", "1.0-alpha-1", "pom" );
MockArtifactReporter reporter = new MockArtifactReporter();
processor.processArtifact( model, newArtifact, reporter, repository ); processor.processArtifact( model, newArtifact, reporter, repository );
assertEquals( "Check no successes", 1, reporter.getSuccesses() ); assertEquals( "Check no successes", 1, reporter.getSuccesses() );
@ -123,6 +128,9 @@ public class DuplicateArtifactFileReportProcessorTest
artifact.getVersion(), artifact.getType() ); artifact.getVersion(), artifact.getType() );
duplicate.setFile( artifact.getFile() ); duplicate.setFile( artifact.getFile() );
MockArtifactReporter reporter = new MockArtifactReporter();
System.err.println("OKAY");
processor.processArtifact( model, duplicate, reporter, repository ); processor.processArtifact( model, duplicate, reporter, repository );
assertEquals( "Check no successes", 0, reporter.getSuccesses() ); assertEquals( "Check no successes", 0, reporter.getSuccesses() );

View File

@ -7,6 +7,7 @@
<requirements> <requirements>
<requirement> <requirement>
<role>org.apache.maven.repository.digest.Digester</role> <role>org.apache.maven.repository.digest.Digester</role>
<role-hint>md5</role-hint>
</requirement> </requirement>
<requirement> <requirement>
<role>org.apache.maven.repository.indexing.RepositoryArtifactIndexFactory</role> <role>org.apache.maven.repository.indexing.RepositoryArtifactIndexFactory</role>