Methods Summary |
---|
public void | checkCreateRemove(javax.management.ObjectName src)
final PropertiesAccess props = (PropertiesAccess)getProxy( src );
testPropertiesCreateRemove( props );
|
public void | checkGetProperties(javax.management.ObjectName src)
final AMX proxy = getProxy( src );
if ( ! (proxy instanceof PropertiesAccess) )
{
throw new IllegalArgumentException(
"MBean does not implement PropertiesAccess: " + quote( src ) );
}
final PropertiesAccess props = (PropertiesAccess)proxy;
testPropertiesGet( props );
|
public void | checkSetPropertiesSetToSameValue(javax.management.ObjectName src)
final PropertiesAccess props = (PropertiesAccess)getProxy( src );
testPropertiesSetToSameValue( props );
|
private java.util.Set | getAllImplementorsOfProperties()
final Set<AMX> amxs = getQueryMgr().queryInterfaceSet(
PropertiesAccess.class.getName(), null);
return( TestUtil.newSortedSet( Util.toObjectNames( amxs ) ) );
|
private void | testCreateEmptyProperty(com.sun.appserv.management.config.PropertiesAccess props)
final String NAME = "test.empty";
props.createProperty( NAME, "" );
assert( props.existsProperty( NAME ) );
props.removeProperty( NAME );
assert( ! props.existsProperty( NAME ) );
|
public synchronized void | testPropertiesCreateRemove()
if ( checkNotOffline( "testPropertiesCreateRemove" ) )
{
final Set<ObjectName> all = getAllImplementorsOfProperties();
testAll( all, "checkCreateRemove" );
}
|
private void | testPropertiesCreateRemove(com.sun.appserv.management.config.PropertiesAccess props)
final String[] propNames = props.getPropertyNames();
final AMX amx = Util.asAMX( props );
final String j2eeType = amx.getJ2EEType();
if ( ! TEST_CREATE_REMOVE_TYPES.contains( j2eeType ) )
{
return;
}
// 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.existsProperty( testName ) )
{
failure( "test property already exists: " + testName );
}
props.createProperty( testName, "value_" + i );
assert( props.existsProperty( testName ) );
}
final int numProps = props.getPropertyNames().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.removeProperty( testName );
assert( ! props.existsProperty( testName ) );
}
assert( props.getPropertyNames().length == propNames.length );
|
public synchronized void | testPropertiesGet()
final Set<ObjectName> all = getAllImplementorsOfProperties();
testAll( all, "checkGetProperties" );
|
private void | testPropertiesGet(com.sun.appserv.management.config.PropertiesAccess props)
final String[] propNames = props.getPropertyNames();
for( final String name : propNames )
{
assert( props.existsProperty( name ) );
final String value = props.getPropertyValue( name );
}
|
public synchronized void | testPropertiesSetToSameValue()
final Set<ObjectName> all = getAllImplementorsOfProperties();
testAll( all, "checkSetPropertiesSetToSameValue" );
|
private void | testPropertiesSetToSameValue(com.sun.appserv.management.config.PropertiesAccess props)
final String[] propNames = props.getPropertyNames();
// 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 ];
assert( props.existsProperty( propName ) );
final String value = props.getPropertyValue( propName );
props.setPropertyValue( propName, value );
assert( props.getPropertyValue( propName ).equals( value ) );
}
|