Search in sources :

Example 61 with CacheSimpleConfig

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

the class ConfigValidatorTest method checkCacheConfig_withEntryCountMaxSizePolicy_OBJECT.

@Test
public void checkCacheConfig_withEntryCountMaxSizePolicy_OBJECT() {
    EvictionConfig evictionConfig = new EvictionConfig().setMaxSizePolicy(MaxSizePolicy.ENTRY_COUNT);
    CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig().setInMemoryFormat(OBJECT).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 62 with CacheSimpleConfig

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

the class ConfigSearchTest method testCacheConfig_Dynamic.

@Test
public void testCacheConfig_Dynamic() {
    TestCase<CacheSimpleConfig> testCase = new TestCase<CacheSimpleConfig>(new CacheSimpleConfig().setName(STATIC_NAME), new CacheSimpleConfig().setName(DYNAMIC_NAME), true) {

        @Override
        void addStaticConfig(Config config) {
            config.addCacheConfig(this.staticConfig);
        }

        @Override
        void addDynamicConfig(HazelcastInstance hazelcastInstance) {
            hazelcastInstance.getConfig().addCacheConfig(this.dynamicConfig);
        }

        @Override
        void asserts() {
            CacheSimpleConfig dataConfig = hazelcastInstance.getConfig().findCacheConfig(DYNAMIC_NAME);
            assertThat(dataConfig.getName(), equalTo(DYNAMIC_NAME));
        }
    };
    testTemplate(testCase);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ListConfig(com.hazelcast.config.ListConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 63 with CacheSimpleConfig

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

the class DynamicConfigSmokeTest method cacheConfig_whenListenerIsRegistered.

@Test
public void cacheConfig_whenListenerIsRegistered() {
    String cacheName = randomMapName();
    CacheSimpleConfig cacheSimpleConfig = new CacheSimpleConfig().setName(cacheName).setKeyType(String.class.getName()).setValueType((new String[0]).getClass().getName()).setStatisticsEnabled(false).setManagementEnabled(false);
    members(2);
    HazelcastInstance driver = driver();
    driver.getConfig().addCacheConfig(cacheSimpleConfig);
    Cache cache = driver.getCacheManager().getCache(cacheName);
    cache.registerCacheEntryListener(new CacheEntryListenerConfig(() -> (CacheEntryCreatedListener & Serializable) System.out::println, null, true, true));
    driver.getConfig().addCacheConfig(cacheSimpleConfig);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Cache(javax.cache.Cache) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 64 with CacheSimpleConfig

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

the class DynamicConfigTest method testCacheConfig_withTimedExpiryPolicyFactory.

@Test
public void testCacheConfig_withTimedExpiryPolicyFactory() {
    CacheSimpleConfig config = getCacheConfig().setExpiryPolicyFactoryConfig(new ExpiryPolicyFactoryConfig(new TimedExpiryPolicyFactoryConfig(TimedExpiryPolicyFactoryConfig.ExpiryPolicyType.TOUCHED, new ExpiryPolicyFactoryConfig.DurationConfig(130, TimeUnit.SECONDS))));
    driver.getConfig().addCacheConfig(config);
    assertConfigurationsEqualOnAllMembers(config);
}
Also used : TimedExpiryPolicyFactoryConfig(com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig.TimedExpiryPolicyFactoryConfig) ExpiryPolicyFactoryConfig(com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) TimedExpiryPolicyFactoryConfig(com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig.TimedExpiryPolicyFactoryConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 65 with CacheSimpleConfig

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

the class DynamicConfigTest method testCacheConfig_withEvictionPolicy_cacheLoaderAndWriter.

@Test
public void testCacheConfig_withEvictionPolicy_cacheLoaderAndWriter() {
    CacheSimpleConfig config = getCacheConfig().setEvictionConfig(getEvictionConfigByPolicy()).setCacheLoader("com.hazelcast.CacheLoader").setCacheWriter("com.hazelcast.CacheWriter").setExpiryPolicyFactory("expiryPolicyFactory");
    driver.getConfig().addCacheConfig(config);
    assertConfigurationsEqualOnAllMembers(config);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

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