[MRM-1046]

o added more tests


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@741054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2009-02-05 09:22:22 +00:00
parent 8cbe207627
commit caa7128117
1 changed files with 49 additions and 2 deletions

View File

@ -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?