1 22 package org.jboss.test.jca.test; 23 24 import javax.management.Attribute ; 25 import javax.management.ObjectName ; 26 27 import junit.framework.Test; 28 29 import org.jboss.test.JBossTestCase; 30 import org.jboss.test.jca.interfaces.CachedConnectionSession; 31 import org.jboss.test.jca.interfaces.CachedConnectionSessionHome; 32 33 42 43 public class CachedConnectionSessionUnitTestCase extends JBossTestCase 44 { 45 46 private CachedConnectionSessionHome sh; 47 private CachedConnectionSession s; 48 49 public CachedConnectionSessionUnitTestCase (String name) 50 { 51 super(name); 52 } 53 54 protected void setSpecCompliant(Boolean value) 55 throws Exception 56 { 57 ObjectName CCM = new ObjectName ("jboss.jca:service=CachedConnectionManager"); 58 getServer().setAttribute(CCM, new Attribute ("SpecCompliant", value)); 59 } 60 61 protected void setUp() throws Exception 62 { 63 setSpecCompliant(Boolean.TRUE); 64 sh = (CachedConnectionSessionHome)getInitialContext().lookup("CachedConnectionSession"); 65 s = sh.create(); 66 s.createTable(); 67 } 68 69 protected void tearDown() throws Exception 70 { 71 if (s != null) 72 { 73 s.dropTable(); 74 } 76 setSpecCompliant(Boolean.FALSE); 77 } 78 79 public static Test suite() throws Exception 80 { 81 Test t1 = getDeploySetup(CachedConnectionSessionUnitTestCase.class, "jcatest.jar"); 82 Test t2 = getDeploySetup(t1, "testadapter-ds.xml"); 83 return getDeploySetup(t2, "jbosstestadapter.rar"); 84 } 85 86 public void testCachedConnectionSession() throws Exception 87 { 88 s.insert(1L, "testing"); 89 assertTrue("did not get expected value back", "testing".equals(s.fetch(1L))); 90 } 91 92 public void testTLDB() throws Exception 93 { 94 setSpecCompliant(Boolean.FALSE); 95 s.firstTLTest(); 96 } 97 98 } | Popular Tags |