Methods Summary |
---|
public void | checkCreateRemove(javax.management.ObjectName src)
final SystemPropertiesAccess props =
getProxy( src, SystemPropertiesAccess.class );
testSystemPropertiesCreateRemove( props );
|
public synchronized void | checkGetProperties(javax.management.ObjectName src)
final AMX proxy = getProxy( src, AMX.class);
if ( ! (proxy instanceof SystemPropertiesAccess) )
{
throw new IllegalArgumentException(
"MBean does not implement SystemPropertiesAccess: " + quote( src ) );
}
final SystemPropertiesAccess props = (SystemPropertiesAccess)proxy;
checkPropertiesGet( props );
|
private void | checkPropertiesGet(com.sun.appserv.management.config.SystemPropertiesAccess props)
final Map<String,String> all = props.getSystemProperties();
final String[] propNames = props.getSystemPropertyNames();
for( final String name : propNames )
{
assert( props.existsSystemProperty( name ) );
final String value = props.getSystemPropertyValue( name );
}
|
public void | checkSetPropertiesSetToSameValue(javax.management.ObjectName src)
final SystemPropertiesAccess props = getProxy( src, SystemPropertiesAccess.class );
testPropertiesSetToSameValue( props );
|
private java.util.Set | getAll()
final Set<ObjectName> objectNames =
getQueryMgr().queryInterfaceObjectNameSet(
SystemPropertiesAccess.class.getName(), null);
return( objectNames );
|
private void | testCreateEmptySystemProperty(com.sun.appserv.management.config.SystemPropertiesAccess props)
final String NAME = "test.empty";
props.createSystemProperty( NAME, "" );
assert( props.existsSystemProperty( NAME ) );
props.removeSystemProperty( NAME );
assert( ! props.existsSystemProperty( NAME ) );
|
public synchronized void | testCreateRemove()
if ( checkNotOffline( "testCreateRemove" ) )
{
final Set<ObjectName> all = getAll();
testAll( all, "checkCreateRemove" );
}
|
public synchronized void | testPropertiesGet()
final Set<ObjectName> all = getAll();
testAll( all, "checkGetProperties" );
|
public synchronized void | testPropertiesSetToSameValue()
final Set<ObjectName> all = getAll();
testAll( all, "checkSetPropertiesSetToSameValue" );
|
private void | testPropertiesSetToSameValue(com.sun.appserv.management.config.SystemPropertiesAccess props)
final String[] propNames = props.getSystemPropertyNames();
// get each property, set it to the same value, the verify
// it's the same.
for( int i = 0; i < propNames.length; ++i )
{
final String propName = propNames[ i ];
final String value = props.getSystemPropertyValue( propName );
props.setSystemPropertyValue( propName, value );
assert( props.getSystemPropertyValue( propName ).equals( value ) );
}
|
private void | testSystemPropertiesCreateRemove(com.sun.appserv.management.config.SystemPropertiesAccess props)
final String[] propNames = props.getSystemPropertyNames();
// add some properties, then delete them
final int numToAdd = 1;
final long now = System.currentTimeMillis();
for( int i = 0; i < numToAdd; ++i )
{
final String testName = "__junittest_" + i + now;
if ( props.existsSystemProperty( testName ) )
{
failure( "test property already exists: " + testName );
}
props.createSystemProperty( testName, "value_" + i );
assert( props.existsSystemProperty( testName ) );
}
final int numProps = props.getSystemPropertyNames().length;
if ( numProps != numToAdd + propNames.length )
{
failure( "expecting " + numProps + " have " + numToAdd + propNames.length );
}
// remove the ones we added
for( int i = 0; i < numToAdd; ++i )
{
final String testName = "__junittest_" + i + now;
props.removeSystemProperty( testName );
assert( ! props.existsSystemProperty( testName ) );
}
assert( props.getSystemPropertyNames().length == propNames.length );
|