Search in sources :

Example 26 with CacheSimpleConfig

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

the class HazelcastRemoteConnectorTest method setUp.

@BeforeClass
public static void setUp() {
    Config config = smallInstanceConfig();
    config.addCacheConfig(new CacheSimpleConfig().setName("*"));
    localHz = factory.newHazelcastInstance(config);
    HazelcastInstance localHz2 = factory.newHazelcastInstance(config);
    Config remoteClusterConfig = smallInstanceConfig();
    CacheSimpleConfig cacheConfig = new CacheSimpleConfig().setName("*");
    cacheConfig.getEventJournalConfig().setEnabled(true);
    remoteClusterConfig.addCacheConfig(cacheConfig);
    remoteClusterConfig.setClusterName(randomName());
    MapConfig mapConfig = new MapConfig();
    mapConfig.setName("*").getEventJournalConfig().setEnabled(true);
    remoteClusterConfig.addMapConfig(mapConfig);
    remoteHz = Hazelcast.newHazelcastInstance(remoteClusterConfig);
    HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(remoteClusterConfig);
    clientConfig = new ClientConfig();
    clientConfig.setClusterName(remoteClusterConfig.getClusterName());
    Address address = remoteHz.getCluster().getLocalMember().getAddress();
    clientConfig.getNetworkConfig().addAddress(address.getHost() + ':' + address.getPort());
    // workaround for `cache is not created` exception, create cache locally on all nodes
    hz2.getCacheManager().getCache(SOURCE_NAME);
    hz2.getCacheManager().getCache(SINK_NAME);
    localHz2.getCacheManager().getCache(SOURCE_NAME);
    localHz2.getCacheManager().getCache(SINK_NAME);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.cluster.Address) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Config(com.hazelcast.config.Config) MapConfig(com.hazelcast.config.MapConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) BeforeClass(org.junit.BeforeClass)

Example 27 with CacheSimpleConfig

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

the class SourcesTest method setUp.

@BeforeClass
public static void setUp() {
    Config config = new Config();
    config.setClusterName(randomName());
    config.addCacheConfig(new CacheSimpleConfig().setName("*"));
    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 28 with CacheSimpleConfig

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

the class JobSerializerTest method beforeClass.

@BeforeClass
public static void beforeClass() {
    Config config = smallInstanceConfig();
    config.addCacheConfig(new CacheSimpleConfig().setName(SOURCE_CACHE_NAME)).addCacheConfig(new CacheSimpleConfig().setName(SINK_CACHE_NAME));
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.getSerializationConfig().addSerializerConfig(new SerializerConfig().setTypeClass(Value.class).setClass(ValueSerializer.class));
    initializeWithClient(1, config, clientConfig);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) SerializerConfig(com.hazelcast.config.SerializerConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) SerializerConfig(com.hazelcast.config.SerializerConfig) Config(com.hazelcast.config.Config) JobConfig(com.hazelcast.jet.config.JobConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) BeforeClass(org.junit.BeforeClass)

Example 29 with CacheSimpleConfig

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

the class AbstractDynamicConfigGeneratorTest method testCacheAttributes.

// CACHE
@Test
public void testCacheAttributes() {
    CacheSimpleConfig expectedConfig = new CacheSimpleConfig().setName("testCache").setEvictionConfig(evictionConfig()).setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(2).setAsyncBackupCount(3).setCacheLoader("cacheLoader").setCacheWriter("cacheWriter").setExpiryPolicyFactoryConfig(new CacheSimpleConfig.ExpiryPolicyFactoryConfig("expiryPolicyFactory")).setManagementEnabled(true).setStatisticsEnabled(true).setKeyType("keyType").setValueType("valueType").setReadThrough(true).setDataPersistenceConfig(dataPersistenceConfig()).setEventJournalConfig(eventJournalConfig()).setCacheEntryListeners(singletonList(cacheSimpleEntryListenerConfig())).setWriteThrough(true).setPartitionLostListenerConfigs(singletonList(new CachePartitionLostListenerConfig("partitionLostListener"))).setSplitBrainProtectionName("testSplitBrainProtection");
    expectedConfig.getMergePolicyConfig().setPolicy("HigherHitsMergePolicy").setBatchSize(99);
    expectedConfig.setDisablePerEntryInvalidationEvents(true);
    expectedConfig.setWanReplicationRef(wanReplicationRef());
    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 30 with CacheSimpleConfig

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

the class DynamicConfigTest method assertConfigurationsEqualOnAllMembers.

private void assertConfigurationsEqualOnAllMembers(CacheSimpleConfig config) {
    String name = config.getName();
    for (HazelcastInstance instance : members) {
        CacheSimpleConfig registeredConfig = instance.getConfig().getCacheConfig(name);
        assertEquals(config, registeredConfig);
    }
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance)

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