]> source.dussan.org Git - archiva.git/commitdiff
fix unit tests for RssServlet
authorOlivier Lamy <olamy@apache.org>
Mon, 5 Dec 2011 15:56:07 +0000 (15:56 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 5 Dec 2011 15:56:07 +0000 (15:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1210509 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml

index 48837cc894eee94daf168c62648e8907c06027cd..f66cc7a0215d3c24878dde96fc30f7697e2d2424 100644 (file)
         <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>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java
new file mode 100644 (file)
index 0000000..1984d8e
--- /dev/null
@@ -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.
+    }
+}
index d9d45208e65b6f723f9ae4afa38d72823a75f358..918816df534d82b727b0eeaae0b708128fcb01e5 100644 (file)
@@ -32,10 +32,13 @@ import org.codehaus.plexus.redback.system.SecuritySession;
 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 )
index 4b0b49e88b59ad1a42ac61c007a640dc7ae46924..6e3dc3ec3ca19a258eba22cb768a8e8d23529413 100644 (file)
@@ -63,5 +63,7 @@
       </value>
     </property>
   </bean>
+  
+  <bean name="RoleManagerStub" class="org.apache.archiva.web.rss.RoleManagerStub"/>
 
 </beans>
\ No newline at end of file