Search in sources :

Example 56 with CacheSimpleConfig

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

the class AbstractDynamicConfigGeneratorTest method testCacheSplitBrainProtectionRef.

@Test
public void testCacheSplitBrainProtectionRef() {
    CacheSimpleConfig expectedConfig = new CacheSimpleConfig().setName("testCache").setSplitBrainProtectionName("testSplitBrainProtection");
    Config config = new Config().addCacheConfig(expectedConfig);
    Config decConfig = getNewConfigViaGenerator(config);
    CacheSimpleConfig actualConfig = decConfig.getCacheConfig("testCache");
    assertEquals("testSplitBrainProtection", actualConfig.getSplitBrainProtectionName());
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) 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) Test(org.junit.Test)

Example 57 with CacheSimpleConfig

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

the class AbstractDynamicConfigGeneratorTest method testCacheFactoryAttributes.

@Test
public void testCacheFactoryAttributes() {
    CacheSimpleConfig.ExpiryPolicyFactoryConfig.TimedExpiryPolicyFactoryConfig timedExpiryPolicyFactoryConfig = new CacheSimpleConfig.ExpiryPolicyFactoryConfig.TimedExpiryPolicyFactoryConfig(ACCESSED, new CacheSimpleConfig.ExpiryPolicyFactoryConfig.DurationConfig(10, SECONDS));
    CacheSimpleConfig expectedConfig = new CacheSimpleConfig().setName("testCache").setCacheLoaderFactory("cacheLoaderFactory").setCacheWriterFactory("cacheWriterFactory").setExpiryPolicyFactory("expiryPolicyFactory").setCacheEntryListeners(singletonList(cacheSimpleEntryListenerConfig())).setExpiryPolicyFactoryConfig(new CacheSimpleConfig.ExpiryPolicyFactoryConfig(timedExpiryPolicyFactoryConfig)).setPartitionLostListenerConfigs(singletonList(new CachePartitionLostListenerConfig("partitionLostListener")));
    expectedConfig.getMergePolicyConfig().setPolicy("mergePolicy");
    expectedConfig.setDisablePerEntryInvalidationEvents(true);
    Config config = new Config().addCacheConfig(expectedConfig);
    Config decConfig = getNewConfigViaGenerator(config);
    CacheSimpleConfig actualConfig = decConfig.getCacheConfig("testCache");
    assertEquals(expectedConfig, actualConfig);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) 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) CachePartitionLostListenerConfig(com.hazelcast.config.CachePartitionLostListenerConfig) Test(org.junit.Test)

Example 58 with CacheSimpleConfig

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

the class Sources_withEventJournalTest method setUp.

@BeforeClass
public static void setUp() {
    Config config = new Config();
    config.setClusterName(randomName());
    config.addCacheConfig(new CacheSimpleConfig().setName("*"));
    config.getMapConfig(JOURNALED_MAP_PREFIX + '*').getEventJournalConfig().setEnabled(true);
    config.getCacheConfig(JOURNALED_CACHE_PREFIX + '*').getEventJournalConfig().setEnabled(true);
    remoteHz = createRemoteCluster(config, 2).get(0);
    clientConfig = getClientConfigForRemoteCluster(remoteHz);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Config(com.hazelcast.config.Config) JobConfig(com.hazelcast.jet.config.JobConfig) BeforeClass(org.junit.BeforeClass)

Example 59 with CacheSimpleConfig

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

the class ConfigValidatorTest method checkCacheConfig_withEntryCountMaxSizePolicy_NATIVE.

@Test(expected = IllegalArgumentException.class)
public void checkCacheConfig_withEntryCountMaxSizePolicy_NATIVE() {
    EvictionConfig evictionConfig = new EvictionConfig().setMaxSizePolicy(MaxSizePolicy.ENTRY_COUNT);
    CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig().setInMemoryFormat(NATIVE).setEvictionConfig(evictionConfig);
    checkCacheConfig(cacheSimpleConfig, splitBrainMergePolicyProvider);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) EvictionConfig(com.hazelcast.config.EvictionConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 60 with CacheSimpleConfig

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

the class MergePolicyValidatorCacheIntegrationTest method addConfig.

@Override
void addConfig(Config config, String name, MergePolicyConfig mergePolicyConfig) {
    CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig();
    cacheSimpleConfig.setName(name);
    cacheSimpleConfig.setStatisticsEnabled(false);
    cacheSimpleConfig.getMergePolicyConfig().setPolicy(mergePolicyConfig.getPolicy());
    config.addCacheConfig(cacheSimpleConfig);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig)

Aggregations

CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)84 Test (org.junit.Test)41 Config (com.hazelcast.config.Config)40 QuickTest (com.hazelcast.test.annotation.QuickTest)37 EvictionConfig (com.hazelcast.config.EvictionConfig)17 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)17 BeforeClass (org.junit.BeforeClass)16 CachePartitionLostListenerConfig (com.hazelcast.config.CachePartitionLostListenerConfig)15 MapConfig (com.hazelcast.config.MapConfig)11 ClientConfig (com.hazelcast.client.config.ClientConfig)10 EventJournalConfig (com.hazelcast.config.EventJournalConfig)10 MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)10 HazelcastInstance (com.hazelcast.core.HazelcastInstance)10 ExpiryPolicyFactoryConfig (com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig)9 QuorumConfig (com.hazelcast.config.QuorumConfig)9 CacheConfig (com.hazelcast.config.CacheConfig)8 TimedExpiryPolicyFactoryConfig (com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig.TimedExpiryPolicyFactoryConfig)8 QueueConfig (com.hazelcast.config.QueueConfig)8 CacheSimpleEntryListenerConfig (com.hazelcast.config.CacheSimpleEntryListenerConfig)7 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)7