aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java4
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java36
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/release-description/5.0.0/release-description-5.0.0-Patch_20110802_bug1234_v1_fixedAbugInTheStudioGui.txt2
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/release-description/5.0.0/release-description-5.0.0.pom6
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/studio-all-update-site/5.0.0/studio-all-update-site-5.0.0-Patch_20110802_bug1234_v1_fixedAbugInTheStudioGui.zip0
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/studio-all-update-site/5.0.0/studio-all-update-site-5.0.0.pom6
6 files changed, 46 insertions, 8 deletions
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
index 0ba4559bd..1f1b1c798 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
@@ -457,6 +457,10 @@ public class NexusRepositorySearch
for ( ArtifactInfo artifactInfo : artifactInfos )
{
+ if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.fextension ) )
+ {
+ continue;
+ }
String id = SearchUtil.getHitId( artifactInfo.groupId, artifactInfo.artifactId, artifactInfo.classifier,
artifactInfo.packaging );
Map<String, SearchResultHit> hitsMap = results.getHitsMap();
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java
index 4b60ed0ae..088bf13d7 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java
@@ -310,6 +310,34 @@ public class SearchServiceTest
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 )
throws Exception
{
@@ -317,13 +345,6 @@ public class SearchServiceTest
{
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.setId( testRepoId );
@@ -340,7 +361,6 @@ public class SearchServiceTest
getRepositoriesService( authorizationHeader ).scanRepositoryNow( testRepoId, true );
- //return targetRepo;
}
private void deleteTestRepo( String id )
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/release-description/5.0.0/release-description-5.0.0-Patch_20110802_bug1234_v1_fixedAbugInTheStudioGui.txt b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/release-description/5.0.0/release-description-5.0.0-Patch_20110802_bug1234_v1_fixedAbugInTheStudioGui.txt
new file mode 100644
index 000000000..a907ec3f4
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/release-description/5.0.0/release-description-5.0.0-Patch_20110802_bug1234_v1_fixedAbugInTheStudioGui.txt
@@ -0,0 +1,2 @@
+foo
+bar \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/release-description/5.0.0/release-description-5.0.0.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/release-description/5.0.0/release-description-5.0.0.pom
new file mode 100644
index 000000000..ec96f650b
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/release-description/5.0.0/release-description-5.0.0.pom
@@ -0,0 +1,6 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.foo</groupId>
+ <artifactId>release-description</artifactId>
+ <version>5.0.0</version>
+</project> \ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/studio-all-update-site/5.0.0/studio-all-update-site-5.0.0-Patch_20110802_bug1234_v1_fixedAbugInTheStudioGui.zip b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/studio-all-update-site/5.0.0/studio-all-update-site-5.0.0-Patch_20110802_bug1234_v1_fixedAbugInTheStudioGui.zip
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/studio-all-update-site/5.0.0/studio-all-update-site-5.0.0-Patch_20110802_bug1234_v1_fixedAbugInTheStudioGui.zip
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/studio-all-update-site/5.0.0/studio-all-update-site-5.0.0.pom b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/studio-all-update-site/5.0.0/studio-all-update-site-5.0.0.pom
new file mode 100644
index 000000000..f523e78f3
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/repo-with-classifier-only/org/foo/studio-all-update-site/5.0.0/studio-all-update-site-5.0.0.pom
@@ -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> \ No newline at end of file