FileDocCategorySizeDatePackage
AMXDebugTest.javaAPI DocGlassfish v2 API6379Fri May 04 22:23:54 BST 2007com.sun.enterprise.management.base

AMXDebugTest

public final class AMXDebugTest extends TestCase

Fields Summary
Constructors Summary
public AMXDebugTest()

	    getAMXDebug().setDefaultDebug( true );
	    getAMXDebug().setAll( true );
	
Methods Summary
private com.sun.appserv.management.base.AMXDebuggetAMXDebug()

        return AMXDebug.getInstance();
    
private java.lang.StringgetID(java.lang.String uniquifier)

        return this.getClass().getName() + "." + uniquifier;
    
private com.sun.appserv.management.util.misc.OutputgetOutput(java.lang.String id)

        return getAMXDebug().getOutput( id );
    
public synchronized voidtestClose()

	    final String    id      = getID( "testClose" );
	    final Output    output  = getOutput( id );
	    final File      outputFile  = getAMXDebug().getOutputFile( id );
	    
	    output.println( "hello" );
	    assert( outputFile.exists() );
	    
	    output.close();
	    outputFile.delete();
	    assert( !outputFile.exists() );
	    
	    output.println( "hello" );
	    assert( outputFile.exists() );
	
public synchronized voidtestCreateFile()

	    // multiple iterations require that we choose a new file each time
	    final String    id      = getID( "testCreateFile" + System.currentTimeMillis() );
	    final Output    output  = getOutput( id );
	    
	    final File  outputFile  = getAMXDebug().getOutputFile( id );
	    outputFile.delete();
	    assert( ! outputFile.exists() );
	    
	    output.printDebug( "test" );
	    assert( outputFile.exists() );
	
public synchronized voidtestMark()

	    final String    id      = getID( "testMark" );
	    final Output    output  = getOutput( id );
	    
	    getAMXDebug().mark( id );
	    getAMXDebug().mark( id, null );
	    getAMXDebug().mark( id, "marker 1" );
	    getAMXDebug().mark( id, "marker 2" );
	    getAMXDebug().mark( output, null );
	    getAMXDebug().mark( output, "marker 3" );
	
public synchronized voidtestPrint()

	    final String    id      = getID( "testPrint" );
	    final Output    output  = getOutput( id );
	    
	    output.printDebug( "printDebug" );
	    output.printError( "printError" );
	    output.println( "println" );
	    output.print( "print" );output.print( "..." );output.print( "END" );
	
public synchronized voidtestReset()

	    final String    id      = getID( "testReset" );
	    final Output    output  = getOutput( id );
	    
	    getAMXDebug().reset( id );
	    final File  outputFile  = getAMXDebug().getOutputFile( id );
	    outputFile.delete();
	    assert( ! outputFile.exists() );
	    output.printDebug( "test" );
	    assert( outputFile.exists() );
	    
	    // make sure we can call it repeatedly
	    getAMXDebug().reset( id );
	    getAMXDebug().reset( id );
	    getAMXDebug().reset( id );
	
public synchronized voidtestSetAll()

	    final String    id      = getID( "testSetAll" );
	    final Output    output  = getOutput( id );
	    
	    getAMXDebug().setAll( false );
	    getAMXDebug().setAll( false );
	    getAMXDebug().setAll( true );
	    getAMXDebug().setAll( true );
	    getAMXDebug().setAll( false );
	    getAMXDebug().setAll( true );
	    getAMXDebug().setAll( true );
	
public synchronized voidtestToggleDebug()

	    final String    id      = getID( "testToggleDebug" );
	    final Output    output  = getOutput( id );
	    
	    getAMXDebug().setDebug( id, false );
	    assert( ! getAMXDebug().getDebug( id ) );
	    getAMXDebug().setDebug( id, true );
	    assert( getAMXDebug().getDebug( id ) );
	
public synchronized voidtestToggleDefaultDebug()

	    final String    id      = getID( "testToggleDefaultDebug" );
	    final Output    output  = getOutput( id );
	    
	    getAMXDebug().setDefaultDebug( false );
	    assert( ! getAMXDebug().getDefaultDebug() );
	    
	    getAMXDebug().setDefaultDebug( true );
	    assert( getAMXDebug().getDefaultDebug() );