shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lhazlew...@apache.org
Subject svn commit: r738009 - /incubator/jsecurity/trunk/core/test/org/jsecurity/realm/activedirectory/ActiveDirectoryRealmTest.java
Date Tue, 27 Jan 2009 05:53:32 GMT
Author: lhazlewood
Date: Tue Jan 27 05:53:31 2009
New Revision: 738009

URL: http://svn.apache.org/viewvc?rev=738009&view=rev
Log:
minor update to pass a test

Modified:
    incubator/jsecurity/trunk/core/test/org/jsecurity/realm/activedirectory/ActiveDirectoryRealmTest.java

Modified: incubator/jsecurity/trunk/core/test/org/jsecurity/realm/activedirectory/ActiveDirectoryRealmTest.java
URL: http://svn.apache.org/viewvc/incubator/jsecurity/trunk/core/test/org/jsecurity/realm/activedirectory/ActiveDirectoryRealmTest.java?rev=738009&r1=738008&r2=738009&view=diff
==============================================================================
--- incubator/jsecurity/trunk/core/test/org/jsecurity/realm/activedirectory/ActiveDirectoryRealmTest.java
(original)
+++ incubator/jsecurity/trunk/core/test/org/jsecurity/realm/activedirectory/ActiveDirectoryRealmTest.java
Tue Jan 27 05:53:31 2009
@@ -18,6 +18,7 @@
  */
 package org.jsecurity.realm.activedirectory;
 
+import org.jsecurity.SecurityUtils;
 import org.jsecurity.authc.*;
 import org.jsecurity.authc.credential.CredentialsMatcher;
 import org.jsecurity.authz.AuthorizationInfo;
@@ -30,6 +31,7 @@
 import org.jsecurity.subject.PrincipalCollection;
 import org.jsecurity.subject.SimplePrincipalCollection;
 import org.jsecurity.subject.Subject;
+import org.jsecurity.util.ThreadContext;
 import org.junit.After;
 import static org.junit.Assert.assertTrue;
 import org.junit.Before;
@@ -63,16 +65,17 @@
 
     @Before
     public void setup() {
+        ThreadContext.clear();
         realm = new TestActiveDirectoryRealm();
         securityManager = new DefaultSecurityManager(realm);
-
+        SecurityUtils.setSecurityManager(securityManager);
     }
 
     @After
     public void tearDown() {
-        if (securityManager != null) {
-            securityManager.destroy();
-        }
+        SecurityUtils.setSecurityManager(null);
+        securityManager.destroy();
+        ThreadContext.clear();
     }
 
     @Test
@@ -83,7 +86,8 @@
         } catch (UnknownHostException e) {
             e.printStackTrace();
         }
-        Subject subject = securityManager.login(new UsernamePasswordToken(USERNAME, PASSWORD,
localhost));
+        Subject subject = SecurityUtils.getSubject();
+        subject.login(new UsernamePasswordToken(USERNAME, PASSWORD, localhost));
         assertTrue(subject.isAuthenticated());
         assertTrue(subject.hasRole(ROLE));
 



Mime
View raw message