*/
private RepositoryIndexingFactory indexFactory;
- //@todo configurable?
- private String algorithm = RepositoryIndex.FLD_MD5;
-
/**
* @plexus.requirement
*/
private RepositoryIndexSearchLayer searchLayer;
+ /**
+ * @plexus.configuration
+ */
+ private String indexDirectory;
+
+ //@todo configurable?
+ private String algorithm = RepositoryIndex.FLD_MD5;
+
public void processArtifact( Model model, Artifact artifact, ArtifactReporter reporter,
ArtifactRepository repository )
throws ReportProcessorException
{
if ( artifact.getFile() != null )
{
- //@todo remove hard-coded value; current value enables tests to pass!
- File indexPath = new File( "target/.index" );
-
- if ( !indexPath.exists() )
- {
- indexPath.mkdirs();
- }
-
RepositoryIndex index;
try
{
- index = indexFactory.createArtifactRepositoryIndex( indexPath, repository );
+ index = indexFactory.createArtifactRepositoryIndex( new File( indexDirectory ), repository );
}
catch ( RepositoryIndexException e )
{
private ArtifactFactory artifactFactory;
- private File indexPath = getTestFile( "target/.index" );
+ File indexDirectory;
protected void setUp()
throws Exception
{
super.setUp();
- artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
+
Digester digester = (Digester) lookup( Digester.ROLE );
- reporter = new MockArtifactReporter();
+ indexDirectory = getTestFile( "target/indexDirectory" );
+
+ if ( !indexDirectory.exists() )
+ {
+ indexDirectory.mkdirs();
+ }
+
+ artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
artifact = createArtifact( "groupId", "artifactId", "1.0-alpha-1", "1.0-alpha-1", "jar" );
+ reporter = new MockArtifactReporter();
model = new Model();
- processor = (ArtifactReportProcessor) lookup( ArtifactReportProcessor.ROLE, "duplicate" );
- ArtifactRepositoryIndex index = new ArtifactRepositoryIndex( indexPath, repository, digester );
+ ArtifactRepositoryIndex index = new ArtifactRepositoryIndex( indexDirectory, repository, digester );
index.indexArtifact( artifact );
index.optimize();
index.close();
+
+ processor = (ArtifactReportProcessor) lookup( ArtifactReportProcessor.ROLE, "duplicate" );
}
protected void tearDown()
throws Exception
{
- FileUtils.deleteDirectory( indexPath );
+ //FileUtils.deleteDirectory( indexDirectory );
processor = null;
model = null;
assertEquals( "Check no failures", 1, reporter.getFailures() );
}
- private Artifact createArtifact( String groupId, String artifactId, String baseVersion, String version,
+ private Artifact createArtifact( String groupId,
+ String artifactId,
+ String baseVersion,
+ String version,
String type )
{
Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, null, type );