summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2009-03-20 17:02:00 +0000
committerBrett Porter <brett@apache.org>2009-03-20 17:02:00 +0000
commitcf807b3db65c30b4ad3a85346cd21682af70e08e (patch)
tree058fbbf7aad2b91fc3d809460bb8f432e8d4a3b8 /archiva-modules
parent3e7a522658722e1bcf490e8a73d2339ad3360ceb (diff)
downloadarchiva-cf807b3db65c30b4ad3a85346cd21682af70e08e.tar.gz
archiva-cf807b3db65c30b4ad3a85346cd21682af70e08e.zip
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
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java11
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java7
2 files changed, 17 insertions, 1 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
index 03ea5274d..5a1d04da7 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
@@ -53,6 +53,8 @@ public abstract class PlexusActionSupport
*/
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
+ private String principal;
+
@SuppressWarnings("unchecked")
public void setSession( Map map )
{
@@ -116,6 +118,15 @@ public abstract class PlexusActionSupport
@SuppressWarnings( "unchecked" )
protected String getPrincipal()
{
+ if ( principal != null )
+ {
+ return principal;
+ }
return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
}
+
+ void setPrincipal( String principal )
+ {
+ this.principal = principal;
+ }
}
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 ba85a0343..87dff73e1 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
@@ -150,6 +150,7 @@ public class SearchActionTest
searchControl.replay();
daoControl.replay();
+ action.setPrincipal( "user" );
String result = action.quickSearch();
assertEquals( Action.SUCCESS, result );
@@ -206,6 +207,7 @@ public class SearchActionTest
searchControl.replay();
daoControl.replay();
+ action.setPrincipal( "user" );
String result = action.quickSearch();
assertEquals( Action.SUCCESS, result );
@@ -230,6 +232,7 @@ public class SearchActionTest
userReposControl.replay();
+ action.setPrincipal( "user" );
String result = action.quickSearch();
assertEquals( GlobalResults.ACCESS_TO_NO_REPOS, result );
@@ -261,6 +264,7 @@ public class SearchActionTest
userReposControl.replay();
searchControl.replay();
+ action.setPrincipal( "user" );
String result = action.quickSearch();
assertEquals( Action.INPUT, result );
@@ -357,7 +361,8 @@ public class SearchActionTest
searchControl.replay();
userReposControl.replay();
-
+
+ action.setPrincipal( "user" );
String result = action.filteredSearch();
assertEquals( Action.SUCCESS, result );