]> source.dussan.org Git - archiva.git/commitdiff
these tests still need to set the principal
authorBrett Porter <brett@apache.org>
Fri, 20 Mar 2009 17:02:00 +0000 (17:02 +0000)
committerBrett Porter <brett@apache.org>
Fri, 20 Mar 2009 17:02:00 +0000 (17:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@756621 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java

index 03ea5274d9498ec3961c4757f12fb000df42edba..5a1d04da7fc84d6d00de20dcb049151bc1da1f09 100644 (file)
@@ -53,6 +53,8 @@ public abstract class PlexusActionSupport
      */\r
     private List<AuditListener> auditListeners = new ArrayList<AuditListener>();\r
 \r
+    private String principal;\r
+\r
     @SuppressWarnings("unchecked")\r
     public void setSession( Map map )\r
     {\r
@@ -116,6 +118,15 @@ public abstract class PlexusActionSupport
     @SuppressWarnings( "unchecked" )\r
     protected String getPrincipal()\r
     {\r
+        if ( principal != null )\r
+        {\r
+            return principal;\r
+        }\r
         return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );\r
     }\r
+    \r
+    void setPrincipal( String principal )\r
+    {\r
+        this.principal = principal;\r
+    }\r
 }\r
index ba85a0343479d6f13a04b6c4671b07b43996d390..87dff73e1d7f0c40357201b536bdf53b16aa813c 100644 (file)
@@ -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 );