org.apache.jcs.auxiliary.remote
Class MockRemoteCacheService<K extends Serializable,V extends Serializable>

java.lang.Object
  extended by org.apache.jcs.auxiliary.remote.MockRemoteCacheService<K,V>
All Implemented Interfaces:
Remote, ICacheService<K,V>, ICacheServiceNonLocal<K,V>

public class MockRemoteCacheService<K extends Serializable,V extends Serializable>
extends Object
implements ICacheServiceNonLocal<K,V>

This is a mock impl of the remote cache service.


Field Summary
 Serializable lastGetKey
          The key last passed to get
 String lastGetMatchingPattern
          The pattern last passed to get
 Set<K> lastGetMultipleKeys
          The keya last passed to getMatching
 String lastRemoveAllCacheName
          The cache name that was last passed to removeAll.
 K lastRemoveKey
          The key that was last passed to remove.
 ICacheElement<K,V> lastUpdate
          The object that was last passed to update.
 List<Long> updateRequestIdList
          List of request ids.
 List<ICacheElement<K,V>> updateRequestList
          List of updates.
 
Constructor Summary
MockRemoteCacheService()
           
 
Method Summary
 void dispose(String cacheName)
          Do nothing.
 ICacheElement<K,V> get(String cacheName, K key)
           
 ICacheElement<K,V> get(String cacheName, K key, long requesterId)
           
 Set<K> getGroupKeys(String cacheName, String groupName)
           
 Set<String> getGroupNames(String cacheName)
           
 Map<K,ICacheElement<K,V>> getMatching(String cacheName, String pattern)
          Returns an empty map.
 Map<K,ICacheElement<K,V>> getMatching(String cacheName, String pattern, long requesterId)
           
 Map<K,ICacheElement<K,V>> getMultiple(String cacheName, Set<K> keys)
           
 Map<K,ICacheElement<K,V>> getMultiple(String cacheName, Set<K> keys, long requesterId)
           
 void release()
          Do nothing.
 void remove(String cacheName, K key)
          Set the last remove key.
 void remove(String cacheName, K key, long requesterId)
          Set the last remove key.
 void removeAll(String cacheName)
          Set the last remove all cache name.
 void removeAll(String cacheName, long requesterId)
          Set the lastRemoveAllCacheName to the cacheName.
 void update(ICacheElement<K,V> item)
          Set the last update item.
 void update(ICacheElement<K,V> item, long requesterId)
          Set the last update item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastGetKey

public Serializable lastGetKey
The key last passed to get


lastGetMatchingPattern

public String lastGetMatchingPattern
The pattern last passed to get


lastGetMultipleKeys

public Set<K extends Serializable> lastGetMultipleKeys
The keya last passed to getMatching


lastUpdate

public ICacheElement<K extends Serializable,V extends Serializable> lastUpdate
The object that was last passed to update.


updateRequestList

public List<ICacheElement<K extends Serializable,V extends Serializable>> updateRequestList
List of updates.


updateRequestIdList

public List<Long> updateRequestIdList
List of request ids.


lastRemoveKey

public K extends Serializable lastRemoveKey
The key that was last passed to remove.


lastRemoveAllCacheName

public String lastRemoveAllCacheName
The cache name that was last passed to removeAll.

Constructor Detail

MockRemoteCacheService

public MockRemoteCacheService()
Method Detail

get

public ICacheElement<K,V> get(String cacheName,
                              K key,
                              long requesterId)
Specified by:
get in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
key -
requesterId -
Returns:
null

getGroupKeys

public Set<K> getGroupKeys(String cacheName,
                           String groupName)
Specified by:
getGroupKeys in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
groupName -
Returns:
empty set

getGroupNames

public Set<String> getGroupNames(String cacheName)
                          throws IOException
Specified by:
getGroupNames in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
Returns:
empty set
Throws:
IOException

remove

public void remove(String cacheName,
                   K key,
                   long requesterId)
Set the last remove key.

Specified by:
remove in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
key -
requesterId -

removeAll

public void removeAll(String cacheName,
                      long requesterId)
               throws IOException
Set the lastRemoveAllCacheName to the cacheName.

(non-Javadoc)

Specified by:
removeAll in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Throws:
IOException
See Also:
ICacheServiceNonLocal

update

public void update(ICacheElement<K,V> item,
                   long requesterId)
Set the last update item.

Specified by:
update in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
item -
requesterId -

dispose

public void dispose(String cacheName)
Do nothing.

Specified by:
dispose in interface ICacheService<K extends Serializable,V extends Serializable>
Parameters:
cacheName -

get

public ICacheElement<K,V> get(String cacheName,
                              K key)
Specified by:
get in interface ICacheService<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
key -
Returns:
null

release

public void release()
Do nothing.

Specified by:
release in interface ICacheService<K extends Serializable,V extends Serializable>

remove

public void remove(String cacheName,
                   K key)
Set the last remove key.

Specified by:
remove in interface ICacheService<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
key -

removeAll

public void removeAll(String cacheName)
Set the last remove all cache name.

Specified by:
removeAll in interface ICacheService<K extends Serializable,V extends Serializable>
Parameters:
cacheName -

update

public void update(ICacheElement<K,V> item)
Set the last update item.

Specified by:
update in interface ICacheService<K extends Serializable,V extends Serializable>
Parameters:
item -

getMultiple

public Map<K,ICacheElement<K,V>> getMultiple(String cacheName,
                                             Set<K> keys,
                                             long requesterId)
Specified by:
getMultiple in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
keys -
requesterId -
Returns:
empty map

getMultiple

public Map<K,ICacheElement<K,V>> getMultiple(String cacheName,
                                             Set<K> keys)
Specified by:
getMultiple in interface ICacheService<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
keys -
Returns:
empty map

getMatching

public Map<K,ICacheElement<K,V>> getMatching(String cacheName,
                                             String pattern)
                                                                                                     throws IOException
Returns an empty map. Zombies have no internal data.

Specified by:
getMatching in interface ICacheService<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
pattern -
Returns:
an empty map
Throws:
IOException

getMatching

public Map<K,ICacheElement<K,V>> getMatching(String cacheName,
                                             String pattern,
                                             long requesterId)
                                                                                                     throws IOException
Specified by:
getMatching in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
pattern -
requesterId -
Returns:
Map
Throws:
IOException


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.