Search in sources :

Example 71 with Config

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);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) MapConfig(com.hazelcast.config.MapConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 72 with Config

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();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) Config(com.hazelcast.config.Config) MapPartitionLostListenerConfig(com.hazelcast.config.MapPartitionLostListenerConfig) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) IMap(com.hazelcast.core.IMap) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 73 with Config

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());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) MemberGroupConfig(com.hazelcast.config.MemberGroupConfig) PartitionGroupConfig(com.hazelcast.config.PartitionGroupConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 74 with Config

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;
}
Also used : MapConfig(com.hazelcast.config.MapConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig)

Example 75 with 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);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

Config (com.hazelcast.config.Config)1190 Test (org.junit.Test)838 HazelcastInstance (com.hazelcast.core.HazelcastInstance)815 QuickTest (com.hazelcast.test.annotation.QuickTest)718 ParallelTest (com.hazelcast.test.annotation.ParallelTest)648 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)361 MapConfig (com.hazelcast.config.MapConfig)341 MapStoreConfig (com.hazelcast.config.MapStoreConfig)211 CountDownLatch (java.util.concurrent.CountDownLatch)145 NightlyTest (com.hazelcast.test.annotation.NightlyTest)142 NearCacheConfig (com.hazelcast.config.NearCacheConfig)125 Before (org.junit.Before)115 AssertTask (com.hazelcast.test.AssertTask)113 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)93 MapIndexConfig (com.hazelcast.config.MapIndexConfig)91 ClientConfig (com.hazelcast.client.config.ClientConfig)83 IMap (com.hazelcast.core.IMap)81 GroupConfig (com.hazelcast.config.GroupConfig)69 ListenerConfig (com.hazelcast.config.ListenerConfig)60 JoinConfig (com.hazelcast.config.JoinConfig)59