/** @return string */ @Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append( "\nRemoteHttpCacheRequest" ); buf.append( "\n requesterId [" + getRequesterId() + "]" ); buf.append( "\n requestType [" + getRequestType() + "]" ); buf.append( "\n cacheName [" + getCacheName() + "]" ); buf.append( "\n key [" + getKey() + "]" ); buf.append( "\n keySet [" + getKeySet() + "]" ); buf.append( "\n pattern [" + getPattern() + "]" ); buf.append( "\n cacheElement [" + getCacheElement() + "]" ); return buf.toString(); } }
/** @return string */ @Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append( "\nRemoteHttpCacheRequest" ); buf.append( "\n requesterId [" + getRequesterId() + "]" ); buf.append( "\n requestType [" + getRequestType() + "]" ); buf.append( "\n cacheName [" + getCacheName() + "]" ); buf.append( "\n key [" + getKey() + "]" ); buf.append( "\n keySet [" + getKeySet() + "]" ); buf.append( "\n pattern [" + getPattern() + "]" ); buf.append( "\n cacheElement [" + getCacheElement() + "]" ); return buf.toString(); } }
/** Simple test */ public void testCreateGetMultipleRequest_Normal() { // SETUP String cacheName = "test"; Set<Serializable> keys = Collections.emptySet(); long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.GET_MULTIPLE, result.getRequestType() ); }
/** Simple test */ public void testCreateGetMultipleRequest_Normal() { // SETUP String cacheName = "test"; Set<Serializable> keys = Collections.emptySet(); long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createGetMultipleRequest( cacheName, keys, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.GET_MULTIPLE, 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() ); }
/** 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 testCreateGetMatchingRequest_Normal() { // SETUP String cacheName = "test"; String pattern = "pattern"; long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.GET_MATCHING, result.getRequestType() ); }
/** Simple test */ public void testCreateGetRequest_Normal() { // SETUP String cacheName = "test"; Serializable key = "key"; long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.GET, result.getRequestType() ); }
/** Simple test */ public void testCreateGetMatchingRequest_Normal() { // SETUP String cacheName = "test"; String pattern = "pattern"; long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createGetMatchingRequest( cacheName, pattern, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.GET_MATCHING, result.getRequestType() ); }
/** Simple test */ public void testCreateRemoveRequest_Normal() { // SETUP String cacheName = "test"; Serializable key = "key"; long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory .createRemoveRequest( cacheName, key, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.REMOVE, result.getRequestType() ); }
/** Simple test */ public void testCreateGetRequest_Normal() { // SETUP String cacheName = "test"; Serializable key = "key"; long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createGetRequest( cacheName, key, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.GET, result.getRequestType() ); }
/** Simple test */ public void testCreateRemoveRequest_Normal() { // SETUP String cacheName = "test"; Serializable key = "key"; long requesterId = 2; // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory .createRemoveRequest( cacheName, key, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.REMOVE, result.getRequestType() ); }
/** Simple test */ public void testCreateUpdateRequest_Normal() { // SETUP String cacheName = "test"; Serializable key = "key"; long requesterId = 2; CacheElement<Serializable, Serializable> element = new CacheElement<Serializable, Serializable>( cacheName, key, null ); // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.UPDATE, result.getRequestType() ); } }
/** Simple test */ public void testCreateUpdateRequest_Normal() { // SETUP String cacheName = "test"; Serializable key = "key"; long requesterId = 2; CacheElement<Serializable, Serializable> element = new CacheElement<Serializable, Serializable>( cacheName, key, null ); // DO WORK RemoteCacheRequest<Serializable, Serializable> result = RemoteCacheRequestFactory.createUpdateRequest( element, requesterId ); // VERIFY assertNotNull( "Should have a result", result ); assertEquals( "Wrong cacheName", cacheName, result.getCacheName() ); assertEquals( "Wrong type", RemoteRequestType.UPDATE, result.getRequestType() ); } }
/** * Verify removeall functionality * <p> * @throws IOException */ public void testRemoveAll_normal() throws IOException { // SETUP RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes(); RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes ); MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher(); client.setRemoteDispatcher( mockDispatcher ); String cacheName = "test"; // DO WORK client.removeAll( cacheName ); // VERIFY assertEquals( "Wrong type.", RemoteRequestType.REMOVE_ALL, mockDispatcher.lastRemoteCacheRequest .getRequestType() ); }
/** * Verify dispose functionality * <p> * @throws IOException */ public void testDispose_normal() throws IOException { // SETUP RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes(); RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes ); MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher(); client.setRemoteDispatcher( mockDispatcher ); String cacheName = "test"; // DO WORK client.dispose( cacheName ); // VERIFY assertEquals( "Wrong type.", RemoteRequestType.DISPOSE, mockDispatcher.lastRemoteCacheRequest .getRequestType() ); } }
/** * Verify removeall functionality * <p> * @throws IOException */ public void testRemoveAll_normal() throws IOException { // SETUP RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes(); RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes ); MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher(); client.setRemoteDispatcher( mockDispatcher ); String cacheName = "test"; // DO WORK client.removeAll( cacheName ); // VERIFY assertEquals( "Wrong type.", RemoteRequestType.REMOVE_ALL, mockDispatcher.lastRemoteCacheRequest .getRequestType() ); }
/** * Verify remove functionality * <p> * @throws IOException */ public void testRemove_normal() throws IOException { // SETUP RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes(); RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes ); MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher(); client.setRemoteDispatcher( mockDispatcher ); String cacheName = "test"; String key = "key"; // DO WORK client.remove( cacheName, key ); // VERIFY assertEquals( "Wrong type.", RemoteRequestType.REMOVE, mockDispatcher.lastRemoteCacheRequest .getRequestType() ); }
/** * Verify update functionality * <p> * @throws IOException */ public void testUpdate_normal() throws IOException { // SETUP RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes(); RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes ); MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher(); client.setRemoteDispatcher( mockDispatcher ); String cacheName = "test"; ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" ); // DO WORK client.update( element ); // VERIFY assertEquals( "Wrong type.", RemoteRequestType.UPDATE, mockDispatcher.lastRemoteCacheRequest .getRequestType() ); }
/** * Verify update functionality * <p> * @throws IOException */ public void testUpdate_normal() throws IOException { // SETUP RemoteHttpCacheAttributes attributes = new RemoteHttpCacheAttributes(); RemoteHttpCacheClient<String, String> client = new RemoteHttpCacheClient<String, String>( attributes ); MockRemoteCacheDispatcher mockDispatcher = new MockRemoteCacheDispatcher(); client.setRemoteDispatcher( mockDispatcher ); String cacheName = "test"; ICacheElement<String, String> element = new CacheElement<String, String>( cacheName, "key", "value" ); // DO WORK client.update( element ); // VERIFY assertEquals( "Wrong type.", RemoteRequestType.UPDATE, mockDispatcher.lastRemoteCacheRequest .getRequestType() ); }