/** * Verify that when we call fix events queued in the zombie are propagated to the new service. * <p> * @throws Exception */ public void testUpdateZombieThenFix() throws Exception { // SETUP ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 ); // set the zombie RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, zombie, listener, monitor ); String cacheName = "testUpdate"; // DO WORK ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" ); remoteCache.update( element ); // set the new service, this should call propagate remoteCache.fixCache( service ); // VERIFY assertTrue( "The element should be in the serialized warapper.", service.lastUpdate instanceof ICacheElementSerialized ); ICacheElement<String, String> result = SerializationConversionUtil .getDeSerializedCacheElement( (ICacheElementSerialized<String, String>) service.lastUpdate, remoteCache .getElementSerializer() ); assertEquals( "Wrong element updated.", element.getVal(), result.getVal() ); }
/** * Verify that when we call fix events queued in the zombie are propagated to the new service. * <p> * @throws Exception */ public void testUpdateZombieThenFix() throws Exception { // SETUP IRemoteCacheAttributes cattr = new RemoteCacheAttributes(); ZombieCacheServiceNonLocal<String, String> zombie = new ZombieCacheServiceNonLocal<String, String>( 10 ); MockRemoteCacheService<String, String> service = new MockRemoteCacheService<String, String>(); MockRemoteCacheListener<String, String> listener = new MockRemoteCacheListener<String, String>(); // set the zombie RemoteCache<String, String> remoteCache = new RemoteCache<String, String>( cattr, zombie, listener ); String cacheName = "testUpdate"; // DO WORK ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" ); remoteCache.update( element ); // set the new service, this should call propagate remoteCache.fixCache( service ); // VERIFY assertTrue( "The element should be in the serialized warapper.", service.lastUpdate instanceof ICacheElementSerialized ); ICacheElement<String, String> result = SerializationConversionUtil .getDeSerializedCacheElement( (ICacheElementSerialized<String, String>) service.lastUpdate, remoteCache .getElementSerializer() ); assertEquals( "Wrong element updated.", element.getVal(), result.getVal() ); }