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

ProfilerConfigTest

public final class ProfilerConfigTest extends com.sun.enterprise.management.AMXTestBase

Fields Summary
private static final String
NATIVE_LIBRARY_PATH
private static final String
CLASSPATH
Constructors Summary
public ProfilerConfigTest()

	    if ( checkNotOffline( "testIllegalCreate" ) )
	    {
	        ensureDefaultInstance( getConfigConfig().getJavaConfig() );
	    }
	
Methods Summary
public static com.sun.appserv.management.config.ProfilerConfigensureDefaultInstance(com.sun.appserv.management.config.JavaConfig javaConfig)

		ProfilerConfig	prof	= javaConfig.getProfilerConfig( );
		if ( prof == null )
		{
			final String	NAME	= "profiler";
			
			prof = javaConfig.createProfilerConfig( NAME, getOptional() );
			assert prof != null;
		}
		
		return prof;
	
private static java.util.MapgetOptional()

	
	      
	
	
	    final Map<String,String> optional    = new HashMap<String,String>();
	    optional.put( ProfilerConfigKeys.NATIVE_LIBRARY_PATH_KEY, NATIVE_LIBRARY_PATH);
	    optional.put( ProfilerConfigKeys.CLASSPATH_KEY, CLASSPATH);
	    optional.put( ProfilerConfigKeys.ENABLED_KEY, "false");
	    return optional;
	
public synchronized voidtestCreateRemoveProfiler()

	    if ( checkNotOffline( "testIllegalCreate" ) )
	    {
	        ensureDefaultInstance( getConfigConfig().getJavaConfig() );
	        
    	    final JavaConfig    javaConfig    = getConfigConfig().getJavaConfig();
    		
    		javaConfig.removeProfilerConfig();
    		assert javaConfig.getProfilerConfig() == null :
    		    "Can't remove ProfilerConfig from " +
    		        JMXUtil.toString( Util.getObjectName(javaConfig) );
    		
    		ensureDefaultInstance( javaConfig );
    		assert javaConfig.getProfilerConfig() != null;
    		Util.getExtra( javaConfig.getProfilerConfig() ).getMBeanInfo();
    		
    		testGetters( javaConfig.getProfilerConfig() );
    		
    		javaConfig.removeProfilerConfig();
    		ensureDefaultInstance( javaConfig );
    		assert javaConfig.getProfilerConfig() != null;
    		Util.getExtra( javaConfig.getProfilerConfig() ).getMBeanInfo();
    		testGetters( javaConfig.getProfilerConfig() );
		}
	
private voidtestGetters(com.sun.appserv.management.config.ProfilerConfig prof)

	    assert( prof.getClasspath() != null );
	    prof.setClasspath( prof.getClasspath() );
	    
	    assert( prof.getNativeLibraryPath() != null );
	    prof.setNativeLibraryPath( prof.getNativeLibraryPath() );
	    
	    assert( prof.getJVMOptions() != null );
	    prof.setJVMOptions( prof.getJVMOptions() );
	    
	    prof.setEnabled( prof.getEnabled() );