rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfrank...@apache.org
Subject svn commit: r1228238 [1/2] - in /incubator/rave/trunk: ./ rave-components/rave-commons/ rave-components/rave-core/src/main/java/org/apache/rave/portal/security/util/ rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/ rave-com...
Date Fri, 06 Jan 2012 15:45:17 GMT
Author: mfranklin
Date: Fri Jan  6 15:45:16 2012
New Revision: 1228238

URL: http://svn.apache.org/viewvc?rev=1228238&view=rev
Log:
Upgraded to Spring 3.1 & Spring Security 3.1 (Fixes RAVE-409)

Removed:
    incubator/rave/trunk/rave-shindig/src/test/resources/META-INF/
Modified:
    incubator/rave/trunk/pom.xml
    incubator/rave/trunk/rave-components/rave-commons/pom.xml
    incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/util/AuthenticationUtils.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/AbstractModelPermissionEvaluatorTest.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultPagePermissionEvaluatorTest.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionPermissionEvaluatorTest.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionWidgetPermissionEvaluatorTest.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetPermissionEvaluatorTest.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetRatingPermissionEvaluatorTest.java
    incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/util/AuthenticationUtilsTest.java
    incubator/rave/trunk/rave-components/rave-web/pom.xml
    incubator/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/applicationContext-security.xml
    incubator/rave/trunk/rave-providers/rave-opensocial-provider/pom.xml

Modified: incubator/rave/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/pom.xml?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/pom.xml (original)
+++ incubator/rave/trunk/pom.xml Fri Jan  6 15:45:16 2012
@@ -45,7 +45,7 @@
 
     <properties>
         <apache.shindig.version>3.0.0-beta4</apache.shindig.version>
-        <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
+        <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
         <org.springframework.mobile.version>1.0.0.M3</org.springframework.mobile.version>        
         <jstl.version>1.2</jstl.version>
         <javax.servlet.version>2.5</javax.servlet.version>
