mirror of https://github.com/apache/archiva.git
more tests on search rest services
prevent copying files for test in archiva-indexer : with scan activated some results were false git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170883 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a4a314ac5c
commit
ae4ff95a87
|
@ -187,6 +187,12 @@ public class NexusRepositorySearch
|
||||||
Occur.MUST );
|
Occur.MUST );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( StringUtils.isNotBlank( searchFields.getClassifier() ) )
|
||||||
|
{
|
||||||
|
q.add( indexer.constructQuery( MAVEN.CLASSIFIER, new StringSearchExpression( searchFields.getClassifier() ) ),
|
||||||
|
Occur.MUST );
|
||||||
|
}
|
||||||
|
|
||||||
if ( q.getClauses() == null || q.getClauses().length <= 0 )
|
if ( q.getClauses() == null || q.getClauses().length <= 0 )
|
||||||
{
|
{
|
||||||
throw new RepositorySearchException( "No search fields set." );
|
throw new RepositorySearchException( "No search fields set." );
|
||||||
|
|
|
@ -83,6 +83,8 @@ public class SearchFields
|
||||||
*/
|
*/
|
||||||
private String bundleExportService;
|
private String bundleExportService;
|
||||||
|
|
||||||
|
private String classifier;
|
||||||
|
|
||||||
public SearchFields()
|
public SearchFields()
|
||||||
{
|
{
|
||||||
// no op
|
// no op
|
||||||
|
@ -200,13 +202,33 @@ public class SearchFields
|
||||||
this.bundleExportService = bundleExportService;
|
this.bundleExportService = bundleExportService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClassifier()
|
||||||
|
{
|
||||||
|
return classifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassifier( String classifier )
|
||||||
|
{
|
||||||
|
this.classifier = classifier;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "SearchFields{" + "groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", version='"
|
final StringBuilder sb = new StringBuilder();
|
||||||
+ version + '\'' + ", packaging='" + packaging + '\'' + ", className='" + className + '\''
|
sb.append( "SearchFields" );
|
||||||
+ ", repositories=" + repositories + ", bundleVersion='" + bundleVersion + '\'' + ", bundleSymbolicName='"
|
sb.append( "{groupId='" ).append( groupId ).append( '\'' );
|
||||||
+ bundleSymbolicName + '\'' + ", bundleExportPackage='" + bundleExportPackage + '\''
|
sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
|
||||||
+ ", bundleExportService='" + bundleExportService + '\'' + '}';
|
sb.append( ", version='" ).append( version ).append( '\'' );
|
||||||
|
sb.append( ", packaging='" ).append( packaging ).append( '\'' );
|
||||||
|
sb.append( ", className='" ).append( className ).append( '\'' );
|
||||||
|
sb.append( ", repositories=" ).append( repositories );
|
||||||
|
sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
|
||||||
|
sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
|
||||||
|
sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
|
||||||
|
sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
|
||||||
|
sb.append( ", classifier='" ).append( classifier ).append( '\'' );
|
||||||
|
sb.append( '}' );
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,7 @@ public class SearchResultHit
|
||||||
*/
|
*/
|
||||||
private String bundleRequireBundle;
|
private String bundleRequireBundle;
|
||||||
|
|
||||||
|
private String classifier;
|
||||||
|
|
||||||
public String getContext()
|
public String getContext()
|
||||||
{
|
{
|
||||||
|
@ -333,6 +334,16 @@ public class SearchResultHit
|
||||||
return getPackaging();
|
return getPackaging();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClassifier()
|
||||||
|
{
|
||||||
|
return classifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassifier( String classifier )
|
||||||
|
{
|
||||||
|
this.classifier = classifier;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
|
@ -357,6 +368,7 @@ public class SearchResultHit
|
||||||
sb.append( ", bundleDocUrl='" ).append( bundleDocUrl ).append( '\'' );
|
sb.append( ", bundleDocUrl='" ).append( bundleDocUrl ).append( '\'' );
|
||||||
sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
|
sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
|
||||||
sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
|
sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
|
||||||
|
sb.append( ", classifier='" ).append( classifier ).append( '\'' );
|
||||||
sb.append( '}' );
|
sb.append( '}' );
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,25 +24,28 @@ import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin
|
||||||
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
|
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.commons.lang.SystemUtils;
|
||||||
import org.apache.maven.archiva.common.utils.FileUtil;
|
import org.apache.maven.archiva.common.utils.FileUtil;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.Configuration;
|
import org.apache.maven.archiva.configuration.Configuration;
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.index.ArtifactContext;
|
import org.apache.maven.index.ArtifactContext;
|
||||||
import org.apache.maven.index.ArtifactContextProducer;
|
import org.apache.maven.index.ArtifactContextProducer;
|
||||||
|
import org.apache.maven.index.ArtifactScanningListener;
|
||||||
import org.apache.maven.index.NexusIndexer;
|
import org.apache.maven.index.NexusIndexer;
|
||||||
|
import org.apache.maven.index.ScanningResult;
|
||||||
import org.apache.maven.index.context.IndexingContext;
|
import org.apache.maven.index.context.IndexingContext;
|
||||||
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
|
|
||||||
import org.easymock.MockControl;
|
import org.easymock.MockControl;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
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.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -55,6 +58,8 @@ public abstract class AbstractNexusRepositorySearch
|
||||||
extends TestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected Logger log = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
public static String TEST_REPO_1 = "nexus-search-test-repo";
|
public static String TEST_REPO_1 = "nexus-search-test-repo";
|
||||||
|
|
||||||
public static String TEST_REPO_2 = "nexus-search-test-repo-2";
|
public static String TEST_REPO_2 = "nexus-search-test-repo-2";
|
||||||
|
@ -83,13 +88,11 @@ public abstract class AbstractNexusRepositorySearch
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
FileUtils.deleteDirectory(
|
FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_1 + "/.indexer" ) );
|
||||||
new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1 + "/.indexer" ) );
|
assertFalse( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_1 + "/.indexer" ).exists() );
|
||||||
assertFalse( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1 + "/.indexer" ).exists() );
|
|
||||||
|
|
||||||
FileUtils.deleteDirectory(
|
FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer" ) );
|
||||||
new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2 + "/.indexer" ) );
|
assertFalse( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer" ).exists() );
|
||||||
assertFalse( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2 + "/.indexer" ).exists() );
|
|
||||||
|
|
||||||
archivaConfigControl = MockControl.createControl( ArchivaConfiguration.class );
|
archivaConfigControl = MockControl.createControl( ArchivaConfiguration.class );
|
||||||
|
|
||||||
|
@ -119,14 +122,6 @@ public abstract class AbstractNexusRepositorySearch
|
||||||
nexusIndexer.removeIndexingContext( indexingContext, true );
|
nexusIndexer.removeIndexingContext( indexingContext, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
FileUtils.deleteDirectory(
|
|
||||||
new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1 + "/.indexer" ) );
|
|
||||||
assertFalse( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1 + "/.indexer" ).exists() );
|
|
||||||
|
|
||||||
FileUtils.deleteDirectory(
|
|
||||||
new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2 + "/.indexer" ) );
|
|
||||||
assertFalse( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2 + "/.indexer" ).exists() );
|
|
||||||
|
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +129,12 @@ public abstract class AbstractNexusRepositorySearch
|
||||||
{
|
{
|
||||||
ManagedRepositoryConfiguration repositoryConfig = new ManagedRepositoryConfiguration();
|
ManagedRepositoryConfiguration repositoryConfig = new ManagedRepositoryConfiguration();
|
||||||
repositoryConfig.setId( repository );
|
repositoryConfig.setId( repository );
|
||||||
repositoryConfig.setLocation( FileUtil.getBasedir() + "/target/test-classes/" + repository );
|
repositoryConfig.setLocation( FileUtil.getBasedir() + "/target/repos/" + repository );
|
||||||
|
File f = new File( repositoryConfig.getLocation() );
|
||||||
|
if ( !f.exists() )
|
||||||
|
{
|
||||||
|
f.mkdirs();
|
||||||
|
}
|
||||||
repositoryConfig.setLayout( "default" );
|
repositoryConfig.setLayout( "default" );
|
||||||
repositoryConfig.setName( repository );
|
repositoryConfig.setName( repository );
|
||||||
repositoryConfig.setScanned( true );
|
repositoryConfig.setScanned( true );
|
||||||
|
@ -145,10 +145,17 @@ public abstract class AbstractNexusRepositorySearch
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createIndex( String repository, List<File> filesToBeIndexed, boolean scan )
|
protected void createIndex( String repository, List<File> filesToBeIndexed, boolean scan )
|
||||||
throws IOException, UnsupportedExistingLuceneIndexException
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
File indexerDirectory = new File( FileUtil.getBasedir(), "/target/test-classes/" + repository + "/.indexer" );
|
IndexingContext context = nexusIndexer.getIndexingContexts().get( repository );
|
||||||
|
|
||||||
|
if ( context != null )
|
||||||
|
{
|
||||||
|
nexusIndexer.removeIndexingContext( context, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
File indexerDirectory = new File( FileUtil.getBasedir(), "/target/repos/" + repository + "/.indexer" );
|
||||||
|
|
||||||
if ( indexerDirectory.exists() )
|
if ( indexerDirectory.exists() )
|
||||||
{
|
{
|
||||||
|
@ -157,8 +164,7 @@ public abstract class AbstractNexusRepositorySearch
|
||||||
|
|
||||||
assertFalse( indexerDirectory.exists() );
|
assertFalse( indexerDirectory.exists() );
|
||||||
|
|
||||||
File lockFile =
|
File lockFile = new File( FileUtil.getBasedir(), "/target/repos/" + repository + "/.indexer/write.lock" );
|
||||||
new File( FileUtil.getBasedir(), "/target/test-classes/" + repository + "/.indexer/write.lock" );
|
|
||||||
if ( lockFile.exists() )
|
if ( lockFile.exists() )
|
||||||
{
|
{
|
||||||
lockFile.delete();
|
lockFile.delete();
|
||||||
|
@ -166,10 +172,10 @@ public abstract class AbstractNexusRepositorySearch
|
||||||
|
|
||||||
assertFalse( lockFile.exists() );
|
assertFalse( lockFile.exists() );
|
||||||
|
|
||||||
File repo = new File( FileUtil.getBasedir(), "/target/test-classes/" + repository );
|
File repo = new File( FileUtil.getBasedir(), "/target/repos/" + repository );
|
||||||
File indexDirectory = new File( FileUtil.getBasedir(), "/target/test-classes/" + repository + "/.indexer" );
|
File indexDirectory = new File( FileUtil.getBasedir(), "/target/repos/" + repository + "/.indexer" );
|
||||||
|
|
||||||
IndexingContext context = nexusIndexer.addIndexingContext( repository, repository, repo, indexDirectory,
|
context = nexusIndexer.addIndexingContext( repository, repository, repo, indexDirectory,
|
||||||
repo.toURI().toURL().toExternalForm(),
|
repo.toURI().toURL().toExternalForm(),
|
||||||
indexDirectory.toURI().toURL().toString(),
|
indexDirectory.toURI().toURL().toString(),
|
||||||
search.getAllIndexCreators() );
|
search.getAllIndexCreators() );
|
||||||
|
@ -181,16 +187,59 @@ public abstract class AbstractNexusRepositorySearch
|
||||||
artifactContexts.add( ac );
|
artifactContexts.add( ac );
|
||||||
}
|
}
|
||||||
|
|
||||||
context.setSearchable( true );
|
|
||||||
|
|
||||||
if ( filesToBeIndexed != null && !filesToBeIndexed.isEmpty() )
|
if ( filesToBeIndexed != null && !filesToBeIndexed.isEmpty() )
|
||||||
{
|
{
|
||||||
nexusIndexer.addArtifactsToIndex( artifactContexts, context );
|
nexusIndexer.addArtifactsToIndex( artifactContexts, context );
|
||||||
|
|
||||||
|
while ( context.isReceivingUpdates() )
|
||||||
|
{
|
||||||
|
Thread.sleep( 10 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( scan )
|
if ( scan )
|
||||||
{
|
{
|
||||||
nexusIndexer.scan( context, false );
|
nexusIndexer.scan( context, new ArtifactScanListener(), false );
|
||||||
}
|
}
|
||||||
assertTrue( new File( FileUtil.getBasedir(), "/target/test-classes/" + repository + "/.indexer" ).exists() );
|
|
||||||
|
context.setSearchable( true );
|
||||||
|
|
||||||
|
assertTrue( new File( FileUtil.getBasedir(), "/target/repos/" + repository + "/.indexer" ).exists() );
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ArtifactScanListener
|
||||||
|
implements ArtifactScanningListener
|
||||||
|
{
|
||||||
|
protected Logger log = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
|
public void scanningStarted( IndexingContext ctx )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void scanningFinished( IndexingContext ctx, ScanningResult result )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void artifactError( ArtifactContext ac, Exception e )
|
||||||
|
{
|
||||||
|
log.debug( "artifactError " + ac.getArtifact().getPath(), e );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void artifactDiscovered( ArtifactContext ac )
|
||||||
|
{
|
||||||
|
log.debug( "artifactDiscovered " + ac.getArtifact().getPath() + ":" + ac.getArtifactInfo() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String niceDisplay( SearchResults searchResults )
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for ( SearchResultHit hit : searchResults.getHits() )
|
||||||
|
{
|
||||||
|
sb.append( hit.toString() ).append( SystemUtils.LINE_SEPARATOR );
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,12 +42,12 @@ public class NexusRepositorySearchTest
|
||||||
|
|
||||||
|
|
||||||
private void createSimpleIndex( boolean scan )
|
private void createSimpleIndex( boolean scan )
|
||||||
throws IOException, UnsupportedExistingLuceneIndexException, IllegalArtifactCoordinateException
|
throws Exception
|
||||||
{
|
{
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test" + TEST_REPO_1
|
||||||
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
|
+ "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
||||||
+ "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
|
+ "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
|
||||||
|
@ -56,36 +56,36 @@ public class NexusRepositorySearchTest
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createIndexContainingMoreArtifacts( boolean scan )
|
private void createIndexContainingMoreArtifacts( boolean scan )
|
||||||
throws IOException, UnsupportedExistingLuceneIndexException, IllegalArtifactCoordinateException
|
throws Exception
|
||||||
{
|
{
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
|
+ "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
|
+ "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/org/apache/archiva/archiva-webapp/1.0/archiva-webapp-1.0.war" ) );
|
+ "/org/apache/archiva/archiva-webapp/1.0/archiva-webapp-1.0.war" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
|
+ "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
|
+ "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/com/classname-search/1.0/classname-search-1.0.jar" ) );
|
+ "/com/classname-search/1.0/classname-search-1.0.jar" ) );
|
||||||
|
|
||||||
createIndex( TEST_REPO_1, files, scan );
|
createIndex( TEST_REPO_1, files, scan );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createIndexContainingMultipleArtifactsSameVersion( boolean scan )
|
private void createIndexContainingMultipleArtifactsSameVersion( boolean scan )
|
||||||
throws IOException, UnsupportedExistingLuceneIndexException, IllegalArtifactCoordinateException
|
throws Exception
|
||||||
{
|
{
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
|
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
"/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
"/org/apache/archiva/archiva-search/1.0/archiva-search-1.0-sources.jar" ) );
|
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0-sources.jar" ) );
|
||||||
|
|
||||||
createIndex( TEST_REPO_1, files, scan );
|
createIndex( TEST_REPO_1, files, scan );
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,42 @@ public class NexusRepositorySearchTest
|
||||||
assertEquals( 1, hit.getVersions().size() );
|
assertEquals( 1, hit.getVersions().size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMultipleArtifactsSameVersionWithClassifier()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
createIndexContainingMultipleArtifactsSameVersion( false );
|
||||||
|
|
||||||
|
List<String> selectedRepos = new ArrayList<String>();
|
||||||
|
selectedRepos.add( TEST_REPO_1 );
|
||||||
|
|
||||||
|
// search artifactId
|
||||||
|
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
|
||||||
|
|
||||||
|
archivaConfigControl.replay();
|
||||||
|
|
||||||
|
SearchFields searchFields = new SearchFields();
|
||||||
|
searchFields.setGroupId( "org.apache.archiva" );
|
||||||
|
searchFields.setArtifactId( "archiva-search" );
|
||||||
|
searchFields.setClassifier( "sources" );
|
||||||
|
searchFields.setRepositories( selectedRepos );
|
||||||
|
|
||||||
|
SearchResults results = search.search( "user", searchFields, null );
|
||||||
|
|
||||||
|
archivaConfigControl.verify();
|
||||||
|
|
||||||
|
assertNotNull( results );
|
||||||
|
assertEquals( 1, results.getTotalHits() );
|
||||||
|
|
||||||
|
SearchResultHit hit = results.getHits().get( 0 );
|
||||||
|
assertEquals( "org.apache.archiva", hit.getGroupId() );
|
||||||
|
assertEquals( "archiva-search", hit.getArtifactId() );
|
||||||
|
assertEquals( "1.0", hit.getVersions().get( 0 ) );
|
||||||
|
|
||||||
|
//only 1 version of 1.0 is retrieved
|
||||||
|
assertEquals( 1, hit.getVersions().size() );
|
||||||
|
}
|
||||||
|
|
||||||
// search for existing artifact using multiple keywords
|
// search for existing artifact using multiple keywords
|
||||||
@Test
|
@Test
|
||||||
public void testQuickSearchWithMultipleKeywords()
|
public void testQuickSearchWithMultipleKeywords()
|
||||||
|
@ -206,7 +242,7 @@ public class NexusRepositorySearchTest
|
||||||
|
|
||||||
assertNotNull( results );
|
assertNotNull( results );
|
||||||
assertEquals( 1, results.getHits().size() );
|
assertEquals( 1, results.getHits().size() );
|
||||||
assertEquals( "total hits not 6 for page1 " + results, 6, results.getTotalHits() );
|
assertEquals( "total hits not 7 for page1 " + results, 7, results.getTotalHits() );
|
||||||
assertEquals( "returned hits not 1 for page1 " + results, 1, results.getReturnedHitsCount() );
|
assertEquals( "returned hits not 1 for page1 " + results, 1, results.getReturnedHitsCount() );
|
||||||
assertEquals( limits, results.getLimits() );
|
assertEquals( limits, results.getLimits() );
|
||||||
|
|
||||||
|
@ -227,7 +263,7 @@ public class NexusRepositorySearchTest
|
||||||
assertNotNull( results );
|
assertNotNull( results );
|
||||||
|
|
||||||
assertEquals( "hits not 1", 1, results.getHits().size() );
|
assertEquals( "hits not 1", 1, results.getHits().size() );
|
||||||
assertEquals( "total hits not 6 for page 2 " + results, 6, results.getTotalHits() );
|
assertEquals( "total hits not 7 for page 2 " + results, 7, results.getTotalHits() );
|
||||||
assertEquals( "returned hits not 1 for page2 " + results, 1, results.getReturnedHitsCount() );
|
assertEquals( "returned hits not 1 for page2 " + results, 1, results.getReturnedHitsCount() );
|
||||||
assertEquals( limits, results.getLimits() );
|
assertEquals( limits, results.getLimits() );
|
||||||
}
|
}
|
||||||
|
@ -239,11 +275,11 @@ public class NexusRepositorySearchTest
|
||||||
createSimpleIndex( true );
|
createSimpleIndex( true );
|
||||||
|
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_2
|
||||||
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_2
|
||||||
+ "/org/apache/archiva/archiva-search/1.1/archiva-search-1.1.jar" ) );
|
+ "/org/apache/archiva/archiva-search/1.1/archiva-search-1.1.jar" ) );
|
||||||
createIndex( TEST_REPO_2, files, true );
|
createIndex( TEST_REPO_2, files, false );
|
||||||
|
|
||||||
List<String> selectedRepos = new ArrayList<String>();
|
List<String> selectedRepos = new ArrayList<String>();
|
||||||
selectedRepos.add( TEST_REPO_1 );
|
selectedRepos.add( TEST_REPO_1 );
|
||||||
|
@ -265,7 +301,7 @@ public class NexusRepositorySearchTest
|
||||||
SearchResultHit hit = results.getHits().get( 0 );
|
SearchResultHit hit = results.getHits().get( 0 );
|
||||||
assertEquals( "org.apache.archiva", hit.getGroupId() );
|
assertEquals( "org.apache.archiva", hit.getGroupId() );
|
||||||
assertEquals( "archiva-search", hit.getArtifactId() );
|
assertEquals( "archiva-search", hit.getArtifactId() );
|
||||||
assertEquals( 2, hit.getVersions().size() );
|
assertEquals("not 2 version for hit " + hit, 2, hit.getVersions().size() );
|
||||||
assertTrue( hit.getVersions().contains( "1.0" ) );
|
assertTrue( hit.getVersions().contains( "1.0" ) );
|
||||||
assertTrue( hit.getVersions().contains( "1.1" ) );
|
assertTrue( hit.getVersions().contains( "1.1" ) );
|
||||||
|
|
||||||
|
@ -367,9 +403,9 @@ public class NexusRepositorySearchTest
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_2
|
||||||
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_2
|
||||||
+ "/org/apache/archiva/archiva-search/1.1/archiva-search-1.1.jar" ) );
|
+ "/org/apache/archiva/archiva-search/1.1/archiva-search-1.1.jar" ) );
|
||||||
createIndex( TEST_REPO_2, files, false );
|
createIndex( TEST_REPO_2, files, false );
|
||||||
|
|
||||||
|
@ -453,9 +489,9 @@ public class NexusRepositorySearchTest
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
|
+ "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
|
||||||
files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
|
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
|
||||||
+ "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
|
+ "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
|
||||||
createIndex( TEST_REPO_1, files, true );
|
createIndex( TEST_REPO_1, files, true );
|
||||||
|
|
||||||
|
@ -616,7 +652,7 @@ public class NexusRepositorySearchTest
|
||||||
archivaConfigControl.verify();
|
archivaConfigControl.verify();
|
||||||
|
|
||||||
assertNotNull( results );
|
assertNotNull( results );
|
||||||
assertEquals( 7, results.getTotalHits() );
|
assertEquals( "not 8 but " + results.getTotalHits() + ":" + niceDisplay( results ), 8, results.getTotalHits() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Binary file not shown.
|
@ -123,6 +123,8 @@ public class Artifact
|
||||||
*/
|
*/
|
||||||
private String bundleRequireBundle;
|
private String bundleRequireBundle;
|
||||||
|
|
||||||
|
private String classifier;
|
||||||
|
|
||||||
|
|
||||||
public Artifact()
|
public Artifact()
|
||||||
{
|
{
|
||||||
|
@ -309,6 +311,16 @@ public class Artifact
|
||||||
this.bundleRequireBundle = bundleRequireBundle;
|
this.bundleRequireBundle = bundleRequireBundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClassifier()
|
||||||
|
{
|
||||||
|
return classifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassifier( String classifier )
|
||||||
|
{
|
||||||
|
this.classifier = classifier;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
|
@ -332,6 +344,7 @@ public class Artifact
|
||||||
sb.append( ", bundleDocUrl='" ).append( bundleDocUrl ).append( '\'' );
|
sb.append( ", bundleDocUrl='" ).append( bundleDocUrl ).append( '\'' );
|
||||||
sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
|
sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
|
||||||
sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
|
sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
|
||||||
|
sb.append( ", classifier='" ).append( classifier ).append( '\'' );
|
||||||
sb.append( '}' );
|
sb.append( '}' );
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.apache.archiva.rest.api.model;
|
package org.apache.archiva.rest.api.model;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ import java.util.List;
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
@XmlRootElement( name = "searchRequest" )
|
||||||
public class SearchRequest
|
public class SearchRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -83,6 +84,8 @@ public class SearchRequest
|
||||||
*/
|
*/
|
||||||
private String bundleExportService;
|
private String bundleExportService;
|
||||||
|
|
||||||
|
private String classifier;
|
||||||
|
|
||||||
public SearchRequest()
|
public SearchRequest()
|
||||||
{
|
{
|
||||||
// no op
|
// no op
|
||||||
|
@ -200,13 +203,33 @@ public class SearchRequest
|
||||||
this.bundleExportService = bundleExportService;
|
this.bundleExportService = bundleExportService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getClassifier()
|
||||||
|
{
|
||||||
|
return classifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassifier( String classifier )
|
||||||
|
{
|
||||||
|
this.classifier = classifier;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "SearchFields{" + "groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", version='"
|
final StringBuilder sb = new StringBuilder();
|
||||||
+ version + '\'' + ", packaging='" + packaging + '\'' + ", className='" + className + '\''
|
sb.append( "SearchRequest" );
|
||||||
+ ", repositories=" + repositories + ", bundleVersion='" + bundleVersion + '\'' + ", bundleSymbolicName='"
|
sb.append( "{groupId='" ).append( groupId ).append( '\'' );
|
||||||
+ bundleSymbolicName + '\'' + ", bundleExportPackage='" + bundleExportPackage + '\''
|
sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
|
||||||
+ ", bundleExportService='" + bundleExportService + '\'' + '}';
|
sb.append( ", version='" ).append( version ).append( '\'' );
|
||||||
|
sb.append( ", packaging='" ).append( packaging ).append( '\'' );
|
||||||
|
sb.append( ", className='" ).append( className ).append( '\'' );
|
||||||
|
sb.append( ", repositories=" ).append( repositories );
|
||||||
|
sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
|
||||||
|
sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
|
||||||
|
sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
|
||||||
|
sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
|
||||||
|
sb.append( ", classifier='" ).append( classifier ).append( '\'' );
|
||||||
|
sb.append( '}' );
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,11 @@ package org.apache.archiva.rest.api.services;
|
||||||
|
|
||||||
import org.apache.archiva.rest.api.model.Artifact;
|
import org.apache.archiva.rest.api.model.Artifact;
|
||||||
import org.apache.archiva.rest.api.model.Dependency;
|
import org.apache.archiva.rest.api.model.Dependency;
|
||||||
|
import org.apache.archiva.rest.api.model.SearchRequest;
|
||||||
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
|
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
|
@ -58,6 +60,13 @@ public interface SearchService
|
||||||
@QueryParam( "artifactId" ) String artifactId )
|
@QueryParam( "artifactId" ) String artifactId )
|
||||||
throws ArchivaRestServiceException;
|
throws ArchivaRestServiceException;
|
||||||
|
|
||||||
|
@Path( "searchArtifacts" )
|
||||||
|
@POST
|
||||||
|
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||||
|
@RedbackAuthorization( noPermission = true, noRestriction = true )
|
||||||
|
List<Artifact> searchArtifacts( SearchRequest searchRequest )
|
||||||
|
throws ArchivaRestServiceException;
|
||||||
|
|
||||||
@Path( "getDependencies" )
|
@Path( "getDependencies" )
|
||||||
@GET
|
@GET
|
||||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||||
|
@ -67,6 +76,7 @@ public interface SearchService
|
||||||
@QueryParam( "version" ) String version )
|
@QueryParam( "version" ) String version )
|
||||||
throws ArchivaRestServiceException;
|
throws ArchivaRestServiceException;
|
||||||
|
|
||||||
|
|
||||||
@Path( "getArtifactByChecksum" )
|
@Path( "getArtifactByChecksum" )
|
||||||
@GET
|
@GET
|
||||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.archiva.indexer.search.SearchResultLimits;
|
||||||
import org.apache.archiva.indexer.search.SearchResults;
|
import org.apache.archiva.indexer.search.SearchResults;
|
||||||
import org.apache.archiva.rest.api.model.Artifact;
|
import org.apache.archiva.rest.api.model.Artifact;
|
||||||
import org.apache.archiva.rest.api.model.Dependency;
|
import org.apache.archiva.rest.api.model.Dependency;
|
||||||
|
import org.apache.archiva.rest.api.model.SearchRequest;
|
||||||
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
|
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
|
||||||
import org.apache.archiva.rest.api.services.SearchService;
|
import org.apache.archiva.rest.api.services.SearchService;
|
||||||
import org.apache.archiva.security.AccessDeniedException;
|
import org.apache.archiva.security.AccessDeniedException;
|
||||||
|
@ -108,8 +109,28 @@ public class DefaultSearchService
|
||||||
log.error( e.getMessage(), e );
|
log.error( e.getMessage(), e );
|
||||||
throw new ArchivaRestServiceException( e.getMessage() );
|
throw new ArchivaRestServiceException( e.getMessage() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Artifact> searchArtifacts( SearchRequest searchRequest )
|
||||||
|
throws ArchivaRestServiceException
|
||||||
|
{
|
||||||
|
if ( searchRequest == null )
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
SearchFields searchField = new BeanReplicator().replicateBean( searchRequest, SearchFields.class );
|
||||||
|
SearchResultLimits limits = new SearchResultLimits( 0 );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SearchResults searchResults = repositorySearch.search( getPrincipal(), searchField, limits );
|
||||||
|
return getArtifacts( searchResults );
|
||||||
|
}
|
||||||
|
catch ( RepositorySearchException e )
|
||||||
|
{
|
||||||
|
log.error( e.getMessage(), e );
|
||||||
|
throw new ArchivaRestServiceException( e.getMessage() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Dependency> getDependencies( String groupId, String artifactId, String version )
|
public List<Dependency> getDependencies( String groupId, String artifactId, String version )
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.archiva.rest.services;
|
||||||
|
|
||||||
import org.apache.archiva.rest.api.model.Artifact;
|
import org.apache.archiva.rest.api.model.Artifact;
|
||||||
import org.apache.archiva.rest.api.model.ManagedRepository;
|
import org.apache.archiva.rest.api.model.ManagedRepository;
|
||||||
|
import org.apache.archiva.rest.api.model.SearchRequest;
|
||||||
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
|
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
|
||||||
import org.apache.archiva.rest.api.services.SearchService;
|
import org.apache.archiva.rest.api.services.SearchService;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
@ -86,6 +87,36 @@ public class SearchServiceTest
|
||||||
deleteTestRepo( testRepoId, targetRepo );
|
deleteTestRepo( testRepoId, targetRepo );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void searchWithSearchRequestGroupIdAndArtifactId()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
String testRepoId = "test-repo";
|
||||||
|
// force guest user creation if not exists
|
||||||
|
if ( getUserService( authorizationHeader ).getGuestUser() == null )
|
||||||
|
{
|
||||||
|
assertNotNull( getUserService( authorizationHeader ).createGuestUser() );
|
||||||
|
}
|
||||||
|
|
||||||
|
File targetRepo = createAndIndexRepo( testRepoId );
|
||||||
|
|
||||||
|
SearchService searchService = getSearchService( authorizationHeader );
|
||||||
|
|
||||||
|
SearchRequest searchRequest = new SearchRequest( );
|
||||||
|
searchRequest.setGroupId( "commons-logging" );
|
||||||
|
searchRequest.setArtifactId( "commons-logging" );
|
||||||
|
searchRequest.setClassifier( "sources" );
|
||||||
|
|
||||||
|
List<Artifact> artifacts = searchService.searchArtifacts( searchRequest );
|
||||||
|
|
||||||
|
assertNotNull( artifacts );
|
||||||
|
assertTrue( " empty results for commons-logging search", artifacts.size() == 6 );
|
||||||
|
log.info( "artifacts for commons-logging size {} search {}", artifacts.size(), artifacts );
|
||||||
|
|
||||||
|
deleteTestRepo( testRepoId, targetRepo );
|
||||||
|
}
|
||||||
|
|
||||||
private File createAndIndexRepo( String testRepoId )
|
private File createAndIndexRepo( String testRepoId )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue