mirror of https://github.com/apache/archiva.git
[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:
parent
8cbe207627
commit
caa7128117
|
@ -182,13 +182,60 @@ public class SearchActionTest
|
||||||
public void testSearchUserHasNoAccessToAnyRepository()
|
public void testSearchUserHasNoAccessToAnyRepository()
|
||||||
throws Exception
|
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()
|
public void testNoSearchHits()
|
||||||
throws Exception
|
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?
|
// test pagination or just totalPages?
|
||||||
|
|
Loading…
Reference in New Issue