mirror of https://github.com/apache/archiva.git
not return pom artifacts when searching artifacts
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1203364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
098ffbc90a
commit
6eb766e9d9
|
@ -457,6 +457,10 @@ public class NexusRepositorySearch
|
||||||
|
|
||||||
for ( ArtifactInfo artifactInfo : artifactInfos )
|
for ( ArtifactInfo artifactInfo : artifactInfos )
|
||||||
{
|
{
|
||||||
|
if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.fextension ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String id = SearchUtil.getHitId( artifactInfo.groupId, artifactInfo.artifactId, artifactInfo.classifier,
|
String id = SearchUtil.getHitId( artifactInfo.groupId, artifactInfo.artifactId, artifactInfo.classifier,
|
||||||
artifactInfo.packaging );
|
artifactInfo.packaging );
|
||||||
Map<String, SearchResultHit> hitsMap = results.getHitsMap();
|
Map<String, SearchResultHit> hitsMap = results.getHitsMap();
|
||||||
|
|
|
@ -310,6 +310,34 @@ public class SearchServiceTest
|
||||||
deleteTestRepo( testRepoId );
|
deleteTestRepo( testRepoId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
/**
|
||||||
|
* test we don't return 2 artifacts pom + zip one
|
||||||
|
*/
|
||||||
|
public void getSearchArtifactsWithOnlyClassifier()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
String testRepoId = "test-repo";
|
||||||
|
// force guest user creation if not exists
|
||||||
|
if ( getUserService( authorizationHeader ).getGuestUser() == null )
|
||||||
|
{
|
||||||
|
assertNotNull( getUserService( authorizationHeader ).createGuestUser() );
|
||||||
|
}
|
||||||
|
|
||||||
|
createAndIndexRepo( testRepoId, "src/test/repo-with-classifier-only" );
|
||||||
|
|
||||||
|
SearchService searchService = getSearchService( authorizationHeader );
|
||||||
|
|
||||||
|
SearchRequest searchRequest =
|
||||||
|
new SearchRequest( "org.foo", "studio-all-update-site", null, null, null, Arrays.asList( "test-repo" ) );
|
||||||
|
|
||||||
|
List<Artifact> artifacts = searchService.searchArtifacts( searchRequest );
|
||||||
|
log.info( "artifacts:" + artifacts );
|
||||||
|
assertEquals( 1, artifacts.size() );
|
||||||
|
deleteTestRepo( testRepoId );
|
||||||
|
}
|
||||||
|
|
||||||
private void createAndIndexRepo( String testRepoId, String repoPath )
|
private void createAndIndexRepo( String testRepoId, String repoPath )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -317,13 +345,6 @@ public class SearchServiceTest
|
||||||
{
|
{
|
||||||
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( testRepoId, false );
|
getManagedRepositoriesService( authorizationHeader ).deleteManagedRepository( testRepoId, false );
|
||||||
}
|
}
|
||||||
//File targetRepo = new File( "target/test-origin-repo" );
|
|
||||||
//if ( targetRepo.exists() )
|
|
||||||
//{
|
|
||||||
// FileUtils.deleteDirectory( targetRepo );
|
|
||||||
//}
|
|
||||||
//assertFalse( targetRepo.exists() );
|
|
||||||
//FileUtils.copyDirectory( new File( "src/test/repo-with-osgi" ), targetRepo );
|
|
||||||
|
|
||||||
ManagedRepository managedRepository = new ManagedRepository();
|
ManagedRepository managedRepository = new ManagedRepository();
|
||||||
managedRepository.setId( testRepoId );
|
managedRepository.setId( testRepoId );
|
||||||
|
@ -340,7 +361,6 @@ public class SearchServiceTest
|
||||||
|
|
||||||
getRepositoriesService( authorizationHeader ).scanRepositoryNow( testRepoId, true );
|
getRepositoriesService( authorizationHeader ).scanRepositoryNow( testRepoId, true );
|
||||||
|
|
||||||
//return targetRepo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteTestRepo( String id )
|
private void deleteTestRepo( String id )
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
foo
|
||||||
|
bar
|
|
@ -0,0 +1,6 @@
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.foo</groupId>
|
||||||
|
<artifactId>release-description</artifactId>
|
||||||
|
<version>5.0.0</version>
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.foo</groupId>
|
||||||
|
<artifactId>studio-all-update-site</artifactId>
|
||||||
|
<version>5.0.0</version>
|
||||||
|
</project>
|
Loading…
Reference in New Issue