Search in sources :

Example 6 with NearCacheConfig

use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.

the class ConfigValidatorTest method not_supports_near_cache_localUpdatePolicy_CACHE_ON_UPDATE.

@Test(expected = IllegalArgumentException.class)
public void not_supports_near_cache_localUpdatePolicy_CACHE_ON_UPDATE() {
    NearCacheConfig nearCacheConfig = new NearCacheConfig();
    nearCacheConfig.setLocalUpdatePolicy(CACHE_ON_UPDATE);
    checkNearCacheConfig(MAP_NAME, nearCacheConfig, false);
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) ConfigValidator.checkNearCacheConfig(com.hazelcast.internal.config.ConfigValidator.checkNearCacheConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 7 with NearCacheConfig

use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.

the class ConfigValidatorTest method test_checkNearCacheConfig_withPreLoaderConfig_onClients.

@Test
public void test_checkNearCacheConfig_withPreLoaderConfig_onClients() {
    NearCacheConfig nearCacheConfig = getNearCacheConfig(BINARY).setCacheLocalEntries(false);
    nearCacheConfig.getPreloaderConfig().setEnabled(true).setStoreInitialDelaySeconds(1).setStoreInitialDelaySeconds(1);
    checkNearCacheConfig(MAP_NAME, nearCacheConfig, true);
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) ConfigValidator.checkNearCacheConfig(com.hazelcast.internal.config.ConfigValidator.checkNearCacheConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 8 with NearCacheConfig

use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.

the class ConfigValidatorTest method test_checkNearCacheConfig_withPreloader_onMembers.

@Test(expected = IllegalArgumentException.class)
public void test_checkNearCacheConfig_withPreloader_onMembers() {
    NearCacheConfig nearCacheConfig = getNearCacheConfig(BINARY);
    nearCacheConfig.getPreloaderConfig().setEnabled(true).setStoreInitialDelaySeconds(1).setStoreInitialDelaySeconds(1);
    checkNearCacheConfig(MAP_NAME, nearCacheConfig, false);
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) ConfigValidator.checkNearCacheConfig(com.hazelcast.internal.config.ConfigValidator.checkNearCacheConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 9 with NearCacheConfig

use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.

the class GetAllTest method ensure_supplied_number_of_keys_are_in_near_cache.

@Test
public void ensure_supplied_number_of_keys_are_in_near_cache() throws Exception {
    final int entryCount = 100000;
    final String mapName = "test";
    NearCacheConfig nearCacheConfig = new NearCacheConfig();
    nearCacheConfig.setCacheLocalEntries(true);
    nearCacheConfig.setInvalidateOnChange(true);
    Config config = new Config();
    config.getMapConfig(mapName).setNearCacheConfig(nearCacheConfig);
    HazelcastInstance node = createHazelcastInstance(config);
    IMap map = node.getMap(mapName);
    for (int i = 0; i < entryCount; i++) {
        map.put(i, i);
    }
    HashSet keys = new HashSet();
    for (int i = 0; i < entryCount; i++) {
        keys.add(i);
    }
    map.getAll(keys);
    assertEquals(entryCount, ((NearCachedMapProxyImpl) map).getNearCache().size());
}
Also used : IMap(com.hazelcast.core.IMap) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) NearCachedMapProxyImpl(com.hazelcast.map.impl.proxy.NearCachedMapProxyImpl) HashSet(java.util.HashSet) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 10 with NearCacheConfig

use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.

the class LiteMemberMapNearCacheBasicTest method createConfig.

protected Config createConfig(NearCacheConfig nearCacheConfig, boolean liteMember) {
    Config config = getConfig().setLiteMember(liteMember);
    config.getMapConfig(DEFAULT_NEAR_CACHE_NAME).setNearCacheConfig(nearCacheConfig);
    return config;
}
Also used : NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.NearCacheTestUtils.createNearCacheConfig) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig)

Aggregations

NearCacheConfig (com.hazelcast.config.NearCacheConfig)212 Test (org.junit.Test)89 QuickTest (com.hazelcast.test.annotation.QuickTest)82 Config (com.hazelcast.config.Config)66 HazelcastInstance (com.hazelcast.core.HazelcastInstance)65 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)62 ClientConfig (com.hazelcast.client.config.ClientConfig)51 MapConfig (com.hazelcast.config.MapConfig)37 EvictionConfig (com.hazelcast.config.EvictionConfig)24 Before (org.junit.Before)17 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)16 CacheConfig (com.hazelcast.config.CacheConfig)15 ParallelTest (com.hazelcast.test.annotation.ParallelTest)15 NearCacheTestUtils.getBaseConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig)14 AssertTask (com.hazelcast.test.AssertTask)14 NightlyTest (com.hazelcast.test.annotation.NightlyTest)12 MapStoreConfig (com.hazelcast.config.MapStoreConfig)11 Data (com.hazelcast.nio.serialization.Data)11 MatchingPointConfigPatternMatcher (com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher)10 CachingProvider (javax.cache.spi.CachingProvider)10