1 23 24 29 package com.sun.enterprise.management.config; 30 31 import java.util.Collections ; 32 import java.util.Map ; 33 34 import com.sun.appserv.management.base.Container; 35 import com.sun.appserv.management.base.XTypes; 36 37 import com.sun.appserv.management.config.AMXConfig; 38 import com.sun.appserv.management.config.DomainConfig; 39 import com.sun.appserv.management.config.JDBCConnectionPoolConfig; 40 41 43 public final class JDBCConnectionPoolConfigTest extends ConfigMgrTestBase 44 { 45 private static final String JDBC_DATASOURCE_CLASSNAME = "com.pointbase.xa.xaDataSource"; 46 47 48 public JDBCConnectionPoolConfigTest() 49 { 50 if ( checkNotOffline( "ensureDefaultInstance" ) ) 51 { 52 ensureDefaultInstance( getDomainConfig() ); 53 } 54 } 55 56 public static String 57 getDefaultInstanceName() 58 { 59 return getDefaultInstanceName( "JDBCConnectionPoolConfig" ); 60 } 61 62 public static JDBCConnectionPoolConfig 63 ensureDefaultInstance( final DomainConfig domainConfig ) 64 { 65 JDBCConnectionPoolConfig result = 66 domainConfig.getJDBCConnectionPoolConfigMap().get( 67 getDefaultInstanceName() ); 68 69 if ( result == null ) 70 { 71 result = createInstance( domainConfig, 72 getDefaultInstanceName(), JDBC_DATASOURCE_CLASSNAME, null ); 73 } 74 75 return result; 76 } 77 78 public static JDBCConnectionPoolConfig 79 createInstance( 80 final DomainConfig domainConfig, 81 final String name, 82 final String datasourceClassname, 83 final Map <String ,String > optional ) 84 { 85 return domainConfig.createJDBCConnectionPoolConfig( 86 name, datasourceClassname, optional ); 87 } 88 89 90 protected Container 91 getProgenyContainer() 92 { 93 return getDomainConfig(); 94 } 95 96 protected String 97 getProgenyJ2EEType() 98 { 99 return XTypes.JDBC_CONNECTION_POOL_CONFIG; 100 } 101 102 103 protected void 104 removeProgeny( final String name ) 105 { 106 getDomainConfig().removeJDBCConnectionPoolConfig( name ); 107 } 108 109 protected final AMXConfig 110 createProgeny(String name, Map <String ,String > options ) 111 { 112 final JDBCConnectionPoolConfig config = 113 getDomainConfig().createJDBCConnectionPoolConfig( name, 114 JDBC_DATASOURCE_CLASSNAME, 115 options ); 116 assert( config != null ); 117 return( config ); 118 } 119 } 120 121 122 | Popular Tags |