[jboss-cvs] JBossAS SVN: r62265 - trunk/testsuite/src/main/org/jboss/test/security/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 11 12:44:08 EDT 2007
Author: anil.saldhana at jboss.com
Date: 2007-04-11 12:44:08 -0400 (Wed, 11 Apr 2007)
New Revision: 62265
Modified:
trunk/testsuite/src/main/org/jboss/test/security/test/LoginModulesUnitTestCase.java
Log:
use log
Modified: trunk/testsuite/src/main/org/jboss/test/security/test/LoginModulesUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/test/LoginModulesUnitTestCase.java 2007-04-11 16:42:38 UTC (rev 62264)
+++ trunk/testsuite/src/main/org/jboss/test/security/test/LoginModulesUnitTestCase.java 2007-04-11 16:44:08 UTC (rev 62265)
@@ -55,6 +55,7 @@
import junit.framework.TestSuite;
+import org.jboss.logging.Logger;
import org.jboss.security.SimpleGroup;
import org.jboss.security.SimplePrincipal;
import org.jboss.security.Util;
@@ -63,10 +64,8 @@
import org.jboss.security.plugins.JaasSecurityDomain;
import org.jboss.security.auth.callback.UsernamePasswordHandler;
import org.jboss.security.auth.callback.SecurityAssociationHandler;
-import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
-import org.jboss.test.AbstractTestSetup;
-import org.jboss.test.JBossTestCase;
-import org.jboss.test.JBossTestServices;
+import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
+import org.jboss.test.JBossTestCase;
/** Tests of the LoginModule classes.
@@ -76,6 +75,8 @@
public class LoginModulesUnitTestCase extends JBossTestCase
{
+ private static Logger log = Logger.getLogger(LoginModulesUnitTestCase.class);
+
/** Hard coded login configurations for the test cases. The configuration
name corresponds to the unit test function that uses the configuration.
*/
@@ -500,7 +501,7 @@
public void testClientLogin() throws Exception
{
- getLog().info("testClientLogin");
+ log.info("testClientLogin");
UsernamePasswordHandler handler = new UsernamePasswordHandler("scott", "secret".toCharArray());
LoginContext lc = new LoginContext("testClientLogin", handler);
lc.login();
@@ -525,7 +526,7 @@
public void testUsernamePassword() throws Exception
{
- getLog().info("testUsernamePassword");
+ log.info("testUsernamePassword");
UsernamePasswordHandler handler = new UsernamePasswordHandler("scott", "secret".toCharArray());
LoginContext lc = new LoginContext("testUsernamePassword", handler);
lc.login();
@@ -541,7 +542,7 @@
}
public void testUsernamePasswordHash() throws Exception
{
- getLog().info("testUsernamePasswordHash");
+ log.info("testUsernamePasswordHash");
UsernamePasswordHandler handler = new UsernamePasswordHandler("scott", "secret".toCharArray());
LoginContext lc = new LoginContext("testUsernamePasswordHash", handler);
lc.login();
@@ -558,7 +559,7 @@
public void testUsernamePasswordHashWithDigestCallback() throws Exception
{
- getLog().info("testUsernamePasswordHashWithDigestCallback");
+ log.info("testUsernamePasswordHashWithDigestCallback");
// secret in ascii
byte[] passBytes = {115, 101, 99, 114, 101, 116};
String pass = new String(passBytes, "UTF-8");
@@ -578,7 +579,7 @@
public void testUsersRoles() throws Exception
{
- getLog().info("testUsersRoles");
+ log.info("testUsersRoles");
UsernamePasswordHandler handler = new UsernamePasswordHandler("scott", "echoman".toCharArray());
LoginContext lc = new LoginContext("testUsersRoles", handler);
lc.login();
@@ -600,7 +601,7 @@
}
else if( roles.getName().equals("CallerPrincipal") )
{
- getLog().info("CallerPrincipal is "+roles.members().nextElement());
+ log.info("CallerPrincipal is "+roles.members().nextElement());
boolean isMember = roles.isMember(new SimplePrincipal("callerScott"));
assertTrue("CallerPrincipal is callerScott", isMember);
}
@@ -627,7 +628,7 @@
}
else if( roles.getName().equals("CallerPrincipal") )
{
- getLog().info("CallerPrincipal is "+roles.members().nextElement());
+ log.info("CallerPrincipal is "+roles.members().nextElement());
boolean isMember = roles.isMember(new SimplePrincipal("callerStark"));
assertTrue("CallerPrincipal is callerStark", isMember);
}
@@ -635,7 +636,7 @@
lc.logout();
// Test the usernames with common prefix
- getLog().info("Testing similar usernames");
+ log.info("Testing similar usernames");
handler = new UsernamePasswordHandler("jdukeman", "anotherduke".toCharArray());
lc = new LoginContext("testUsersRoles", handler);
lc.login();
@@ -656,7 +657,7 @@
}
else if( roles.getName().equals("CallerPrincipal") )
{
- getLog().info("CallerPrincipal is "+roles.members().nextElement());
+ log.info("CallerPrincipal is "+roles.members().nextElement());
boolean isMember = roles.isMember(new SimplePrincipal("callerJdukeman"));
assertTrue("CallerPrincipal is callerJdukeman", isMember);
}
@@ -666,7 +667,7 @@
public void testUsersRolesHash() throws Exception
{
- getLog().info("testUsersRolesHash");
+ log.info("testUsersRolesHash");
UsernamePasswordHandler handler = new UsernamePasswordHandler("scott", "echoman".toCharArray());
LoginContext lc = new LoginContext("testUsersRolesHash", handler);
lc.login();
@@ -688,7 +689,7 @@
}
else if( roles.getName().equals("CallerPrincipal") )
{
- getLog().info("CallerPrincipal is "+roles.members().nextElement());
+ log.info("CallerPrincipal is "+roles.members().nextElement());
boolean isMember = roles.isMember(new SimplePrincipal("callerScott"));
assertTrue("CallerPrincipal is callerScott", isMember);
}
@@ -698,7 +699,7 @@
public void testAnonUsersRoles() throws Exception
{
- getLog().info("testAnonUsersRoles");
+ log.info("testAnonUsersRoles");
UsernamePasswordHandler handler = new UsernamePasswordHandler(null, null);
LoginContext lc = new LoginContext("testAnonUsersRoles", handler);
lc.login();
@@ -713,7 +714,7 @@
}
public void testAnon() throws Exception
{
- getLog().info("testAnon");
+ log.info("testAnon");
UsernamePasswordHandler handler = new UsernamePasswordHandler(null, null);
LoginContext lc = new LoginContext("testAnon", handler);
lc.login();
@@ -728,7 +729,7 @@
}
public void testNull() throws Exception
{
- getLog().info("testNull");
+ log.info("testNull");
UsernamePasswordHandler handler = new UsernamePasswordHandler(null, null);
LoginContext lc = new LoginContext("testNull", handler);
try
@@ -744,7 +745,7 @@
public void testIdentity() throws Exception
{
- getLog().info("testIdentity");
+ log.info("testIdentity");
LoginContext lc = new LoginContext("testIdentity");
lc.login();
Subject subject = lc.getSubject();
@@ -821,7 +822,7 @@
public void testSimple() throws Exception
{
- getLog().info("testSimple");
+ log.info("testSimple");
UsernamePasswordHandler handler = new UsernamePasswordHandler("jduke", "jduke".toCharArray());
LoginContext lc = new LoginContext("testSimple", handler);
lc.login();
@@ -869,7 +870,7 @@
*/
public void testJdbc() throws Exception
{
- getLog().info("testJdbc");
+ log.info("testJdbc");
Connection conn = setupLoginTables();
try
@@ -895,7 +896,7 @@
public void testControlFlags() throws Exception
{
- getLog().info("testControlFlags");
+ log.info("testControlFlags");
Connection conn = setupLoginTables();
try
@@ -906,7 +907,7 @@
{
assertTrue("testControlFlags flag==SUFFICIENT",
ace[n].getControlFlag() == AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT);
- getLog().info(ace[n].getControlFlag());
+ log.info(ace[n].getControlFlag());
}
/* Test that the UsersRolesLoginModule is sufficient to login. Only the
@@ -942,7 +943,7 @@
roles = (Group) groups.iterator().next();
Enumeration iter = roles.members();
while( iter.hasMoreElements() )
- getLog().debug(iter.nextElement());
+ log.debug(iter.nextElement());
// Only the roles from the DatabaseServerLoginModule should exist
assertTrue("Role1 is NOT a role", !roles.isMember(new SimplePrincipal("Role1")));
assertTrue("Role2 is NOT a role", !roles.isMember(new SimplePrincipal("Role2")));
@@ -958,7 +959,7 @@
public void testCertLogin() throws Exception
{
- getLog().info("testCertLogin");
+ log.info("testCertLogin");
InitialContext ctx = new InitialContext();
ctx.rebind("testCertLogin", new TestSecurityDomain());
@@ -979,7 +980,7 @@
public void testCertRoles() throws Exception
{
- getLog().info("testCertRoles");
+ log.info("testCertRoles");
InitialContext ctx = new InitialContext();
ctx.rebind("testCertRoles", new TestSecurityDomain());
@@ -1011,7 +1012,7 @@
}
else if( roles.getName().equals("CallerPrincipal") )
{
- getLog().info("CallerPrincipal is "+roles.members().nextElement());
+ log.info("CallerPrincipal is "+roles.members().nextElement());
boolean isMember = roles.isMember(new SimplePrincipal("callerX509"));
assertTrue("CallerPrincipal is callerX509", isMember);
}
@@ -1054,14 +1055,14 @@
+ "PrincipalID VARCHAR(64) PRIMARY KEY,"
+ "Password VARCHAR(64) )"
);
- getLog().info("Created Principals table, result="+result);
+ log.info("Created Principals table, result="+result);
result = statement.execute("INSERT INTO Principals VALUES ('scott', 'echoman')");
- getLog().info("INSERT INTO Principals VALUES ('scott', 'echoman'), result="+result);
+ log.info("INSERT INTO Principals VALUES ('scott', 'echoman'), result="+result);
result = statement.execute("INSERT INTO Principals VALUES ('stark', 'javaman')");
- getLog().info("INSERT INTO Principals VALUES ('stark', 'javaman'), result="+result);
+ log.info("INSERT INTO Principals VALUES ('stark', 'javaman'), result="+result);
// This differs from the users.properties jduke settings
result = statement.execute("INSERT INTO Principals VALUES ('jduke', 'jduke')");
- getLog().info("INSERT INTO Principals VALUES ('jduke', 'jduke'), result="+result);
+ log.info("INSERT INTO Principals VALUES ('jduke', 'jduke'), result="+result);
}
private void createRolesTable(Statement statement) throws SQLException
@@ -1079,21 +1080,21 @@
+ "Role VARCHAR(64),"
+ "RoleGroup VARCHAR(64) )"
);
- getLog().info("Created Roles table, result="+result);
+ log.info("Created Roles table, result="+result);
result = statement.execute("INSERT INTO Roles VALUES ('scott', 'Echo', 'Roles')");
- getLog().info("INSERT INTO Roles VALUES ('scott', 'Echo', 'Roles'), result="+result);
+ log.info("INSERT INTO Roles VALUES ('scott', 'Echo', 'Roles'), result="+result);
result = statement.execute("INSERT INTO Roles VALUES ('scott', 'callerScott', 'CallerPrincipal')");
- getLog().info("INSERT INTO Roles VALUES ('scott', 'callerScott', 'CallerPrincipal'), result="+result);
+ log.info("INSERT INTO Roles VALUES ('scott', 'callerScott', 'CallerPrincipal'), result="+result);
result = statement.execute("INSERT INTO Roles VALUES ('stark', 'Java', 'Roles')");
- getLog().info("INSERT INTO Roles VALUES ('stark', 'Java', 'Roles'), result="+result);
+ log.info("INSERT INTO Roles VALUES ('stark', 'Java', 'Roles'), result="+result);
result = statement.execute("INSERT INTO Roles VALUES ('stark', 'Coder', 'Roles')");
- getLog().info("INSERT INTO Roles VALUES ('stark', 'Coder', 'Roles'), result="+result);
+ log.info("INSERT INTO Roles VALUES ('stark', 'Coder', 'Roles'), result="+result);
result = statement.execute("INSERT INTO Roles VALUES ('stark', 'callerStark', 'CallerPrincipal')");
- getLog().info("INSERT INTO Roles VALUES ('stark', 'callerStark', 'CallerPrincipal'), result="+result);
+ log.info("INSERT INTO Roles VALUES ('stark', 'callerStark', 'CallerPrincipal'), result="+result);
result = statement.execute("INSERT INTO Roles VALUES ('jduke', 'Role3', 'Roles')");
- getLog().info("INSERT INTO Roles VALUES ('jduke', 'Role3', 'Roles'), result="+result);
+ log.info("INSERT INTO Roles VALUES ('jduke', 'Role3', 'Roles'), result="+result);
result = statement.execute("INSERT INTO Roles VALUES ('jduke', 'Role4', 'Roles')");
- getLog().info("INSERT INTO Roles VALUES ('jduke', 'Role4', 'Roles'), result="+result);
+ log.info("INSERT INTO Roles VALUES ('jduke', 'Role4', 'Roles'), result="+result);
}
public static void main(java.lang.String[] args)
More information about the jboss-cvs-commits
mailing list