FileDocCategorySizeDatePackage
ConnectorResourceConfigTest.javaAPI DocGlassfish v2 API6268Fri May 04 22:23:54 BST 2007com.sun.enterprise.management.config

ConnectorResourceConfigTest

public final class ConnectorResourceConfigTest extends ResourceConfigTestBase

Fields Summary
Constructors Summary
public ConnectorResourceConfigTest()

	    if ( checkNotOffline( "ensureDefaultInstance" ) )
	    {
            ensureDefaultInstance( getDomainConfig() );
        }
    
Methods Summary
public static com.sun.appserv.management.config.ConnectorResourceConfigcreateInstance(com.sun.appserv.management.config.DomainConfig domainConfig, java.lang.String name, java.lang.String poolName, java.util.Map optional)

	    return  domainConfig.createConnectorResourceConfig(
	            name, poolName, optional );
	
protected final com.sun.appserv.management.config.AMXConfigcreateProgeny(java.lang.String name, java.util.Map options)

	    final String poolName   =
	        ConnectorConnectionPoolConfigTest.ensureDefaultInstance( getDomainConfig() ).getName();
	    
	    assert( getDomainConfig().getConnectorResourceConfigMap().get( name ) == null ) :
	        "A resource already exists with name: " + name;
	    
	    final Set<ResourceRefConfig>  resourceRefs    =
	        getQueryMgr().queryJ2EETypeNameSet(XTypes.RESOURCE_REF_CONFIG,name);
	    
	    ConnectorResourceConfig	config  = null;
	    
	    final Set<ObjectName>   resourceRefObjectNames = Util.toObjectNames( resourceRefs );
	    if ( resourceRefs.size() != 0 )
	    {
	    assert( false );
    	    warning( "A DANGLING resource ref already exists with name: " + name +
    	        ", {" +
    	        CollectionUtil.toString( resourceRefObjectNames ) + "} (SKIPPING TEST)");
	    }
	    else
	    {
    	    config	= getDomainConfig().createConnectorResourceConfig( name,
    				poolName, options );
    				
    	    final Set<ResourceRefConfig>  refs    =
    	        getQueryMgr().queryJ2EETypeNameSet(XTypes.RESOURCE_REF_CONFIG,name);
    	    if ( resourceRefs.size() != 0 )
    	    {
    	        final ResourceRefConfig   ref   = refs.iterator().next();
    	        
    	        warning( "A resource ref within " +
    	            Util.getObjectName( ref.getContainer() ) +
    	            " was automatically created when creating the ConnectorResourceConfig " );
    	    }
	    }
	    	    
		addReference( config );

		return( config );
	
public static com.sun.appserv.management.config.ConnectorResourceConfigensureDefaultInstance(com.sun.appserv.management.config.DomainConfig domainConfig)

	    ConnectorResourceConfig   result  =
	        domainConfig.getConnectorResourceConfigMap().get( getDefaultInstanceName() );
	    
	    final ConnectorConnectionPoolConfig connectorConnectionPool =
	        ConnectorConnectionPoolConfigTest.ensureDefaultInstance( domainConfig );
	    
	    if ( result == null )
	    {
	        result  = createInstance( domainConfig,
	            getDefaultInstanceName(),
	                connectorConnectionPool.getName(), null );
	    }
	    
	    return result;
	
public static java.lang.StringgetDefaultInstanceName()

        return getDefaultInstanceName( "ConnectorResourceConfig" );
    
protected com.sun.appserv.management.base.ContainergetProgenyContainer()

		return getDomainConfig();
	
protected java.lang.StringgetProgenyJ2EEType()

		return XTypes.CONNECTOR_RESOURCE_CONFIG;
	
protected java.lang.StringgetProgenyTestName()

		return( "jndi/ConnectorResourceConfigTest" );
	
protected voidremoveProgeny(java.lang.String name)

	    final Set<ResourceRefConfig>  resourceRefs    =
	        getQueryMgr().queryJ2EETypeNameSet(XTypes.RESOURCE_REF_CONFIG,name);

		getDomainConfig().removeConnectorResourceConfig( name );