diff options
author | Maria Odea B. Ching <oching@apache.org> | 2009-02-05 09:22:22 +0000 |
---|---|---|
committer | Maria Odea B. Ching <oching@apache.org> | 2009-02-05 09:22:22 +0000 |
commit | caa7128117746c8cfc38786a0c026e81932b3f70 (patch) | |
tree | 8647c375d205e127b4e399a4c03c30f03d7b2d84 /archiva-modules/archiva-web/archiva-webapp | |
parent | 8cbe20762768d23be58fa19b00a4e5a7983d5646 (diff) | |
download | archiva-caa7128117746c8cfc38786a0c026e81932b3f70.tar.gz archiva-caa7128117746c8cfc38786a0c026e81932b3f70.zip |
[MRM-1046]
o added more tests
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@741054 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webapp')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java index 617ca3b24..3210e7364 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java @@ -182,13 +182,60 @@ public class SearchActionTest public void testSearchUserHasNoAccessToAnyRepository() throws Exception { - + action.setQ( "archiva" ); + action.setCurrentPage( 0 ); + + List<String> selectedRepos = new ArrayList<String>(); + + archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user" ); + + userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos ); + + archivaXworkUserControl.replay(); + userReposControl.replay(); + + String result = action.quickSearch(); + + assertEquals( GlobalResults.ACCESS_TO_NO_REPOS, result ); + + archivaXworkUserControl.verify(); + userReposControl.verify(); } public void testNoSearchHits() throws Exception { - + action.setQ( "archiva" ); + action.setCurrentPage( 0 ); + action.setSearchResultsOnly( false ); + action.setCompleteQueryString( "" ); + + List<String> selectedRepos = new ArrayList<String>(); + selectedRepos.add( "internal" ); + selectedRepos.add( "snapshots" ); + + SearchResultLimits limits = new SearchResultLimits( action.getCurrentPage() ); + limits.setPageSize( 30 ); + + SearchResults results = new SearchResults(); + + archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 2 ); + + userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos ); + + searchControl.expectAndReturn( search.search( "user", selectedRepos, "archiva", limits, null ), results ); + + archivaXworkUserControl.replay(); + userReposControl.replay(); + searchControl.replay(); + + String result = action.quickSearch(); + + assertEquals( Action.INPUT, result ); + + archivaXworkUserControl.verify(); + userReposControl.verify(); + searchControl.verify(); } // test pagination or just totalPages? |