1 18 package org.objectweb.speedo.runtime.jca; 19 20 import org.objectweb.speedo.SpeedoTestHelper; 21 import org.objectweb.speedo.api.SpeedoProperties; 22 import org.objectweb.util.monolog.api.BasicLevel; 23 24 import java.util.Properties ; 25 26 import javax.naming.InitialContext ; 27 28 32 public class TestJCAEmulation extends SpeedoTestHelper { 33 34 static { 35 System.setProperty("java.naming.factory.initial", 36 SimpleNamingManager.class.getName()); 37 } 38 39 public TestJCAEmulation(String s) { 40 super(s); 41 } 42 43 protected String getLoggerName() { 44 return LOG_NAME + ".rt.jca.TestJCAEmulation"; 45 } 46 47 public Properties getPMFProperties() { 48 Properties p = super.getPMFProperties(); 49 String driver = getConnectionDriverNameProperty(p); 50 String user = p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_USER_NAME); 51 String password = p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_PASSWORD); 52 String url = p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_URL); 53 54 final String JNDI_NAME="cf"; 55 try { 56 InitialContext ictx = new InitialContext (); 57 ictx.rebind(JNDI_NAME, new SimpleDataSource(driver, url, user, password)); 58 } catch (Exception e) { 59 System.err.println("Error during the JNDI initialization: " + e.getMessage()); 60 e.printStackTrace(System.err); 61 } 62 p.setProperty(SpeedoProperties.MANAGED, Boolean.TRUE.toString()); 63 p.setProperty(SpeedoProperties.JDO_OPTION_CONNECTION_FACTORY_NAME, JNDI_NAME); 64 return p; 65 } 66 67 public void testEmpty() { 68 assertTrue(true); 69 } 70 } 71 | Popular Tags |