fix compilation issues :my bad !!

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1158332 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-08-16 15:50:54 +00:00
parent 7a2b07b118
commit 70bd4e3ede
3 changed files with 39 additions and 31 deletions

View File

@ -75,7 +75,7 @@ public class NexusIndexerConsumer
private ManagedRepositoryConfiguration repository;
private List<IndexCreator> allIndexCreators;
private List<? extends IndexCreator> allIndexCreators;
public NexusIndexerConsumer( ArchivaTaskScheduler<ArtifactIndexingTask> scheduler,
ArchivaConfiguration configuration, FileTypes filetypes,

View File

@ -19,15 +19,8 @@ package org.apache.archiva.consumers.lucene;
* under the License.
*/
import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import junit.framework.TestCase;
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.scheduler.ArchivaTaskScheduler;
import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
@ -36,7 +29,6 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.FileTypes;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.maven.index.NexusIndexer;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.taskqueue.TaskQueueException;
import org.junit.After;
@ -48,6 +40,13 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* NexusIndexerConsumerTest
@ -99,6 +98,9 @@ public class NexusIndexerConsumerTest
@Inject
private PlexusSisuBridge plexusSisuBridge;
@Inject
private MavenIndexerUtils mavenIndexerUtils;
@Override
@Before
@ -113,7 +115,8 @@ public class NexusIndexerConsumerTest
FileTypes filetypes = applicationContext.getBean( FileTypes.class );
nexusIndexerConsumer = new NexusIndexerConsumer( scheduler, configuration, filetypes, plexusSisuBridge );
nexusIndexerConsumer =
new NexusIndexerConsumer( scheduler, configuration, filetypes, plexusSisuBridge, mavenIndexerUtils );
// initialize to set the file types to be processed
( (Initializable) nexusIndexerConsumer ).initialize();
@ -149,14 +152,14 @@ public class NexusIndexerConsumerTest
public void testIndexerIndexArtifact()
throws Exception
{
File artifactFile =
new File( repositoryConfig.getLocation(),
File artifactFile = new File( repositoryConfig.getLocation(),
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
// begin scan
Date now = Calendar.getInstance().getTime();
nexusIndexerConsumer.beginScan( repositoryConfig, now );
nexusIndexerConsumer.processFile( "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
nexusIndexerConsumer.processFile(
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
nexusIndexerConsumer.completeScan();
assertTrue( scheduler.indexed.contains( artifactFile ) );
@ -166,14 +169,14 @@ public class NexusIndexerConsumerTest
public void testIndexerArtifactAlreadyIndexed()
throws Exception
{
File artifactFile =
new File( repositoryConfig.getLocation(),
File artifactFile = new File( repositoryConfig.getLocation(),
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
// begin scan
Date now = Calendar.getInstance().getTime();
nexusIndexerConsumer.beginScan( repositoryConfig, now );
nexusIndexerConsumer.processFile( "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
nexusIndexerConsumer.processFile(
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
nexusIndexerConsumer.completeScan();
assertTrue( scheduler.indexed.contains( artifactFile ) );
@ -181,7 +184,8 @@ public class NexusIndexerConsumerTest
// scan and index again
now = Calendar.getInstance().getTime();
nexusIndexerConsumer.beginScan( repositoryConfig, now );
nexusIndexerConsumer.processFile( "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
nexusIndexerConsumer.processFile(
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
nexusIndexerConsumer.completeScan();
assertTrue( scheduler.indexed.contains( artifactFile ) );
@ -191,14 +195,14 @@ public class NexusIndexerConsumerTest
public void testIndexerIndexArtifactThenPom()
throws Exception
{
File artifactFile =
new File( repositoryConfig.getLocation(),
File artifactFile = new File( repositoryConfig.getLocation(),
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
// begin scan
Date now = Calendar.getInstance().getTime();
nexusIndexerConsumer.beginScan( repositoryConfig, now );
nexusIndexerConsumer.processFile( "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
nexusIndexerConsumer.processFile(
"org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
nexusIndexerConsumer.completeScan();
assertTrue( scheduler.indexed.contains( artifactFile ) );

View File

@ -20,6 +20,7 @@ package org.apache.archiva.indexer.search;
*/
import junit.framework.TestCase;
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.common.utils.FileUtil;
@ -70,6 +71,9 @@ public abstract class AbstractNexusRepositorySearch
@Inject
PlexusSisuBridge plexusSisuBridge;
@Inject
MavenIndexerUtils mavenIndexerUtils;
NexusIndexer nexusIndexer;
@Before
@ -90,7 +94,7 @@ public abstract class AbstractNexusRepositorySearch
archivaConfig = (ArchivaConfiguration) archivaConfigControl.getMock();
search = new NexusRepositorySearch( plexusSisuBridge, archivaConfig );
search = new NexusRepositorySearch( plexusSisuBridge, archivaConfig, mavenIndexerUtils );
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );