Search in sources :

Example 6 with UnavailableSecurityManagerException

use of org.apache.shiro.UnavailableSecurityManagerException in project shiro by apache.

the class AbstractShiroTest method tearDownShiro.

@AfterClass
public static void tearDownShiro() {
    doClearSubject();
    try {
        SecurityManager securityManager = getSecurityManager();
        LifecycleUtils.destroy(securityManager);
    } catch (UnavailableSecurityManagerException e) {
    // we don't care about this when cleaning up the test environment
    // (for example, maybe the subclass is a unit test and it didn't
    // need a SecurityManager instance because it was using only mock Subject instances)
    }
    setSecurityManager(null);
}
Also used : SecurityManager(org.apache.shiro.mgt.SecurityManager) UnavailableSecurityManagerException(org.apache.shiro.UnavailableSecurityManagerException) AfterClass(org.junit.AfterClass)

Aggregations

UnavailableSecurityManagerException (org.apache.shiro.UnavailableSecurityManagerException)6 SecurityManager (org.apache.shiro.mgt.SecurityManager)3 AfterClass (org.junit.AfterClass)3 Subject (ddf.security.Subject)1 SecurityServiceException (ddf.security.service.SecurityServiceException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ExecutionException (org.apache.shiro.subject.ExecutionException)1 Subject (org.apache.shiro.subject.Subject)1 WebEnvironment (org.apache.shiro.web.env.WebEnvironment)1 WebSubject (org.apache.shiro.web.subject.WebSubject)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1