FileDocCategorySizeDatePackage
RunMeFirstTest.javaAPI DocGlassfish v2 API5155Fri May 04 22:23:50 BST 2007com.sun.enterprise.management

RunMeFirstTest

public final class RunMeFirstTest extends AMXTestBase
This test run prior to testing any AMX MBeans.

Fields Summary
Constructors Summary
public RunMeFirstTest()

	    initCoverageInfos();
	
Methods Summary
private voidinitCoverageInfos()

	    final Set<AMX>  all = getAllAMX();
	    
	    // set the AMX-DEBUG flags on
	    final String AMX_DEBUG  = "-DAMX-DEBUG.enabled=true";
	    final String AMX_DEBUG2  = "-DAMX-DEBUG=true";
	    
	    // set AMX-DEBUG.enabled=true in all ConfigConfig JVM options
	    final Map<String,ConfigConfig> configs = getDomainConfig().getConfigConfigMap();
	    for( final ConfigConfig config : configs.values() )
	    {
	        final JavaConfig jc = config.getJavaConfig();
	        final Set<String>   jvmOptions  = GSetUtil.newStringSet( jc.getJVMOptions() );
	        
	        if ( ! ( jvmOptions.contains( AMX_DEBUG ) || jvmOptions.contains( AMX_DEBUG2 ) ))
	        {
	            jvmOptions.add( AMX_DEBUG );
	            jc.setJVMOptions( GSetUtil.toStringArray( jvmOptions ) );
	            
	            // don't warn for default-config; it's not used by a running server
	            if ( ! config.getName().equals( "default-config" ) )
	            {
    	            warning( "Enabled AMX-DEBUG for config " + config.getName()+
    	                " (restart required)" );
	            }
	        }
	    }
	    
	    // setup default stuff
	    final AMXDebugSupportMBean debug    = getAMXDebugSupportMBean();
	    debug.setAll( true );
	    debug.setDefaultDebug( true );
	    debug.getOutputIDs();
	    
	    for( final AMX amx : all )
	    {
	        final AMXDebugStuff debugStuff  = getTestUtil().asAMXDebugStuff( amx );
	        
	        if ( debugStuff == null )
	        {
	            continue;
	        }
	        
	        try
	        {
                debugStuff.enableAMXDebug( true );
            }
            catch( Throwable t )
            {
                warning( "Couldn't enableAMXDebug() for " + amx.getJ2EEType() );
            }
            
	        try
	        {
                debugStuff.enableCoverageInfo( true );
                debugStuff.clearCoverageInfo();
            }
            catch( Throwable t )
            {
                warning( "Couldn't enableCoverageInfo for " + amx.getJ2EEType() );
            }
	    }