You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2011/12/05 16:56:08 UTC

svn commit: r1210509 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp: ./ src/test/java/org/apache/archiva/web/rss/ src/test/resources/

Author: olamy
Date: Mon Dec  5 15:56:07 2011
New Revision: 1210509

URL: http://svn.apache.org/viewvc?rev=1210509&view=rev
Log:
fix unit tests for RssServlet

Added:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java   (with props)
Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml?rev=1210509&r1=1210508&r2=1210509&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml Mon Dec  5 15:56:07 2011
@@ -836,6 +836,7 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+          <argLine>-XX:MaxPermSize=256m -client</argLine>
           <runOrder>alphabetical</runOrder>
           <systemPropertyVariables>
             <appserver.base>${project.build.directory}/appserver-base</appserver.base>

Added: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java?rev=1210509&view=auto
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java (added)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java Mon Dec  5 15:56:07 2011
@@ -0,0 +1,117 @@
+package org.apache.archiva.web.rss;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.redback.role.model.RedbackRoleModel;
+import org.springframework.stereotype.Service;
+
+import java.net.URL;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service("RoleManagerStub")
+public class RoleManagerStub
+    implements RoleManager
+{
+    public void loadRoleModel( URL resourceLocation )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void loadRoleModel( RedbackRoleModel model )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void createTemplatedRole( String templateId, String resource )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void removeTemplatedRole( String templateId, String resource )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void updateRole( String templateId, String oldResource, String newResource )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void assignRole( String roleId, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void assignRoleByName( String roleName, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void assignTemplatedRole( String templateId, String resource, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void unassignRole( String roleId, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void unassignRoleByName( String roleName, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public boolean roleExists( String roleId )
+        throws RoleManagerException
+    {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public boolean templatedRoleExists( String templateId, String resource )
+        throws RoleManagerException
+    {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public RedbackRoleModel getModel()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void verifyTemplatedRole( String templateID, String resource )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

Propchange: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java?rev=1210509&r1=1210508&r2=1210509&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java Mon Dec  5 15:56:07 2011
@@ -32,10 +32,13 @@ import org.codehaus.plexus.redback.syste
 import org.codehaus.plexus.redback.system.SecuritySystem;
 import org.codehaus.plexus.redback.users.User;
 import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.redback.users.UserManagerListener;
 import org.codehaus.plexus.redback.users.UserNotFoundException;
+import org.codehaus.plexus.redback.users.UserQuery;
 import org.codehaus.plexus.redback.users.jdo.JdoUser;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -126,7 +129,437 @@ public class SecuritySystemStub
 
     public UserManager getUserManager()
     {
-        return null;
+        return new UserManager()
+        {
+            public boolean isReadOnly()
+            {
+                return false;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public String getId()
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void addUserManagerListener( UserManagerListener listener )
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void removeUserManagerListener( UserManagerListener listener )
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User createUser( String username, String fullName, String emailAddress )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User createGuestUser()
+            {
+                return new User()
+                {
+                    public Object getPrincipal()
+                    {
+                        return "guest";
+                    }
+
+                    public String getUsername()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setUsername( String name )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getFullName()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setFullName( String name )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getEmail()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setEmail( String address )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getPassword()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPassword( String rawPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getEncodedPassword()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setEncodedPassword( String encodedPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getLastPasswordChange()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLastPasswordChange( Date passwordChangeDate )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public List<String> getPreviousEncodedPasswords()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPreviousEncodedPasswords( List<String> encodedPasswordList )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void addPreviousEncodedPassword( String encodedPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isPermanent()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPermanent( boolean permanent )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isLocked()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLocked( boolean locked )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isPasswordChangeRequired()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPasswordChangeRequired( boolean changeRequired )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isValidated()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setValidated( boolean valid )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public int getCountFailedLoginAttempts()
+                    {
+                        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setCountFailedLoginAttempts( int count )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getAccountCreationDate()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setAccountCreationDate( Date date )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getLastLoginDate()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLastLoginDate( Date date )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+                };
+            }
+
+            public UserQuery createUserQuery()
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> getUsers()
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> getUsers( boolean orderAscending )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User addUser( User user )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User updateUser( User user )
+                throws UserNotFoundException
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User findUser( String username )
+                throws UserNotFoundException
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User getGuestUser()
+                throws UserNotFoundException
+            {
+                return new User()
+                {
+                    public Object getPrincipal()
+                    {
+                        return "guest";
+                    }
+
+                    public String getUsername()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setUsername( String name )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getFullName()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setFullName( String name )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getEmail()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setEmail( String address )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getPassword()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPassword( String rawPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getEncodedPassword()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setEncodedPassword( String encodedPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getLastPasswordChange()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLastPasswordChange( Date passwordChangeDate )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public List<String> getPreviousEncodedPasswords()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPreviousEncodedPasswords( List<String> encodedPasswordList )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void addPreviousEncodedPassword( String encodedPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isPermanent()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPermanent( boolean permanent )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isLocked()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLocked( boolean locked )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isPasswordChangeRequired()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPasswordChangeRequired( boolean changeRequired )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isValidated()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setValidated( boolean valid )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public int getCountFailedLoginAttempts()
+                    {
+                        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setCountFailedLoginAttempts( int count )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getAccountCreationDate()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setAccountCreationDate( Date date )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getLastLoginDate()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLastLoginDate( Date date )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+                };
+            }
+
+            public List<User> findUsersByUsernameKey( String usernameKey, boolean orderAscending )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> findUsersByFullNameKey( String fullNameKey, boolean orderAscending )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> findUsersByEmailKey( String emailKey, boolean orderAscending )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> findUsersByQuery( UserQuery query )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User findUser( Object principal )
+                throws UserNotFoundException
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public boolean userExists( Object principal )
+            {
+                return false;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void deleteUser( Object principal )
+                throws UserNotFoundException
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void deleteUser( String username )
+                throws UserNotFoundException
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void addUserUnchecked( User user )
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void eraseDatabase()
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User updateUser( User user, boolean passwordChangeRequired )
+                throws UserNotFoundException
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+        };
     }
 
     public boolean isAuthenticated( AuthenticationDataSource arg0 )

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml?rev=1210509&r1=1210508&r2=1210509&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml Mon Dec  5 15:56:07 2011
@@ -63,5 +63,7 @@
       </value>
     </property>
   </bean>
+  
+  <bean name="RoleManagerStub" class="org.apache.archiva.web.rss.RoleManagerStub"/>
 
 </beans>
\ No newline at end of file