use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class ClientNearCacheBatchInvalidationTest method newClientConfig.
protected ClientConfig newClientConfig(String mapName) {
NearCacheConfig nearCacheConfig = new NearCacheConfig();
nearCacheConfig.setInMemoryFormat(getNearCacheInMemoryFormat());
nearCacheConfig.setName(mapName);
nearCacheConfig.setInvalidateOnChange(true);
ClientConfig clientConfig = new ClientConfig();
clientConfig.addNearCacheConfig(nearCacheConfig);
return clientConfig;
}
use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class ClientMapNearCacheTest method newMaxIdleSecondsNearCacheConfig.
protected NearCacheConfig newMaxIdleSecondsNearCacheConfig() {
NearCacheConfig nearCacheConfig = newNearCacheConfig();
nearCacheConfig.setInvalidateOnChange(false);
nearCacheConfig.setMaxIdleSeconds(MAX_IDLE_SECONDS);
return nearCacheConfig;
}
use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class ClientMapNearCacheTest method receives_one_clearEvent_after_mapClear_call_from_member.
@Test
public void receives_one_clearEvent_after_mapClear_call_from_member() {
// start new member and populate map
HazelcastInstance member = hazelcastFactory.newHazelcastInstance(newConfig());
IMap<Integer, Integer> memberMap = member.getMap("test");
populateMap(memberMap, 1000);
// populate client near cache
NearCacheConfig nearCacheConfig = newNearCacheConfig();
ClientConfig clientConfig = newClientConfig();
clientConfig.addNearCacheConfig(nearCacheConfig);
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
IMap<Integer, Integer> clientMap = client.getMap("test");
populateNearCache(clientMap, 1000);
// add test listener to count clear events
final ClearEventCounterEventHandler handler = new ClearEventCounterEventHandler();
((NearCachedClientMapProxy) clientMap).addNearCacheInvalidationListener(handler);
// clear map from member side
memberMap.clear();
// sleep for a while to see there is another clear event coming
sleepSeconds(2);
assertTrueEventually(new AssertTask() {
@Override
public void run() {
assertEquals("Expecting only 1 clear event", 1, handler.getClearEventCount());
}
});
}
use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class ClientMapNearCacheTest method newNoInvalidationNearCacheConfig.
protected NearCacheConfig newNoInvalidationNearCacheConfig() {
NearCacheConfig nearCacheConfig = newNearCacheConfig();
nearCacheConfig.setInMemoryFormat(InMemoryFormat.OBJECT);
nearCacheConfig.setInvalidateOnChange(false);
return nearCacheConfig;
}
use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class ClientReplicatedMapTest method getClientConfigWithNearCacheInvalidationEnabled.
private ClientConfig getClientConfigWithNearCacheInvalidationEnabled() {
ClientConfig config = new ClientConfig();
NearCacheConfig nnc = new NearCacheConfig();
nnc.setInvalidateOnChange(true);
nnc.setInMemoryFormat(InMemoryFormat.OBJECT);
config.addNearCacheConfig(nnc);
return config;
}
Aggregations