1 22 package org.jboss.test.security.test; 23 24 import javax.management.MBeanServerConnection ; 25 26 import org.jboss.security.auth.login.XMLLoginConfigMBean; 27 import org.jboss.test.JBossTestCase; 28 29 35 public class LoginConfigInterceptorUnitTestCase 36 extends JBossTestCase 37 { 38 public LoginConfigInterceptorUnitTestCase(String name) 39 { 40 super(name); 41 } 42 43 45 public void testLoginConfigInterceptorWithEjb() 46 throws Exception 47 { 48 getLog().info("+++ testLoginConfigInterceptorWithEjb"); 49 50 MBeanServerConnection server = getServer(); 51 String module = "security-incpt.jar"; 52 53 assertFalse("'other2' domain not registered", 54 isSecurityDomainPresent(server, "other2", "anonymous2")); 55 56 deploy(module); 57 58 assertTrue("'other2' domain registered", 59 isSecurityDomainPresent(server, "other2", "anonymous2")); 60 61 undeploy(module); 62 63 assertFalse("'other2' domain not registered", 64 isSecurityDomainPresent(server, "other2", "anonymous2")); 65 } 66 67 82 private boolean isSecurityDomainPresent(MBeanServerConnection server, String domain, String substr) 83 throws Exception 84 { 85 String result = (String )server.invoke( 86 XMLLoginConfigMBean.OBJECT_NAME, 87 "displayAppConfig", 88 new Object [] { domain }, 89 new String [] { domain.getClass().getName() }); 90 91 return result.indexOf(substr) >= 0; 92 } 93 } | Popular Tags |