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.UnshareableConnectionSession; 31 import org.jboss.test.jca.interfaces.UnshareableConnectionSessionHome; 32 33 38 39 public class UnsharedConnectionUnitTestCase extends JBossTestCase 40 { 41 42 private UnshareableConnectionSessionHome home; 43 private UnshareableConnectionSession bean; 44 45 public UnsharedConnectionUnitTestCase (String name) 46 { 47 super(name); 48 } 49 50 protected void setSpecCompliant(Boolean value) 51 throws Exception 52 { 53 ObjectName CCM = new ObjectName ("jboss.jca:service=CachedConnectionManager"); 54 getServer().setAttribute(CCM, new Attribute ("SpecCompliant", value)); 55 } 56 57 protected void setUp() throws Exception 58 { 59 setSpecCompliant(Boolean.TRUE); 60 home = (UnshareableConnectionSessionHome)getInitialContext().lookup("UnshareableStateless"); 61 bean = home.create(); 62 } 63 64 protected void tearDown() throws Exception 65 { 66 setSpecCompliant(Boolean.FALSE); 67 } 68 69 public static Test suite() throws Exception 70 { 71 return getDeploySetup(UnsharedConnectionUnitTestCase.class, "jcatest-unshared.jar"); 72 } 73 74 public void testUnsharedConnection() throws Exception 75 { 76 bean.runTest(); 77 } 78 } 79 | Popular Tags |