testListen()
throws Exception
{
final NotificationService proxy = create();
final QueryMgr queryMgr = getQueryMgr();
final ObjectName objectName = Util.getObjectName( queryMgr );
final Object id = proxy.createBuffer( 10, null);
final NotificationServiceHelper helper = new NotificationServiceHelper( proxy, id);
proxy.listenTo( objectName, null );
assert( proxy.getListeneeSet().size() == 1 );
assert( Util.getObjectName( (Util.asAMX(proxy.getListeneeSet().iterator().next())) ).equals( objectName ) );
final MyListener myListener = new MyListener();
proxy.addNotificationListener( myListener, null, null );
final Level saveLevel = queryMgr.getMBeanLogLevel();
queryMgr.setMBeanLogLevel( Level.INFO );
queryMgr.setMBeanLogLevel( saveLevel );
// delivery may be asynchronous; wait until done
while ( myListener.getCount() < 2 )
{
sleep( 20 );