1 22 package org.jboss.test.jmx.test; 23 24 import javax.management.ObjectName ; 25 26 import org.jboss.test.JBossTestCase; 27 import org.jboss.deployment.IncompleteDeploymentException; 28 29 32 public class MBeanDependsOnConnectionManagerUnitTestCase extends JBossTestCase 33 { 34 ObjectName serviceControllerName; 36 37 public MBeanDependsOnConnectionManagerUnitTestCase( String name ) 38 { 39 super( name ); 40 try 41 { 42 serviceControllerName = new ObjectName ( "jboss.system:service=ServiceController" ); 43 } 44 catch ( Exception e ) 45 { 46 } } 48 49 public void testMBeanDependsOnConnectionManager() throws Exception 50 { 51 String mBeanCodeUrl = "testdeploy.sar"; 52 String mBeanUrl = "testmbeandependsOnConnectionManager-service.xml"; 53 String connectionManagerUrl = "hsqldb-singleconnection-ds.xml"; 54 55 ObjectName objectNameMBean = new ObjectName ( "test:name=TestMBeanDependsOnConnectionManager" ); 56 ObjectName objectNameConnectionManager = new ObjectName ( "jboss.jca:service=DataSourceBinding,name=SingleConnectionDS" ); 57 58 deploy( mBeanCodeUrl ); 59 try 60 { 61 deploy( connectionManagerUrl ); 62 try 63 { 64 deploy( mBeanUrl ); 65 try 66 { 67 68 try 69 { 70 undeploy( connectionManagerUrl ); 71 deploy( connectionManagerUrl ); 72 } 73 catch ( IncompleteDeploymentException ex ) 74 { 75 getLog().info("incomplete deployment exception", ex); 76 fail( "Connection Pool could not be recycled successfully!" ); 77 } 78 79 String mBeanState = (String )getServer().getAttribute( objectNameMBean, "StateString" ); 81 assertEquals( "Test MBean not started!", "Started", mBeanState ); 82 String connectionManagerState = (String )getServer().getAttribute( 83 objectNameConnectionManager, "StateString" ); 84 assertEquals( "Connnection Manager MBean not started!", "Started", connectionManagerState ); 85 } 86 finally 87 { 88 undeploy( mBeanUrl ); 89 } 90 } 91 finally 92 { 93 undeploy( connectionManagerUrl ); 94 } 95 } 96 finally 97 { 98 undeploy( mBeanCodeUrl ); 99 } 100 } 101 } 102 | Popular Tags |