mirror of https://github.com/apache/archiva.git
these tests still need to set the principal
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@756621 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3e7a522658
commit
cf807b3db6
|
@ -53,6 +53,8 @@ public abstract class PlexusActionSupport
|
||||||
*/
|
*/
|
||||||
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
||||||
|
|
||||||
|
private String principal;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void setSession( Map map )
|
public void setSession( Map map )
|
||||||
{
|
{
|
||||||
|
@ -116,6 +118,15 @@ public abstract class PlexusActionSupport
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
protected String getPrincipal()
|
protected String getPrincipal()
|
||||||
{
|
{
|
||||||
|
if ( principal != null )
|
||||||
|
{
|
||||||
|
return principal;
|
||||||
|
}
|
||||||
return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
|
return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPrincipal( String principal )
|
||||||
|
{
|
||||||
|
this.principal = principal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,7 @@ public class SearchActionTest
|
||||||
searchControl.replay();
|
searchControl.replay();
|
||||||
daoControl.replay();
|
daoControl.replay();
|
||||||
|
|
||||||
|
action.setPrincipal( "user" );
|
||||||
String result = action.quickSearch();
|
String result = action.quickSearch();
|
||||||
|
|
||||||
assertEquals( Action.SUCCESS, result );
|
assertEquals( Action.SUCCESS, result );
|
||||||
|
@ -206,6 +207,7 @@ public class SearchActionTest
|
||||||
searchControl.replay();
|
searchControl.replay();
|
||||||
daoControl.replay();
|
daoControl.replay();
|
||||||
|
|
||||||
|
action.setPrincipal( "user" );
|
||||||
String result = action.quickSearch();
|
String result = action.quickSearch();
|
||||||
|
|
||||||
assertEquals( Action.SUCCESS, result );
|
assertEquals( Action.SUCCESS, result );
|
||||||
|
@ -230,6 +232,7 @@ public class SearchActionTest
|
||||||
|
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
|
|
||||||
|
action.setPrincipal( "user" );
|
||||||
String result = action.quickSearch();
|
String result = action.quickSearch();
|
||||||
|
|
||||||
assertEquals( GlobalResults.ACCESS_TO_NO_REPOS, result );
|
assertEquals( GlobalResults.ACCESS_TO_NO_REPOS, result );
|
||||||
|
@ -261,6 +264,7 @@ public class SearchActionTest
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
searchControl.replay();
|
searchControl.replay();
|
||||||
|
|
||||||
|
action.setPrincipal( "user" );
|
||||||
String result = action.quickSearch();
|
String result = action.quickSearch();
|
||||||
|
|
||||||
assertEquals( Action.INPUT, result );
|
assertEquals( Action.INPUT, result );
|
||||||
|
@ -357,7 +361,8 @@ public class SearchActionTest
|
||||||
|
|
||||||
searchControl.replay();
|
searchControl.replay();
|
||||||
userReposControl.replay();
|
userReposControl.replay();
|
||||||
|
|
||||||
|
action.setPrincipal( "user" );
|
||||||
String result = action.filteredSearch();
|
String result = action.filteredSearch();
|
||||||
|
|
||||||
assertEquals( Action.SUCCESS, result );
|
assertEquals( Action.SUCCESS, result );
|
||||||
|
|
Loading…
Reference in New Issue