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 );