Methods Summary |
---|
protected void | checkAssertsOn()
try
{
assert( false );
throw new Error( "Assertions must be enabled for unit tests" );
}
catch( AssertionError a )
{
}
|
protected void | failure(java.lang.String msg)
trace( "\nFAILURE: " + msg + "\n" );
assert( false ) : msg;
throw new Error( msg );
|
public static java.lang.Boolean | getEnvBoolean(java.lang.String key, java.lang.Boolean defaultValue)
Boolean result = defaultValue;
final String s = getEnvString( key, null );
if ( s != null )
{
result = Boolean.valueOf( s );
}
return( result );
|
public static java.lang.Integer | getEnvInteger(java.lang.String key, java.lang.Integer defaultValue)
final String s = getEnvString( key, null);
Integer result = defaultValue;
if ( s != null )
{
result = new Integer( s.trim() );
}
return( result );
|
public static java.lang.String | getEnvString(java.lang.String key, java.lang.String defaultValue)
final String s = (String)getEnvValue( key );
return( s == null ? defaultValue : s );
|
public static synchronized java.lang.Object | getEnvValue(java.lang.String key)
return( sEnv == null ? null : sEnv.get( key ) );
|
public static javax.management.MBeanServerConnection | getGlobalConnection()
return( getMBeanServerConnection() );
|
public static javax.management.MBeanServerConnection | getMBeanServerConnection()
return( sConn );
|
protected boolean | getVerbose()
final String value = (String)getEnvValue( PropertyKeys.VERBOSE_KEY );
return( value != null && Boolean.valueOf( value ).booleanValue() );
|
private static synchronized void | initEnv()
if ( sEnv == null )
{
sEnv = new HashMap<String,Object>();
}
|
protected T | newProxy(javax.management.ObjectName target, java.lang.Class interfaceClass)
try
{
assert getMBeanServerConnection().isRegistered( target );
}
catch( java.io.IOException e )
{
throw new RuntimeException( e );
}
return interfaceClass.cast( MBeanServerInvocationHandler.newProxyInstance(
getMBeanServerConnection(), target, interfaceClass, true ) );
|
protected long | now()
return( System.currentTimeMillis() );
|
protected final void | printElapsed(java.lang.String msg, long start)
printVerbose( msg + ": " + (now() - start) + "ms" );
|
protected final void | printElapsed(java.lang.String msg, int numItems, long start)
printVerbose( msg + ", " + numItems + " MBeans: " + (now() - start) + "ms" );
|
protected final void | printElapsedIter(java.lang.String msg, long start, long iterations)
printVerbose( msg + "(" + iterations + " iterations): " + (now() - start) + "ms" );
|
protected void | printVerbose(java.lang.Object o)
if ( getVerbose() )
{
trace( o );
}
|
protected void | println(java.lang.Object o)
System.out.println( SmartStringifier.toString( o ) );
|
protected final java.lang.String | quote(java.lang.Object o)
return( StringUtil.quote( SmartStringifier.toString( o ) ) );
|
protected void | registerMBean(java.lang.Object mbean, java.lang.String name)
if ( sConn instanceof MBeanServer )
{
((MBeanServer)sConn).registerMBean( mbean, new ObjectName( name ) );
}
else
{
throw new IllegalArgumentException( "test connection is not an MBeanServer" );
}
|
public static synchronized void | setEnvValue(java.lang.String key, java.lang.Object value)
initEnv();
sEnv.put( key, value );
|
public static synchronized void | setEnvValues(java.util.Map m)
initEnv();
sEnv.putAll( m );
|
public static void | setGlobalConnection(javax.management.MBeanServerConnection conn)
sConn = conn;
|
public void | setUp()
checkAssertsOn();
assert( sConn != null );
|
public void | tearDown()
// do NOT destroy the MBeanServer or its contents
|
protected java.lang.String | toString(javax.management.ObjectName objectName)
return JMXUtil.toString( objectName );
|
protected java.lang.String | toString(java.lang.Object o)
String result = null;
if ( o instanceof Collection )
{
result = CollectionUtil.toString( (Collection)o, "\n" );
}
else
{
result = SmartStringifier.toString( o );
}
return( result );
|
protected static void | trace(java.lang.Object o)
System.out.println( SmartStringifier.toString( o ) );
|
protected void | warning(java.lang.String msg)
trace( "\nWARNING: " + msg + "\n" );
|