]> source.dussan.org Git - archiva.git/commitdiff
* moved the creation of index into its own method
authorJevica Arianne B. Zurbano <jzurbano@apache.org>
Sat, 15 May 2010 14:41:11 +0000 (14:41 +0000)
committerJevica Arianne B. Zurbano <jzurbano@apache.org>
Sat, 15 May 2010 14:41:11 +0000 (14:41 +0000)
* renamed createIndexForQuickSearch to createSimpleIndex to be used in Advanced Search tests

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@944651 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java

index fc03763a9255cf70fae859c7c799a5638017de21..f180ab0d6757ce22a3aed91f5f8643f687ab0429 100644 (file)
@@ -86,7 +86,7 @@ public class NexusRepositorySearchTest
         config.addManagedRepository( createRepositoryConfig( TEST_REPO_2 ) );
     }
 
-    private void createIndexForQuickSearch()
+    private void createSimpleIndex()
         throws IOException, UnsupportedExistingLuceneIndexException, IllegalArtifactCoordinateException
     {
         List<File> files = new ArrayList<File>();
@@ -99,6 +99,28 @@ public class NexusRepositorySearchTest
 
         createIndex( TEST_REPO_1, files );
     }
+    
+    private void createIndexContainingMoreArtifacts()
+        throws IOException, UnsupportedExistingLuceneIndexException, IllegalArtifactCoordinateException
+    {
+        List<File> files = new ArrayList<File>();
+        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
+            "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
+        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
+            "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
+        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
+            "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
+        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
+        "/org/apache/archiva/archiva-webapp/1.0/archiva-webapp-1.0.war" ) );
+        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
+            "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
+        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
+            "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
+        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
+            "/com/classname-search/1.0/classname-search-1.0.jar" ) );
+        
+        createIndex( TEST_REPO_1, files );
+    }
 
     private ManagedRepositoryConfiguration createRepositoryConfig( String repository )
     {
@@ -156,7 +178,7 @@ public class NexusRepositorySearchTest
     public void testQuickSearch()
         throws Exception
     {   
-        createIndexForQuickSearch();
+        createSimpleIndex();
         
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -199,7 +221,7 @@ public class NexusRepositorySearchTest
     public void testQuickSearchWithMultipleKeywords()
         throws Exception
     {   
-        createIndexForQuickSearch();
+        createSimpleIndex();
         
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -218,7 +240,7 @@ public class NexusRepositorySearchTest
     public void testQuickSearchWithPagination()
         throws Exception
     {   
-        createIndexForQuickSearch();
+        createSimpleIndex();
         
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -263,7 +285,7 @@ public class NexusRepositorySearchTest
     public void testArtifactFoundInMultipleRepositories()
         throws Exception
     {
-        createIndexForQuickSearch();
+        createSimpleIndex();
         
         List<File> files = new ArrayList<File>();
         files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_2 +
@@ -304,7 +326,7 @@ public class NexusRepositorySearchTest
     public void testNoMatchFound()
         throws Exception
     {
-        createIndexForQuickSearch();
+        createSimpleIndex();
         
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -358,7 +380,7 @@ public class NexusRepositorySearchTest
     public void testSearchWithinSearchResults()
         throws Exception
     {
-        createIndexForQuickSearch();
+        createSimpleIndex();
         
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -424,23 +446,7 @@ public class NexusRepositorySearchTest
     public void testAdvancedSearchWithPagination()
         throws Exception
     {
-        List<File> files = new ArrayList<File>();
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-webapp/1.0/archiva-webapp-1.0.war" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/classname-search/1.0/classname-search-1.0.jar" ) );
-        
-        createIndex( TEST_REPO_1, files );
+        createIndexContainingMoreArtifacts();
 
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -596,15 +602,7 @@ public class NexusRepositorySearchTest
     public void testAdvancedSearchAllSearchCriteriaSpecified()
         throws Exception
     {
-        List<File> files = new ArrayList<File>();
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
-
-        createIndex( TEST_REPO_1, files );
+        createSimpleIndex();
         
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -638,23 +636,7 @@ public class NexusRepositorySearchTest
     public void testAdvancedSearchJarArtifacts()
         throws Exception
     {
-        List<File> files = new ArrayList<File>();
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-        "/org/apache/archiva/archiva-webapp/1.0/archiva-webapp-1.0.war" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/classname-search/1.0/classname-search-1.0.jar" ) );
-        
-        createIndex( TEST_REPO_1, files );
+        createIndexContainingMoreArtifacts();
     
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -678,15 +660,7 @@ public class NexusRepositorySearchTest
     public void testAdvancedSearchWithIncorrectPackaging()
         throws Exception
     {
-        List<File> files = new ArrayList<File>();
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
-    
-        createIndex( TEST_REPO_1, files );
+        createSimpleIndex();
         
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );
@@ -712,23 +686,7 @@ public class NexusRepositorySearchTest
     public void testAdvancedSearchClassname()
         throws Exception
     {
-        List<File> files = new ArrayList<File>();
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-        "/org/apache/archiva/archiva-webapp/1.0/archiva-webapp-1.0.war" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
-        files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 +
-            "/com/classname-search/1.0/classname-search-1.0.jar" ) );
-        
-        createIndex( TEST_REPO_1, files );
+        createIndexContainingMoreArtifacts();
     
         List<String> selectedRepos = new ArrayList<String>();
         selectedRepos.add( TEST_REPO_1 );