// SETUP
IRemoteCacheServerAttributes rcsa = new RemoteCacheServerAttributes();
rcsa.setConfigFileName( "/TestRemoteCacheServer.ccf" );
RemoteCacheServer server = new RemoteCacheServer( rcsa );
RemoteCacheListenerMockImpl mockListener1 = new RemoteCacheListenerMockImpl();
mockListener1.remoteType = IRemoteCacheServerAttributes.CLUSTER;
RemoteCacheListenerMockImpl mockListener2 = new RemoteCacheListenerMockImpl();
mockListener2.remoteType = IRemoteCacheServerAttributes.CLUSTER;
String cacheName = "testAddListenerToAllThenRemove";
// DO WORK
server.addCacheListener( cacheName, mockListener1 );
server.addCacheListener( cacheName, mockListener2 );
// VERIFY
assertEquals( "Wrong number of listeners.", 0, server.getCacheListeners( cacheName ).eventQMap.size() );
assertEquals( "Wrong number of listeners.", 2, server.getClusterListeners( cacheName ).eventQMap.size() );
assertEquals( "Wrong listener id.", 1, mockListener1.getListenerId() );
assertEquals( "Wrong listener id.", 2, mockListener2.getListenerId() );
// DO WORK
server.removeCacheListener( cacheName, mockListener1.getListenerId() );
assertEquals( "Wrong number of listeners.", 1, server.getClusterListeners( cacheName ).eventQMap.size() );
}