exporter.setBeans(beans);
exporter.afterPropertiesSet();
CountingAttributeChangeNotificationListener listener = new CountingAttributeChangeNotificationListener();
NotificationListenerRegistrar registrar = new NotificationListenerRegistrar();
registrar.setServer(server);
registrar.setNotificationListener(listener);
//registrar.setMappedObjectNames(new Object[] {objectName, objectName2});
registrar.setMappedObjectNames(new String[] {"spring:name=Test", "spring:name=Test2"});
registrar.afterPropertiesSet();
// update the attribute
String attributeName = "Name";
server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
assertEquals("Listener not notified", 1, listener.getCount(attributeName));
registrar.destroy();
// try to update the attribute again
server.setAttribute(objectName, new Attribute(attributeName, "Rob Harrop"));
assertEquals("Listener notified after destruction", 1, listener.getCount(attributeName));
}