KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jguard > ext > authentication > manager > JdbcAuthenticationManagerTest


1 package net.sf.jguard.ext.authentication.manager;
2
3 import java.util.Set JavaDoc;
4
5 import net.sf.jguard.ext.SecurityConstants;
6 import net.sf.jguard.ext.database.DatabaseTestCase;
7
8 public class JdbcAuthenticationManagerTest extends DatabaseTestCase {
9     
10     public void setUp(){
11         super.setUp();
12
13         setProperties("/authentication."+database+".properties");
14         DatabaseTestCase.getOptions().put(SecurityConstants.AUTHENTICATION_DATABASE_FILE_LOCATION,DatabaseTestCase.getPropertiesURIPath());
15         
16     }
17     
18     public void testInit()throws Exception JavaDoc{
19     //all the stuff is present in setup method
20

21     }
22     
23     public void testGetAllPrincipalsSet()throws Exception JavaDoc{
24         JdbcAuthenticationManager authManager = new JdbcAuthenticationManager();
25         authManager.init(DatabaseTestCase.getOptions());
26         AuthenticationManagerFactory.setAuthenticationManager(authManager);
27         Set JavaDoc principals = authManager.getAllPrincipalsSet();
28         System.out.println(principals);
29         
30     }
31     
32     public void testGetUsers()throws Exception JavaDoc{
33         JdbcAuthenticationManager authManager = new JdbcAuthenticationManager();
34         authManager.init(DatabaseTestCase.getOptions());
35         AuthenticationManagerFactory.setAuthenticationManager(authManager);
36         Set JavaDoc users = authManager.getUsers();
37         System.out.println(users);
38         
39     }
40 }
41
Popular Tags