1 22 package org.jboss.test.jca.test; 23 24 import javax.naming.InitialContext ; 25 26 import junit.framework.Test; 27 28 import org.jboss.test.JBossTestCase; 29 import org.jboss.test.jca.interfaces.PreparedStatementHome; 30 import org.jboss.test.jca.interfaces.PreparedStatementRemote; 31 32 37 public class PSCacheUnitTestCase extends JBossTestCase 38 { 39 public PSCacheUnitTestCase (String name) 40 { 41 super(name); 42 } 43 44 public void testPreparedStatementCache() throws Exception 45 { 46 log.info("+++ testPreparedStatementCache"); 47 InitialContext ctx = new InitialContext (); 48 PreparedStatementHome home = (PreparedStatementHome) ctx.lookup("PreparedStatementBean"); 49 PreparedStatementRemote bean = home.create("key1", "name1"); 50 bean.testPreparedStatementCache(); 51 bean.remove(); 52 } 53 54 public void testPreparedStatementCacheDoubleClose() throws Exception 55 { 56 log.info("+++ testPreparedStatementCacheDoubleClose"); 57 InitialContext ctx = new InitialContext (); 58 PreparedStatementHome home = (PreparedStatementHome) ctx.lookup("PreparedStatementBean"); 59 PreparedStatementRemote bean = home.create("key1", "name1"); 60 bean.testPreparedStatementCache(); 61 bean.remove(); 62 } 63 64 public void testBasicPreparedStatement() throws Exception 65 { 66 log.info("+++ testBasicPreparedStatement"); 67 InitialContext ctx = new InitialContext (); 68 PreparedStatementHome home = (PreparedStatementHome) ctx.lookup("PreparedStatementBean"); 69 PreparedStatementRemote bean = home.create("key1", "name1"); 70 bean.hashEntityTable(); 71 bean.remove(); 72 } 73 74 public void testCallableStatementCache() throws Exception 75 { 76 log.info("+++ testCallableStatementCache"); 77 InitialContext ctx = new InitialContext (); 78 PreparedStatementHome home = (PreparedStatementHome) ctx.lookup("PreparedStatementBean"); 79 PreparedStatementRemote bean = home.create("key2", "name2"); 80 bean.testCallableStatementCache("callIdentitySQL"); 81 bean.remove(); 82 } 83 84 public void testCallableStatementCacheDoubleClose() throws Exception 85 { 86 log.info("+++ testCallableStatementCacheDobuleClose"); 87 InitialContext ctx = new InitialContext (); 88 PreparedStatementHome home = (PreparedStatementHome) ctx.lookup("PreparedStatementBean"); 89 PreparedStatementRemote bean = home.create("key2", "name2"); 90 bean.testCallableStatementCache("callIdentitySQL"); 91 bean.remove(); 92 } 93 94 public void testBasicCallableStatement() throws Exception 95 { 96 log.info("+++ testBasicCallableStatement"); 97 InitialContext ctx = new InitialContext (); 98 PreparedStatementHome home = (PreparedStatementHome) ctx.lookup("PreparedStatementBean"); 99 PreparedStatementRemote bean = home.create("key2", "name2"); 100 String result = bean.executeStoredProc("callIdentitySQL"); 101 log.info("callIdentitySQL result="+result); 102 bean.remove(); 103 } 104 105 public static Test suite() throws Exception 106 { 107 return getDeploySetup(PSCacheUnitTestCase.class, "pscache.jar"); 108 } 109 } 110 | Popular Tags |