i have a junit test case that runs a code like:
if (SecurityUtil.isAuthenticated()) {
}
and it gives an exception:
org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager
accessible to the calling code, either bound to the
org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an
invalid application configuration.
My Test Class configuration is as follows:
@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({ WebContextTestExecutionListener.class,
DependencyInjectionTestExecutionListener.class,
DirtiesContextTestExecutionListener.class,
TransactionalTestExecutionListener.class })
@ActiveProfiles("test")
@DirtiesContext
@ContextConfiguration(loader = AnnotationConfigContextLoader.class,
classes = {
SpringConfig.class, SpringTestingConfig.class,
SpringLocalContainerJPAConfig.class, CustomConfiguration.class
})
public class MyTestClass { }
please advise how to fix this error, thanks.
--
View this message in context:
http://shiro-user.582556.n2.nabble.com/org-apache-shiro-UnavailableSecurityManagerException-No-SecurityManager-accessible-to-the-calling-coe-tp7578954.html
Sent from the Shiro User mailing list archive at Nabble.com.