Search in sources :

Example 76 with NearCacheConfig

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

the class ConfigValidatorNearCacheConfigTest method checkNearCacheConfig_withPreloaderConfig_onMembers.

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

Example 77 with NearCacheConfig

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

the class ConfigValidatorNearCacheConfigTest method checkNearCacheConfig_withLocalUpdatePolicy_CACHE_ON_UPDATE.

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

Example 78 with NearCacheConfig

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

the class ConfigValidatorNearCacheConfigTest method checkNearCacheConfig_withPreLoaderConfig_onClients.

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

Example 79 with NearCacheConfig

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

the class AbstractDynamicConfigGeneratorTest method testMapNearCacheConfig.

@Test
public void testMapNearCacheConfig() {
    NearCacheConfig expectedConfig = new NearCacheConfig().setName("nearCache").setInMemoryFormat(InMemoryFormat.NATIVE).setMaxIdleSeconds(42).setCacheLocalEntries(true).setInvalidateOnChange(true).setLocalUpdatePolicy(NearCacheConfig.LocalUpdatePolicy.INVALIDATE).setTimeToLiveSeconds(10).setEvictionConfig(evictionConfig()).setSerializeKeys(true);
    MapConfig mapConfig = newMapConfig().setName("nearCacheTest").setNearCacheConfig(expectedConfig);
    Config config = new Config().addMapConfig(mapConfig);
    Config decConfig = getNewConfigViaGenerator(config);
    NearCacheConfig actualConfig = decConfig.getMapConfig("nearCacheTest").getNearCacheConfig();
    assertEquals(expectedConfig, actualConfig);
}
Also used : ListConfig(com.hazelcast.config.ListConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) AwsConfig(com.hazelcast.config.AwsConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) PredicateConfig(com.hazelcast.config.PredicateConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) PartitioningStrategyConfig(com.hazelcast.config.PartitioningStrategyConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) DiscoveryStrategyConfig(com.hazelcast.config.DiscoveryStrategyConfig) DiskTierConfig(com.hazelcast.config.DiskTierConfig) IndexConfig(com.hazelcast.config.IndexConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) ItemListenerConfig(com.hazelcast.config.ItemListenerConfig) MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) CacheSimpleEntryListenerConfig(com.hazelcast.config.CacheSimpleEntryListenerConfig) RingbufferStoreConfig(com.hazelcast.config.RingbufferStoreConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) AttributeConfig(com.hazelcast.config.AttributeConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ListenerConfig(com.hazelcast.config.ListenerConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) WanCustomPublisherConfig(com.hazelcast.config.WanCustomPublisherConfig) WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) TieredStoreConfig(com.hazelcast.config.TieredStoreConfig) QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) CachePartitionLostListenerConfig(com.hazelcast.config.CachePartitionLostListenerConfig) DataPersistenceConfig(com.hazelcast.config.DataPersistenceConfig) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) MapPartitionLostListenerConfig(com.hazelcast.config.MapPartitionLostListenerConfig) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) MerkleTreeConfig(com.hazelcast.config.MerkleTreeConfig) MemoryTierConfig(com.hazelcast.config.MemoryTierConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MapConfig(com.hazelcast.config.MapConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) Test(org.junit.Test)

Example 80 with NearCacheConfig

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

the class ExternalMemberConfigurationOverrideEnvTest method shouldHandleMapConfigNearCache.

@Test
public void shouldHandleMapConfigNearCache() throws Exception {
    Config config = new Config();
    NearCacheConfig nearCacheConfig = new NearCacheConfig().setMaxIdleSeconds(10).setInMemoryFormat(InMemoryFormat.NATIVE);
    config.getMapConfig("foo").setNearCacheConfig(nearCacheConfig);
    Map<String, String> envVariables = new HashMap<>();
    envVariables.put("HZ_MAP_FOO_NEARCACHE_MAXIDLESECONDS", "5");
    new ExternalConfigurationOverride(envVariables, System::getProperties).overwriteMemberConfig(config);
    assertEquals(5, config.getMapConfig("foo").getNearCacheConfig().getMaxIdleSeconds());
    assertEquals(InMemoryFormat.NATIVE, config.getMapConfig("foo").getNearCacheConfig().getInMemoryFormat());
}
Also used : HashMap(java.util.HashMap) EventJournalConfig(com.hazelcast.config.EventJournalConfig) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) Config(com.hazelcast.config.Config) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MerkleTreeConfig(com.hazelcast.config.MerkleTreeConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

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