use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class WanReplicationTest method getConfig.
@Override
protected Config getConfig() {
Config config = new Config();
WanReplicationConfig wanConfig = new WanReplicationConfig();
wanConfig.setName("dummyWan");
wanConfig.addWanPublisherConfig(getPublisherConfig());
WanReplicationRef wanRef = new WanReplicationRef();
wanRef.setName("dummyWan");
wanRef.setMergePolicy(PassThroughMergePolicy.class.getName());
config.addWanReplicationConfig(wanConfig);
config.getMapConfig("default").setWanReplicationRef(wanRef);
return config;
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class UserCodeDeploymentSmokeTest method givenProviderFilterUsesMemberAttribute_whenSomeMemberHasMatchingAttribute_thenClassLoadingRequestSucceed.
@Test
public void givenProviderFilterUsesMemberAttribute_whenSomeMemberHasMatchingAttribute_thenClassLoadingRequestSucceed() {
Config i1Config = new Config();
i1Config.getMemberAttributeConfig().setStringAttribute("foo", "bar");
i1Config.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
Config i2Config = new Config();
FilteringClassLoader filteringCL = new FilteringClassLoader(asList("usercodedeployment"), null);
i2Config.setClassLoader(filteringCL);
i2Config.getUserCodeDeploymentConfig().setEnabled(true).setProviderFilter("HAS_ATTRIBUTE:foo").setClassCacheMode(classCacheMode);
EntryProcessor<Integer, Integer> myEP = new IncrementingEntryProcessor();
executeSimpleTestScenario(i1Config, i2Config, myEP);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class UserCodeDeploymentSmokeTest method givenTheEPButItIsNotOnTheWhitelist_whenTheEPIsFilteredLocally_thenItWillFailToLoadIt.
@Test(expected = HazelcastSerializationException.class)
public void givenTheEPButItIsNotOnTheWhitelist_whenTheEPIsFilteredLocally_thenItWillFailToLoadIt() {
Config i1Config = new Config();
i1Config.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
Config i2Config = new Config();
FilteringClassLoader filteringCL = new FilteringClassLoader(asList("usercodedeployment"), null);
i2Config.setClassLoader(filteringCL);
i2Config.getUserCodeDeploymentConfig().setEnabled(true).setWhitelistedPrefixes("usercodedeployment.whitelisted").setClassCacheMode(classCacheMode);
EntryProcessor<Integer, Integer> myEP = new IncrementingEntryProcessor();
executeSimpleTestScenario(i1Config, i2Config, myEP);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class WriteBehindUponMigrationTest method testRemovedEntry_shouldNotBeReached_afterMigration.
@Test
public void testRemovedEntry_shouldNotBeReached_afterMigration() throws Exception {
String mapName = randomMapName();
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(2);
MapStoreTest.SimpleMapStore<Integer, Integer> store = new MapStoreTest.SimpleMapStore<Integer, Integer>();
store.store.put(1, 0);
Config config = createConfig(mapName, store);
HazelcastInstance node1 = factory.newHazelcastInstance(config);
IMap<Integer, Integer> map = node1.getMap(mapName);
map.put(1, 1);
map.delete(1);
HazelcastInstance node2 = factory.newHazelcastInstance(config);
map = node2.getMap(mapName);
Integer value = map.get(1);
factory.shutdownAll();
assertNull(value);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class GetAllTest method ensure_supplied_number_of_keys_are_in_near_cache.
@Test
public void ensure_supplied_number_of_keys_are_in_near_cache() throws Exception {
final int entryCount = 100000;
final String mapName = "test";
NearCacheConfig nearCacheConfig = new NearCacheConfig();
nearCacheConfig.setCacheLocalEntries(true);
nearCacheConfig.setInvalidateOnChange(true);
Config config = new Config();
config.getMapConfig(mapName).setNearCacheConfig(nearCacheConfig);
HazelcastInstance node = createHazelcastInstance(config);
IMap map = node.getMap(mapName);
for (int i = 0; i < entryCount; i++) {
map.put(i, i);
}
HashSet keys = new HashSet();
for (int i = 0; i < entryCount; i++) {
keys.add(i);
}
map.getAll(keys);
assertEquals(entryCount, ((NearCachedMapProxyImpl) map).getNearCache().size());
}
Aggregations