1 22 package org.jboss.test.jca.test; 23 24 import java.net.URL ; 25 import javax.management.ObjectName ; 26 27 import org.jboss.test.JBossTestCase; 28 29 30 39 40 public class DeploymentUnitTestCase extends JBossTestCase 41 { 42 43 public DeploymentUnitTestCase(String name) 44 { 45 super(name); 46 } 47 48 public void testMCFDefaultValues() throws Exception 49 { 50 ObjectName mcfName = new ObjectName ("jboss.jca:service=ManagedConnectionFactory,name=JBossTestCF"); 51 deploy("jbosstestadapter.rar"); 52 try 53 { 54 deploy("testadapter-ds.xml"); 55 try 56 { 57 assertTrue("MCF should be registered", getServer().isRegistered(mcfName)); 58 assertTrue("IntegerProperty should be 2, is " + getAttribute(mcfName, "IntegerProperty"), new Integer (2).equals(getAttribute(mcfName, "IntegerProperty"))); 59 assertTrue("BooleanProperty should be false, is " + getAttribute(mcfName, "BooleanProperty"), Boolean.FALSE.equals(getAttribute(mcfName, "BooleanProperty"))); 60 assertTrue("DoubleProperty should be 5.5, is " + getAttribute(mcfName, "DoubleProperty"), new Double (5.5).equals(getAttribute(mcfName, "DoubleProperty"))); 61 assertTrue("UrlProperty should be 'http://www.jboss.org', is " + getAttribute(mcfName, "UrlProperty"), new URL ("http://www.jboss.org").equals(getAttribute(mcfName, "UrlProperty"))); 62 63 assertTrue("DefaultIntegerProperty should be 3, is " + getAttribute(mcfName, "DefaultIntegerProperty"), new Integer (3).equals(getAttribute(mcfName, "DefaultIntegerProperty"))); 64 65 66 } 67 finally 68 { 69 undeploy("testadapter-ds.xml"); 70 } } 72 finally 73 { 74 undeploy("jbosstestadapter.rar"); 75 } 77 } 78 79 private Object getAttribute(ObjectName mcfName, String attrName) throws Exception 80 { 81 return getServer().invoke(mcfName, 82 "getManagedConnectionFactoryAttribute", 83 new Object [] {attrName}, 84 new String [] {String .class.getName()}); 85 } 86 87 } | Popular Tags |