1 28 package net.sf.jguard.ext.authorization.manager; 29 30 import java.util.Properties ; 31 32 import junit.framework.TestCase; 33 import junitx.util.PrivateAccessor; 34 import net.sf.jguard.ext.SecurityConstants; 35 import net.sf.jguard.ext.database.ConnectionFactory; 36 import net.sf.jguard.ext.database.DatabaseTestCase; 37 38 public class JdbcAuthorizationManagerTest extends DatabaseTestCase { 39 40 41 public void setUp(){ 42 super.setUp(); 43 setProperties("/authorization."+database+".properties"); 44 DatabaseTestCase.getOptions().put(SecurityConstants.AUTHORIZATION_DATABASE_FILE_LOCATION,DatabaseTestCase.getPropertiesURIPath()); 45 } 46 47 48 51 public void testInit() { 52 AuthorizationManager jdbcAuthManager = new JdbcAuthorizationManager(); 53 try{ 54 jdbcAuthManager.init(DatabaseTestCase.getOptions()); 55 }catch(Exception e){ 56 TestCase.fail(); 57 } 58 59 60 } 61 62 65 public void testCreateRequiredDatabaseEntities() { 66 67 Class [] parameterTypes = {Properties .class,ConnectionFactory.class}; 68 Object [] parameterValues = {DatabaseTestCase.getProperties(),DatabaseTestCase.getConnectionFactory()}; 69 70 try { 71 PrivateAccessor.invoke(JdbcAuthorizationManager.class,"createRequiredDatabaseEntities",parameterTypes,parameterValues); 72 }catch(Throwable e){ 73 System.out.println(e); 74 TestCase.fail(" JdbcAuthorizationManager.createRequiredDatabaseEntities fail "); 75 } 76 } 77 78 } 79 | Popular Tags |