/** * Remove all keys from the sepcified cache. * <p> * @param cacheName * @param requesterId * @throws IOException */ @Override public void removeAll( String cacheName, long requesterId ) throws IOException { if ( !isInitialized() ) { String message = "The Remote Http Client is not initialized. Cannot process request."; log.warn( message ); throw new IOException( message ); } RemoteCacheRequest<K, V> remoteHttpCacheRequest = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest ); }
/** * Remove all keys from the sepcified cache. * <p> * @param cacheName * @param requesterId * @throws IOException */ @Override public void removeAll( String cacheName, long requesterId ) throws IOException { if ( !isInitialized() ) { String message = "The Remote Http Client is not initialized. Cannot process request."; log.warn( message ); throw new IOException( message ); } RemoteCacheRequest<K, V> remoteHttpCacheRequest = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest ); }
/** Verify that the service is called. */ public void testProcessRequest_RemoveAll() { String cacheName = "testRemoveALl"; long requesterId = 2; RemoteCacheRequest<Serializable, Serializable> request = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); // DO WORK RemoteCacheResponse<Object> result = servlet.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); assertEquals( "Wrong cacheName.", cacheName, remoteHttpCacheService.lastRemoveAllCacheName ); } }
/** Simple test */ public void testCreateRemoveAllRequest_Normal() { // SETUP String cacheName = "test"; long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.REMOVE_ALL, result.getRequestType() ); }
/** Simple test */ public void testCreateRemoveAllRequest_Normal() { // SETUP String cacheName = "test"; long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.REMOVE_ALL, result.getRequestType() ); }
/** Verify that the service is called. */ public void testProcessRequest_RemoveAll() { // SETUP RemoteCacheServiceAdaptor<String, String> adaptor = new RemoteCacheServiceAdaptor<String, String>(); MockRemoteCacheService<String, String> remoteHttpCacheService = new MockRemoteCacheService<String, String>(); adaptor.setRemoteCacheService( remoteHttpCacheService ); String cacheName = "testRemoveALl"; long requesterId = 2; RemoteCacheRequest<String, String> request = RemoteCacheRequestFactory.createRemoveAllRequest( cacheName, requesterId ); // DO WORK RemoteCacheResponse<String> result = adaptor.processRequest( request ); // VERIFY assertNotNull( "Should have a result.", result ); assertEquals( "Wrong cacheName.", cacheName, remoteHttpCacheService.lastRemoveAllCacheName ); } }