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 ManagedRepositoryConfiguration repository;
private List<IndexCreator> allIndexCreators; private List<? extends IndexCreator> allIndexCreators;
public NexusIndexerConsumer( ArchivaTaskScheduler<ArtifactIndexingTask> scheduler, public NexusIndexerConsumer( ArchivaTaskScheduler<ArtifactIndexingTask> scheduler,
ArchivaConfiguration configuration, FileTypes filetypes, ArchivaConfiguration configuration, FileTypes filetypes,

View File

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

View File

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