Methods Summary |
---|
protected abstract com.sun.appserv.management.config.AMXConfig | createProgeny(java.lang.String name, java.util.Map options)
|
public com.sun.appserv.management.config.AMXConfig | getProgeny(java.lang.String name)
final Container container = getProgenyContainer();
final String progenyType = getProgenyJ2EEType();
//trace( "getProgeny: " + progenyType + "=" + name );
final Object progeny = container.getContainee( progenyType, name );
if ( progeny != null && ! (progeny instanceof AMXConfig) )
{
assert( progeny instanceof AMX );
failure(
"getProgeny: " + progenyType + "=" + name + " not an AMXConfig, interface = " +
Util.getExtra( Util.asAMX(progeny )).getInterfaceName() );
}
return( (AMXConfig)progeny );
|
protected abstract com.sun.appserv.management.base.Container | getProgenyContainer()
|
protected abstract java.lang.String | getProgenyJ2EEType()
|
protected java.lang.String | getProgenyTestName()
return( "test-" + ClassUtil.stripPackageName( this.getClass().getName() ) );
|
protected void | remove(java.lang.String name)
removeProgeny( name );
|
void | removeEx(java.lang.String name)
final AMX proxy = getProgeny( name );
if ( proxy != null )
{
assert( proxy.getName().equals( name ) );
final ObjectName objectName = Util.getObjectName( proxy );
try
{
remove(name);
final MBeanServerConnection conn = getConnection();
while ( conn.isRegistered( objectName ) )
{
trace( "waiting for mbean to be unregistered: " + objectName );
}
}
catch(Exception e)
{
trace( "error removing MBean: " +
objectName + " = " + ExceptionUtil.getRootCause( e ).getMessage() );
}
}
else
{
// trace( "ConfigMgrTestBase.removeEx: " + name + " does not exist." );
}
|
protected abstract void | removeProgeny(java.lang.String name)
|
public final synchronized void | testCreateRemove()
if ( ! checkNotOffline( "testCreateRemove" ) )
{
return;
}
final long start = now();
String name = getProgenyTestName();
final String progenyJ2EEType = getProgenyJ2EEType();
AMXConfig proxy = getProgeny( name );
if ( proxy != null )
{
final ObjectName objectName = Util.getExtra( proxy ).getObjectName();
remove( name );
waitUnregistered( objectName );
assert( ! getConnection().isRegistered( objectName ) );
assert( getProgeny( name ) == null );
proxy = null;
}
final Container container = getProgenyContainer();
final CreateRemoveListener listener =
new CreateRemoveListener( container, progenyJ2EEType, name );
// create it
try
{
proxy = createProgeny( name, null );
}
catch( Exception e )
{
trace( getStackTrace( ExceptionUtil.getRootCause(e) ) );
failure( "Can't create item of j2eeType=" + progenyJ2EEType +
",name=" + name );
}
assert( proxy.getName().equals( name ) );
final ObjectName objectName = Util.getObjectName( proxy );
assert( getConnection().isRegistered( objectName ) );
assert( container.getContainee( progenyJ2EEType, name) != null );
assert( container.getContainee( progenyJ2EEType, name) == proxy );
final AMXConfig progeny = getProgeny( name );
assert( progeny == proxy );
// remove it
final ProxyFactory factory = Util.getExtra( proxy ).getProxyFactory();
assert( name.equals( progeny.getName() ) );
remove( name );
waitUnregistered( objectName );
assert( ! getConnection().isRegistered( objectName ) );
waitProxyGone( factory, objectName );
assert( getProgeny( name ) == null );
listener.waitNotifs();
printElapsed( "testCreateRemove: created/remove/listen for: " + progenyJ2EEType, start );
|
public final synchronized void | testIllegalCreate()
if ( ! checkNotOffline( "testIllegalCreate" ) )
{
return;
}
final String name = getProgenyTestName() + "-Illegal";
try
{
final AMXConfig proxy = createProgeny( name, ILLEGAL_OPTIONS );
fail( "Expecting failure from createProgenyIllegal for progeny type: " + getProgenyJ2EEType() );
}
catch( final Exception e )
{
final Throwable rootCause = ExceptionUtil.getRootCause( e );
if ( ! ( rootCause instanceof IllegalArgumentException ) )
{
warning( "expecting IllegalArgumentException, got: " + rootCause.getClass().getName() +
", msg = " + rootCause.getMessage() );
rootCause.printStackTrace();
}
}
catch( final Throwable t )
{
final Throwable rootCause = ExceptionUtil.getRootCause( t );
warning( "expecting IllegalArgumentException, got: " + ExceptionUtil.toString(rootCause) );
assert false;
}
|