@@ -203,9 +203,34 @@
                 <version>${org.springframework.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-expression</artifactId>
+                <version>${org.springframework.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-tx</artifactId>
+                <version>${org.springframework.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-aop</artifactId>
+                <version>${org.springframework.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>org.springframework.security</groupId>
                 <artifactId>spring-security-web</artifactId>
                 <version>${org.springframework.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.springframework</groupId>
+                        <artifactId>spring-web</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.springframework</groupId>
+                        <artifactId>spring-beans</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>org.springframework.security</groupId>
@@ -225,7 +250,12 @@
             <dependency>
                  <groupId>org.springframework.mobile</groupId>
                  <artifactId>spring-mobile-device</artifactId>
-                 <version>${org.springframework.mobile.version}</version>
+                 <version>${org.springframework.mobile.version}</version>  <exclusions>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring-web</artifactId>
+                </exclusion>
+            </exclusions>
             </dependency>                        
             <dependency>
                 <groupId>com.google.inject.extensions</groupId>

Modified: incubator/rave/trunk/rave-components/rave-commons/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-commons/pom.xml?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-commons/pom.xml (original)
+++ incubator/rave/trunk/rave-components/rave-commons/pom.xml Fri Jan  6 15:45:16 2012
@@ -96,6 +96,16 @@
             <artifactId>hamcrest-all</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjrt</artifactId>
+            <version>1.6.9</version>
+        </dependency>
+        <dependency>
+            <groupId>org.aspectj</groupId>
+            <artifactId>aspectjweaver</artifactId>
+            <version>1.6.9</version>
+        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file

Modified: incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/util/AuthenticationUtils.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/util/AuthenticationUtils.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/util/AuthenticationUtils.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/util/AuthenticationUtils.java Fri Jan  6 15:45:16 2012
@@ -39,7 +39,7 @@ public class AuthenticationUtils {
      * @return true if the role is found, false otherwise
      */
     public static boolean hasRole(Authentication authentication, String role) {
-        Collection<GrantedAuthority> grantedAuthorities = authentication.getAuthorities();
+        Collection<? extends GrantedAuthority> grantedAuthorities = authentication.getAuthorities();
         if (grantedAuthorities == null || role == null || role.isEmpty()) {
             return false;
         }

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/AbstractModelPermissionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/AbstractModelPermissionEvaluatorTest.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/AbstractModelPermissionEvaluatorTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/AbstractModelPermissionEvaluatorTest.java Fri Jan  6 15:45:16 2012
@@ -20,17 +20,20 @@ package org.apache.rave.portal.security.
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import org.apache.rave.portal.security.ModelPermissionEvaluator.Permission;
 import org.apache.rave.portal.security.util.AuthenticationUtils;
 import static org.junit.Assert.*;
 import static org.easymock.EasyMock.*;
 import static org.hamcrest.CoreMatchers.*;
+
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.GrantedAuthorityImpl;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 /**
  *
@@ -57,9 +60,9 @@ public class AbstractModelPermissionEval
     @Test
     public void testHasPermission_authenticationUserIsAdmin() {        
         List<GrantedAuthority> grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(AuthenticationUtils.ROLE_ADMIN));
-                
-        expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
+
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(authentication);
         assertThat(fooModelPermissionEvaluator.hasPermission(authentication, fooModel, Permission.READ), is(true));
         verify(authentication);
@@ -68,9 +71,9 @@ public class AbstractModelPermissionEval
     @Test
     public void testHasPermission_authenticationUserIsNotAdmin() {        
         List<GrantedAuthority> grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl("ROLE_THAT_IS_NOT_ADMIN"));
-                
-        expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_THAT_IS_NOT_ADMIN"));
+
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(authentication);
         assertThat(fooModelPermissionEvaluator.hasPermission(authentication, fooModel, Permission.READ), is(false));
         verify(authentication);

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultPagePermissionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultPagePermissionEvaluatorTest.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultPagePermissionEvaluatorTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultPagePermissionEvaluatorTest.java Fri Jan  6 15:45:16 2012
@@ -20,12 +20,14 @@
 package org.apache.rave.portal.security.impl;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import org.apache.rave.portal.model.Page;
 import org.apache.rave.portal.model.User;
 import org.apache.rave.portal.repository.PageRepository;
 import org.apache.rave.portal.security.ModelPermissionEvaluator.Permission;
 import org.apache.rave.portal.security.util.AuthenticationUtils;
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
 import static org.junit.Assert.*;
@@ -33,7 +35,7 @@ import static org.easymock.EasyMock.*;
 import static org.hamcrest.CoreMatchers.*;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.GrantedAuthorityImpl;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 /**
  *
@@ -67,7 +69,7 @@ public class DefaultPagePermissionEvalua
         page.setEntityId(VALID_PAGE_ID);
         page.setOwner(user);
         grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl("ROLE_USER"));
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
     }
  
    
@@ -77,8 +79,8 @@ public class DefaultPagePermissionEvalua
     }
   
     @Test
-    public void testHasPermission_3args_administer() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_administer() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);              
         assertThat(defaultPagePermissionEvaluator.hasPermission(mockAuthentication, page, Permission.ADMINISTER), is(false));        
         verify(mockAuthentication);
@@ -86,17 +88,17 @@ public class DefaultPagePermissionEvalua
     
     @Test
     public void testHasPermission_3args_administer_hasAdminRole() {                             
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(AuthenticationUtils.ROLE_ADMIN));
-        
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
+
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);              
         assertThat(defaultPagePermissionEvaluator.hasPermission(mockAuthentication, page, Permission.ADMINISTER), is(true));        
         verify(mockAuthentication);
     }    
     
     @Test
-    public void testHasPermission_3args_create_isPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_create_isPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication); 
@@ -107,8 +109,8 @@ public class DefaultPagePermissionEvalua
     }    
     
     @Test
-    public void testHasPermission_3args_create_isNotPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_create_isNotPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication); 
@@ -119,8 +121,8 @@ public class DefaultPagePermissionEvalua
     }       
     
     @Test
-    public void testHasPermission_3args_delete_isPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_delete_isPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -131,8 +133,8 @@ public class DefaultPagePermissionEvalua
     }        
     
     @Test
-    public void testHasPermission_3args_delete_notPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_delete_notPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -143,8 +145,8 @@ public class DefaultPagePermissionEvalua
     }       
     
     @Test
-    public void testHasPermission_3args_read_isPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_read_isPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -155,8 +157,8 @@ public class DefaultPagePermissionEvalua
     }       
     
     @Test
-    public void testHasPermission_3args_read_notPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_read_notPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -167,8 +169,8 @@ public class DefaultPagePermissionEvalua
     }      
     
     @Test
-    public void testHasPermission_3args_update_isPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_update_isPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -179,8 +181,8 @@ public class DefaultPagePermissionEvalua
     }   
     
     @Test
-    public void testHasPermission_3args_update_notPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_3args_update_notPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -191,16 +193,16 @@ public class DefaultPagePermissionEvalua
     }         
     
     @Test
-    public void testHasPermission_4args_administer() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_administer() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);              
         assertThat(defaultPagePermissionEvaluator.hasPermission(mockAuthentication, VALID_PAGE_ID, Page.class.getName(), Permission.ADMINISTER), is(false));        
         verify(mockAuthentication);
     }    
     
     @Test
-    public void testHasPermission_4args_create_isPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_create_isPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -211,8 +213,8 @@ public class DefaultPagePermissionEvalua
     }     
     
     @Test
-    public void testHasPermission_4args_create_isNotPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_create_isNotPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -223,8 +225,8 @@ public class DefaultPagePermissionEvalua
     }         
     
     @Test
-    public void testHasPermission_4args_delete_isPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_delete_isPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -235,8 +237,8 @@ public class DefaultPagePermissionEvalua
     }        
         
     @Test
-    public void testHasPermission_4args_delete_notPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_delete_notPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -247,8 +249,8 @@ public class DefaultPagePermissionEvalua
     }       
     
     @Test
-    public void testHasPermission_4args_read_isPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_read_isPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -259,8 +261,8 @@ public class DefaultPagePermissionEvalua
     }       
     
     @Test
-    public void testHasPermission_4args_read_notPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_read_notPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -271,8 +273,8 @@ public class DefaultPagePermissionEvalua
     }      
     
     @Test
-    public void testHasPermission_4args_update_isPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_update_isPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      
@@ -283,8 +285,8 @@ public class DefaultPagePermissionEvalua
     }   
     
     @Test
-    public void testHasPermission_4args_update_notPageOwner() {                             
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+    public void testHasPermission_4args_update_notPageOwner() {
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockPageRepository.get(VALID_PAGE_ID)).andReturn(page);
         replay(mockAuthentication);      

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionPermissionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionPermissionEvaluatorTest.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionPermissionEvaluatorTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionPermissionEvaluatorTest.java Fri Jan  6 15:45:16 2012
@@ -24,13 +24,15 @@ import org.apache.rave.portal.model.User
 import org.apache.rave.portal.repository.RegionRepository;
 import org.apache.rave.portal.security.ModelPermissionEvaluator;
 import org.apache.rave.portal.security.util.AuthenticationUtils;
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.GrantedAuthorityImpl;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import static org.easymock.EasyMock.*;
@@ -70,7 +72,7 @@ public class DefaultRegionPermissionEval
         region.setEntityId(VALID_REGION_ID);
         region.setPage(page);
         grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl("ROLE_USER"));
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
     }
 
     @Test
@@ -80,7 +82,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_administer() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultRegionPermissionEvaluator.hasPermission(mockAuthentication, region, ModelPermissionEvaluator.Permission.ADMINISTER), is(false));
         verify(mockAuthentication);
@@ -88,8 +90,8 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_administer_hasAdminRole() {
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(AuthenticationUtils.ROLE_ADMIN));
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultRegionPermissionEvaluator.hasPermission(mockAuthentication, region, ModelPermissionEvaluator.Permission.ADMINISTER), is(true));
         verify(mockAuthentication);
@@ -97,7 +99,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_create_isRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -109,7 +111,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_create_isNotRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -121,7 +123,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_delete_isRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -133,7 +135,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_delete_isNotRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -145,7 +147,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_update_isRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -157,7 +159,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_update_isNotRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -169,7 +171,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_read_isRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -181,7 +183,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_3args_read_isNotRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -193,7 +195,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_administer() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultRegionPermissionEvaluator.hasPermission(mockAuthentication, VALID_REGION_ID, Region.class.getName(), ModelPermissionEvaluator.Permission.ADMINISTER), is(false));
         verify(mockAuthentication);
@@ -201,7 +203,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_create_isRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -213,7 +215,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_create_isNotRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -225,7 +227,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_delete_isRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -237,7 +239,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_delete_isNotRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -249,7 +251,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_read_isRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -261,7 +263,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_read_isNotRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -273,7 +275,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_update_isRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);
@@ -285,7 +287,7 @@ public class DefaultRegionPermissionEval
 
     @Test
     public void testHasPermission_4args_update_isNotRegionOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionRepository.get(VALID_REGION_ID)).andReturn(region);
         replay(mockAuthentication);

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionWidgetPermissionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionWidgetPermissionEvaluatorTest.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionWidgetPermissionEvaluatorTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultRegionWidgetPermissionEvaluatorTest.java Fri Jan  6 15:45:16 2012
@@ -25,13 +25,15 @@ import org.apache.rave.portal.model.User
 import org.apache.rave.portal.repository.RegionWidgetRepository;
 import org.apache.rave.portal.security.ModelPermissionEvaluator.Permission;
 import org.apache.rave.portal.security.util.AuthenticationUtils;
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.GrantedAuthorityImpl;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import static org.easymock.EasyMock.*;
@@ -76,7 +78,7 @@ public class DefaultRegionWidgetPermissi
         regionWidget.setEntityId(VALID_REGION_WIDGET_ID);
         regionWidget.setRegion(region);
         grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl("ROLE_USER"));
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
     }
 
     @Test
@@ -86,7 +88,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_administer() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultRegionWidgetPermissionEvaluator.hasPermission(mockAuthentication, regionWidget, Permission.ADMINISTER), is(false));
         verify(mockAuthentication);
@@ -94,8 +96,8 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_administer_hasAdminRole() {
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(AuthenticationUtils.ROLE_ADMIN));
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultRegionWidgetPermissionEvaluator.hasPermission(mockAuthentication, regionWidget, Permission.ADMINISTER), is(true));
         verify(mockAuthentication);
@@ -103,7 +105,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_create_isRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -115,7 +117,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_create_isNotRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -127,7 +129,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_delete_isRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -139,7 +141,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_delete_isNotRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -151,7 +153,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_update_isRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>> expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -163,7 +165,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_update_isNotRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -175,7 +177,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_read_isRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -187,7 +189,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_3args_read_isNotRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -199,7 +201,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_administer() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultRegionWidgetPermissionEvaluator.hasPermission(mockAuthentication, VALID_REGION_WIDGET_ID, RegionWidget.class.getName(), Permission.ADMINISTER), is(false));
         verify(mockAuthentication);
@@ -207,7 +209,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_create_isRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -219,7 +221,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_create_isNotRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -231,7 +233,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_delete_isRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -243,7 +245,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_delete_isNotRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -255,7 +257,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_read_isRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -267,7 +269,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_read_isNotRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -279,7 +281,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_update_isRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);
@@ -291,7 +293,7 @@ public class DefaultRegionWidgetPermissi
 
     @Test
     public void testHasPermission_4args_update_isNotRegionWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockRegionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(regionWidget);
         replay(mockAuthentication);

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java Fri Jan  6 15:45:16 2012
@@ -17,9 +17,12 @@ package org.apache.rave.portal.security.
 
 import org.apache.rave.portal.security.util.AuthenticationUtils;
 import org.apache.rave.portal.model.WidgetComment;
-import org.springframework.security.core.authority.GrantedAuthorityImpl;
+import org.easymock.EasyMock;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import java.util.ArrayList;
 import org.springframework.security.core.GrantedAuthority;
+
+import java.util.Collection;
 import java.util.List;
 import org.apache.rave.portal.model.User;
 import org.springframework.security.core.Authentication;
@@ -64,7 +67,7 @@ public class DefaultWidgetCommentPermiss
         widgetComment.setEntityId(VALID_COMMENT_ID);
         widgetComment.setUser(user);
         grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl("ROLE_USER"));
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
     }
     
     @Test
@@ -74,7 +77,7 @@ public class DefaultWidgetCommentPermiss
     
     @Test
     public void verifyNotAdministrator() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         
         assertThat(defaultWidgetCommentPermissionEvaluator.hasPermission(mockAuthentication, null, Permission.ADMINISTER), is(false));
@@ -86,7 +89,7 @@ public class DefaultWidgetCommentPermiss
     public void verifyAdministrator() {
         List myGrantedAuthoritiesList = new ArrayList();
         myGrantedAuthoritiesList.addAll(grantedAuthoritiesList);
-        myGrantedAuthoritiesList.add(new GrantedAuthorityImpl(AuthenticationUtils.ROLE_ADMIN));
+        myGrantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
         
         expect(mockAuthentication.getAuthorities()).andReturn(myGrantedAuthoritiesList);
         replay(mockAuthentication);
@@ -97,7 +100,7 @@ public class DefaultWidgetCommentPermiss
     
     @Test 
     public void testOwnerPermissions() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
         expect(mockAuthentication.getPrincipal()).andReturn(user).anyTimes();
         replay(mockAuthentication);
         expect(mockWidgetCommentRepository.get(VALID_COMMENT_ID)).andReturn(widgetComment).anyTimes();
@@ -116,7 +119,7 @@ public class DefaultWidgetCommentPermiss
     
     @Test
     public void testNonOwnerPermissions() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
         expect(mockAuthentication.getPrincipal()).andReturn(user2).anyTimes();
         replay(mockAuthentication);
         expect(mockWidgetCommentRepository.get(VALID_COMMENT_ID)).andReturn(widgetComment).anyTimes();
@@ -136,7 +139,7 @@ public class DefaultWidgetCommentPermiss
     
     @Test
     public void testOwnerPermissionsById() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
         expect(mockAuthentication.getPrincipal()).andReturn(user).anyTimes();
         replay(mockAuthentication);
         expect(mockWidgetCommentRepository.get(VALID_COMMENT_ID)).andReturn(widgetComment).anyTimes();
@@ -156,7 +159,7 @@ public class DefaultWidgetCommentPermiss
     
     @Test
     public void testNonOwnerPermissionsById() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
         expect(mockAuthentication.getPrincipal()).andReturn(user2).anyTimes();
         replay(mockAuthentication);
         expect(mockWidgetCommentRepository.get(VALID_COMMENT_ID)).andReturn(widgetComment).anyTimes();
@@ -211,8 +214,8 @@ public class DefaultWidgetCommentPermiss
     @Test
     public void testCreationPremission() {
         //Widget.entityId is not set in this case
-        
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
+
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
         expect(mockAuthentication.getPrincipal()).andReturn(user).anyTimes();
         replay(mockAuthentication);
         

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetPermissionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetPermissionEvaluatorTest.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetPermissionEvaluatorTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetPermissionEvaluatorTest.java Fri Jan  6 15:45:16 2012
@@ -24,13 +24,15 @@ import org.apache.rave.portal.model.User
 import org.apache.rave.portal.repository.WidgetRepository;
 import org.apache.rave.portal.security.ModelPermissionEvaluator;
 import org.apache.rave.portal.security.util.AuthenticationUtils;
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.GrantedAuthorityImpl;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import org.apache.rave.portal.model.WidgetStatus;
@@ -72,7 +74,7 @@ public class DefaultWidgetPermissionEval
         widget.setOwner(user);
         widget.setWidgetStatus(WidgetStatus.PUBLISHED);
         grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl("ROLE_USER"));
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
     }
 
     @Test
@@ -82,7 +84,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_administer() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultWidgetPermissionEvaluator.hasPermission(mockAuthentication, widget, ModelPermissionEvaluator.Permission.ADMINISTER), is(false));
         verify(mockAuthentication);
@@ -90,8 +92,8 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_administer_hasAdminRole() {
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(AuthenticationUtils.ROLE_ADMIN));
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultWidgetPermissionEvaluator.hasPermission(mockAuthentication, widget, ModelPermissionEvaluator.Permission.ADMINISTER), is(true));
         verify(mockAuthentication);
@@ -99,7 +101,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_create_isWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -111,7 +113,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_create_isNotWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -123,7 +125,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_delete_isWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -135,7 +137,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_delete_isNotWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -147,7 +149,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_update_isWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -159,7 +161,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_update_isNotWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -171,7 +173,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_read_isWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -183,7 +185,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_3args_read_isNotWidgetOwner_isPublishedGadget() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -196,8 +198,8 @@ public class DefaultWidgetPermissionEval
     @Test
     public void testHasPermission_3args_read_isNotWidgetOwner_isNotPublishedGadget() {
         widget.setWidgetStatus(WidgetStatus.PREVIEW);
-        
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -209,7 +211,7 @@ public class DefaultWidgetPermissionEval
     
     @Test
     public void testHasPermission_4args_administer() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultWidgetPermissionEvaluator.hasPermission(mockAuthentication, VALID_REGION_ID, Widget.class.getName(), ModelPermissionEvaluator.Permission.ADMINISTER), is(false));
         verify(mockAuthentication);
@@ -217,7 +219,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_4args_create_isWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -229,7 +231,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_4args_create_isNotWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -241,7 +243,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_4args_delete_isWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -253,7 +255,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_4args_delete_isNotWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -265,7 +267,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_4args_read_isWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -277,7 +279,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_4args_read_isNotWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -289,7 +291,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_4args_update_isWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);
@@ -301,7 +303,7 @@ public class DefaultWidgetPermissionEval
 
     @Test
     public void testHasPermission_4args_update_isNotWidgetOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRepository.get(VALID_REGION_ID)).andReturn(widget);
         replay(mockAuthentication);

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetRatingPermissionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetRatingPermissionEvaluatorTest.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetRatingPermissionEvaluatorTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetRatingPermissionEvaluatorTest.java Fri Jan  6 15:45:16 2012
@@ -23,13 +23,15 @@ import org.apache.rave.portal.model.Widg
 import org.apache.rave.portal.repository.WidgetRatingRepository;
 import org.apache.rave.portal.security.ModelPermissionEvaluator;
 import org.apache.rave.portal.security.util.AuthenticationUtils;
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.GrantedAuthorityImpl;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import static org.easymock.EasyMock.*;
@@ -71,7 +73,7 @@ public class DefaultWidgetRatingPermissi
 
         mockAuthentication = createMock(Authentication.class);
         grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl("ROLE_USER"));
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
 
     }
 
@@ -82,7 +84,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_administer() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultWidgetRatingPermissionEvaluator.hasPermission(mockAuthentication, widgetRating, ModelPermissionEvaluator.Permission.ADMINISTER), is(false));
         verify(mockAuthentication);
@@ -91,8 +93,8 @@ public class DefaultWidgetRatingPermissi
     // -------------------
     @Test
     public void testHasPermission_3args_administer_hasAdminRole() {
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(AuthenticationUtils.ROLE_ADMIN));
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultWidgetRatingPermissionEvaluator.hasPermission(mockAuthentication, widgetRating, ModelPermissionEvaluator.Permission.ADMINISTER), is(true));
         verify(mockAuthentication);
@@ -100,7 +102,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_create_isWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         replay(mockAuthentication);
         assertThat(defaultWidgetRatingPermissionEvaluator.hasPermission(mockAuthentication, widgetRating, ModelPermissionEvaluator.Permission.CREATE), is(true));
@@ -109,7 +111,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_create_isNotWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         replay(mockAuthentication);
         assertThat(defaultWidgetRatingPermissionEvaluator.hasPermission(mockAuthentication, widgetRating, ModelPermissionEvaluator.Permission.CREATE), is(false));
@@ -118,7 +120,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_delete_isWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -130,7 +132,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_delete_isNotWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -142,7 +144,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_update_isWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -154,7 +156,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_update_isNotWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -166,7 +168,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_read_isWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -178,7 +180,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_3args_read_isNotWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -190,7 +192,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_administer() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(mockAuthentication);
         assertThat(defaultWidgetRatingPermissionEvaluator.hasPermission(mockAuthentication, VALID_WIDGET_RATING_ID, WidgetRating.class.getName(), ModelPermissionEvaluator.Permission.ADMINISTER), is(false));
         verify(mockAuthentication);
@@ -198,7 +200,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_create_isWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_RATING_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -210,7 +212,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_create_isNotWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_RATING_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -222,7 +224,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_delete_isWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_RATING_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -234,7 +236,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_delete_isNotWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_RATING_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -246,7 +248,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_read_isWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_RATING_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -258,7 +260,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_read_isNotWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_RATING_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -270,7 +272,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_update_isWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_RATING_ID)).andReturn(widgetRating);
         replay(mockAuthentication);
@@ -282,7 +284,7 @@ public class DefaultWidgetRatingPermissi
 
     @Test
     public void testHasPermission_4args_update_isNotWidgetRatingOwner() {
-        expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         expect(mockAuthentication.getPrincipal()).andReturn(user2);
         expect(mockWidgetRatingRepository.get(VALID_WIDGET_RATING_ID)).andReturn(widgetRating);
         replay(mockAuthentication);

Modified: incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/util/AuthenticationUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/util/AuthenticationUtilsTest.java?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/util/AuthenticationUtilsTest.java (original)
+++ incubator/rave/trunk/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/util/AuthenticationUtilsTest.java Fri Jan  6 15:45:16 2012
@@ -18,8 +18,11 @@
  */
 package org.apache.rave.portal.security.util;
 
+import org.easymock.EasyMock;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.GrantedAuthorityImpl;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+
+import java.util.Collection;
 import java.util.List;
 import java.util.ArrayList;
 import org.junit.Before;
@@ -45,9 +48,9 @@ public class AuthenticationUtilsTest {
     @Test
     public void testHasRole() {    
         List<GrantedAuthority> grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(VALID_ROLE));
-                
-        expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(VALID_ROLE));
+
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
         replay(authentication);
         
         assertThat(AuthenticationUtils.hasRole(authentication, VALID_ROLE), is(true));
@@ -60,9 +63,9 @@ public class AuthenticationUtilsTest {
     @Test
     public void testIsAdmin_validAdmin() {
         List<GrantedAuthority> grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(AuthenticationUtils.ROLE_ADMIN));
-                
-        expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN));
+
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(authentication);
         
         assertThat(AuthenticationUtils.isAdmin(authentication), is(true));
@@ -71,9 +74,9 @@ public class AuthenticationUtilsTest {
     @Test
     public void testIsAdmin_notValidAdmin() {
         List<GrantedAuthority> grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
-        grantedAuthoritiesList.add(new GrantedAuthorityImpl(VALID_ROLE));
-                
-        expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList);
+        grantedAuthoritiesList.add(new SimpleGrantedAuthority(VALID_ROLE));
+
+        EasyMock.<Collection<? extends GrantedAuthority>>expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList);
         replay(authentication);
         
         assertThat(AuthenticationUtils.isAdmin(authentication), is(false));

Modified: incubator/rave/trunk/rave-components/rave-web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-components/rave-web/pom.xml?rev=1228238&r1=1228237&r2=1228238&view=diff
==============================================================================
--- incubator/rave/trunk/rave-components/rave-web/pom.xml (original)
+++ incubator/rave/trunk/rave-components/rave-web/pom.xml Fri Jan  6 15:45:16 2012
@@ -53,6 +53,10 @@
             <artifactId>jcl-over-slf4j</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.springframework.security</groupId>
             <artifactId>spring-security-web</artifactId>
         </dependency>



Mime
View raw message