Search in sources :

Example 31 with Config

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;
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) PassThroughMergePolicy(com.hazelcast.map.merge.PassThroughMergePolicy) WanReplicationRef(com.hazelcast.config.WanReplicationRef) WanPublisherConfig(com.hazelcast.config.WanPublisherConfig) Config(com.hazelcast.config.Config) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig)

Example 32 with 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);
}
Also used : Config(com.hazelcast.config.Config) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) FilteringClassLoader(com.hazelcast.util.FilteringClassLoader) IncrementingEntryProcessor(usercodedeployment.IncrementingEntryProcessor) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 33 with Config

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);
}
Also used : Config(com.hazelcast.config.Config) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) FilteringClassLoader(com.hazelcast.util.FilteringClassLoader) IncrementingEntryProcessor(usercodedeployment.IncrementingEntryProcessor) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 34 with Config

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);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapStoreTest(com.hazelcast.map.impl.mapstore.MapStoreTest) Config(com.hazelcast.config.Config) MapStoreConfig(com.hazelcast.config.MapStoreConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) MapStoreTest(com.hazelcast.map.impl.mapstore.MapStoreTest) Test(org.junit.Test)

Example 35 with Config

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());
}
Also used : IMap(com.hazelcast.core.IMap) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) NearCachedMapProxyImpl(com.hazelcast.map.impl.proxy.NearCachedMapProxyImpl) HashSet(java.util.HashSet) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

Config (com.hazelcast.config.Config)2458 Test (org.junit.Test)1570 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1465 QuickTest (com.hazelcast.test.annotation.QuickTest)1286 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1003 MapConfig (com.hazelcast.config.MapConfig)599 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)497 MapStoreConfig (com.hazelcast.config.MapStoreConfig)300 NearCacheConfig (com.hazelcast.config.NearCacheConfig)270 Before (org.junit.Before)242 ClientConfig (com.hazelcast.client.config.ClientConfig)228 SlowTest (com.hazelcast.test.annotation.SlowTest)204 NightlyTest (com.hazelcast.test.annotation.NightlyTest)186 CountDownLatch (java.util.concurrent.CountDownLatch)182 IndexConfig (com.hazelcast.config.IndexConfig)162 JoinConfig (com.hazelcast.config.JoinConfig)142 ParallelTest (com.hazelcast.test.annotation.ParallelTest)141 AssertTask (com.hazelcast.test.AssertTask)131 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)126 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)125