1 23 24 29 package com.sun.enterprise.management.config; 30 31 import java.util.Map ; 32 import java.util.HashMap ; 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.ConnectorConnectionPoolConfig; 40 import com.sun.appserv.management.config.ConnectorConnectionPoolConfigKeys; 41 42 import com.sun.appserv.management.util.misc.MapUtil; 43 44 46 public final class ConnectorConnectionPoolConfigTest extends ConfigMgrTestBase 47 { 48 private static final String CONNECTOR_DEF_NAME = "javax.resource.cci.ConnectionFactory"; 49 private static final String RESOURCE_ADAPTOR_NAME = "cciblackbox-tx"; 50 private static final Map <String ,String > OPTIONS = MapUtil.newMap( 51 ConnectorConnectionPoolConfigKeys.IGNORE_MISSING_REFERENCES_KEY, "true" ); 52 53 public ConnectorConnectionPoolConfigTest() 54 { 55 if ( checkNotOffline( "ensureDefaultInstance" ) ) 56 { 57 ensureDefaultInstance( getDomainConfig() ); 58 } 59 } 60 61 public static String 62 getDefaultInstanceName() 63 { 64 return getDefaultInstanceName( "ConnectorConnectionPoolConfig" ); 65 } 66 67 public static ConnectorConnectionPoolConfig 68 ensureDefaultInstance( final DomainConfig dc ) 69 { 70 ConnectorConnectionPoolConfig result = 71 dc.getConnectorConnectionPoolConfigMap().get( getDefaultInstanceName() ); 72 73 if ( result == null ) 74 { 75 result = createInstance( dc, getDefaultInstanceName(), 76 ResourceAdapterConfigTest.ensureDefaultInstance( dc ).getName(), 77 CONNECTOR_DEF_NAME, OPTIONS); 78 } 79 80 return result; 81 } 82 83 public static ConnectorConnectionPoolConfig 84 createInstance( 85 final DomainConfig dc, 86 final String name, 87 final String resourceAdapterName, 88 final String connectorDefinitionName, 89 Map <String ,String > optional) 90 { 91 return dc.createConnectorConnectionPoolConfig( name, 92 connectorDefinitionName, resourceAdapterName, optional ); 93 } 94 95 protected Container 96 getProgenyContainer() 97 { 98 return getDomainConfig(); 99 } 100 101 protected String 102 getProgenyJ2EEType() 103 { 104 return XTypes.CONNECTOR_CONNECTION_POOL_CONFIG; 105 } 106 107 protected void 108 removeProgeny( final String name ) 109 { 110 getDomainConfig().removeConnectorConnectionPoolConfig( name ); 111 } 112 113 protected final AMXConfig 114 createProgeny(final String name, final Map <String ,String > options ) 115 { 116 final Map <String ,String > allOptions = MapUtil.newMap( OPTIONS, options ); 117 118 final ConnectorConnectionPoolConfig config = 119 getDomainConfig().createConnectorConnectionPoolConfig( 120 name, 121 RESOURCE_ADAPTOR_NAME, 122 CONNECTOR_DEF_NAME, allOptions); 123 return( config ); 124 } 125 } 126 127 128 | Popular Tags |