use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class ExpirationTimeTest method createMapWithMaxIdleSeconds.
private IMap<Integer, Integer> createMapWithMaxIdleSeconds(int maxIdleSeconds) {
String mapName = randomMapName();
Config config = getConfig();
MapConfig mapConfig = config.getMapConfig(mapName);
mapConfig.setMaxIdleSeconds(maxIdleSeconds);
HazelcastInstance node = createHazelcastInstance(config);
return node.getMap(mapName);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class ListenerTest method test_ListenerShouldNotCauseDeserialization_withIncludeValueFalse.
@Test
public void test_ListenerShouldNotCauseDeserialization_withIncludeValueFalse() throws InterruptedException {
String name = randomString();
String key = randomString();
Config config = getConfig();
config.getMapConfig(name).setInMemoryFormat(InMemoryFormat.OBJECT);
HazelcastInstance instance = createHazelcastInstance(config);
IMap<Object, Object> map = instance.getMap(name);
EntryAddedLatch latch = new EntryAddedLatch(1);
map.addEntryListener(latch, false);
map.executeOnKey(key, new AbstractEntryProcessor<Object, Object>() {
@Override
public Object process(Map.Entry<Object, Object> entry) {
entry.setValue(new SerializeCheckerObject());
return null;
}
});
assertOpenEventually(latch, 10);
SerializeCheckerObject.assertNotSerialized();
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class LocalMapStatsTest method testLocalMapStats_withMemberGroups.
@Test
public void testLocalMapStats_withMemberGroups() throws Exception {
final String mapName = randomMapName();
final String[] firstMemberGroup = { "127.0.0.1", "127.0.0.2" };
final String[] secondMemberGroup = { "127.0.0.3" };
final Config config = createConfig(mapName, firstMemberGroup, secondMemberGroup);
final String[] addressArray = concatenateArrays(firstMemberGroup, secondMemberGroup);
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(addressArray);
final HazelcastInstance node1 = factory.newHazelcastInstance(config);
final HazelcastInstance node2 = factory.newHazelcastInstance(config);
final HazelcastInstance node3 = factory.newHazelcastInstance(config);
final IMap<Object, Object> test = node3.getMap(mapName);
test.put(1, 1);
assertBackupEntryCount(1, mapName, factory.getAllHazelcastInstances());
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class NearCacheTest method getConfig.
@Override
protected Config getConfig() {
Config config = super.getConfig();
config.setProperty(GroupProperty.MAP_INVALIDATION_MESSAGE_BATCH_ENABLED.getName(), valueOf(batchInvalidationEnabled));
return config;
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class NearCacheTest method testNearCacheEviction.
@Test
public void testNearCacheEviction() {
String mapName = "testNearCacheEviction";
NearCacheConfig nearCacheConfig = newNearCacheConfigWithEntryCountEviction(EvictionPolicy.LRU, MAX_CACHE_SIZE);
Config config = getConfig();
config.getMapConfig(mapName).setNearCacheConfig(nearCacheConfig);
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance(config);
IMap<Integer, Integer> map = hazelcastInstance.getMap(mapName);
testNearCacheEviction(map, MAX_CACHE_SIZE);
}
Aggregations