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);
}
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);
}
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);
}
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);
}
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);
}
}
Aggregations