FileDocCategorySizeDatePackage
MailResourceConfigTest.javaAPI DocGlassfish v2 API6513Fri May 04 22:23:56 BST 2007com.sun.enterprise.management.config

MailResourceConfigTest

public final class MailResourceConfigTest extends ResourceConfigTestBase

Fields Summary
private static final String
MAIL_RESOURCE_HOST
private static final String
MAIL_RESOURCE_USER
private static final String
MAIL_RESOURCE_FROM
private static final Map
OPTIONS
Constructors Summary
public MailResourceConfigTest()

    
     
    
	    if ( checkNotOffline( "ensureDefaultInstance" ) )
	    {
            ensureDefaultInstance( getDomainConfig() );
        }
    
Methods Summary
public static com.sun.appserv.management.config.MailResourceConfigcreateInstance(com.sun.appserv.management.config.DomainConfig ss, java.lang.String name, java.lang.String host, java.lang.String user, java.lang.String from, java.util.Map optional)

	    return ss.createMailResourceConfig( name, host, user, from, optional );
	
protected final com.sun.appserv.management.config.AMXConfigcreateProgeny(java.lang.String name, java.util.Map options)

	    final MailResourceConfig	config	=
	    	getDomainConfig().createMailResourceConfig( name,
	                                MAIL_RESOURCE_HOST,
	                                MAIL_RESOURCE_USER,
	                                MAIL_RESOURCE_FROM,
	                                options);
		assert( config != null );
		return( config );
	
public static synchronized com.sun.appserv.management.config.MailResourceConfigensureDefaultInstance(com.sun.appserv.management.config.DomainConfig dc)
synchronized because multiple instances are created, and we've chosen to remove/add this resource multiple times for some specific tests.

	    MailResourceConfig result = dc.getMailResourceConfigMap().get( getDefaultInstanceName() );
	    
        /*
        if ( result != null )
        {
            System.out.println( "ensureDefaultInstance(): removing: " +
                JMXUtil.toString( Util.getExtra(result).getObjectName() ) );
            dc.removeMailResourceConfig( result.getName() );
            result  = null;
        }
        */
        
	    if ( result == null )
	    {
	        result  = createInstance( dc, getDefaultInstanceName(),
	            MAIL_RESOURCE_HOST, MAIL_RESOURCE_USER, MAIL_RESOURCE_FROM, OPTIONS);
            assert ! result.getEnabled();
            
            final StandaloneServerConfig serverConfig = dc.getStandaloneServerConfigMap().get( "server" );
            
            final Map<String,String> options = new HashMap<String,String>();
            options.put( ResourceConfigKeys.ENABLED_KEY, "false" );
            final ResourceRefConfig ref = serverConfig.createResourceRefConfig( result.getName(), options );
            assert ! ref.getEnabled();
            
            RefHelper.removeAllRefsTo( result, false );
	    }
	    
	    return result;
	
public static java.lang.StringgetDefaultInstanceName()

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

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

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

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

		getDomainConfig().removeMailResourceConfig( name );