1 22 package org.jboss.test.jca.xads; 23 24 import java.sql.SQLException ; 25 26 import javax.naming.InitialContext ; 27 import javax.sql.DataSource ; 28 29 import org.jboss.system.ServiceMBeanSupport; 30 31 public class Test extends ServiceMBeanSupport implements TestMBean 32 { 33 public Test() 34 { 35 System.setProperty("org.jboss.test.jca.xads.SomeProperty", "${org.jboss.test.jca.xads.SomeProperty2}"); 36 System.setProperty("org.jboss.test.jca.xads.SomeProperty2", "DOUBLE REPLACEMENT"); 37 System.setProperty("org.jboss.test.jca.xads.BackSlash", "\\"); 38 } 39 40 public void test() throws Exception 41 { 42 InitialContext ctx = new InitialContext (); 43 DataSource ds = (DataSource ) ctx.lookup("java:/TestXADS"); 44 try 45 { 46 ds.getConnection(); 47 } 48 catch (SQLException expected) 49 { 50 Throwable t = expected; 51 while (t.getCause() != null) 52 t = t.getCause(); 53 54 if (t instanceof SQLException == false) 55 throw new RuntimeException ("Wrong exception: ", t); 56 } 57 } 58 } 59 | Popular Tags |