1 22 package org.jboss.ejb3.test; 23 24 import java.io.IOException ; 25 import java.io.InputStream ; 26 import java.util.Properties ; 27 28 import javax.naming.InitialContext ; 29 30 import org.jboss.test.JBossTestServices; 31 32 40 public class CustomJNDIJBossTestServices extends JBossTestServices 41 { 42 43 public CustomJNDIJBossTestServices(Class clazz) 44 { 45 super(clazz); 46 } 47 public CustomJNDIJBossTestServices(String className) 48 { 49 super(className); 50 } 51 52 protected Properties getCustomJNDIProperties() throws IOException 53 { 54 InputStream in = getClass().getClassLoader().getResourceAsStream("custom.jndi.properties"); 55 if(in == null) 56 { 57 log.debug("no custom.jndi.properties found using defaults"); 58 return null; 59 } 60 Properties props = new Properties (); 61 props.load(in); 62 in.close(); 63 return props; 64 } 65 66 @Override 67 public void init() throws Exception 68 { 69 if(initialContext == null) 70 { 71 initialContext = new InitialContext (getCustomJNDIProperties()); 72 log.debug("initialContext.getEnvironment()=" + initialContext.getEnvironment()); 73 jndiEnv = initialContext.getEnvironment(); 74 75 log.debug("server = " + getServer()); 76 } 77 } 78 79 protected boolean isSecureTest() 80 { 81 return Boolean.getBoolean("jbosstest.secure"); 82 } 83 } 84 | Popular Tags |