Search in sources :

Example 96 with MapConfig

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

the class InMemoryFormatTest method equals.

@Test
public void equals() {
    Config config = new Config();
    config.addMapConfig(new MapConfig("objectMap").setInMemoryFormat(InMemoryFormat.OBJECT));
    config.addMapConfig(new MapConfig("binaryMap").setInMemoryFormat(InMemoryFormat.BINARY));
    HazelcastInstance hz = createHazelcastInstance(config);
    Pair v1 = new Pair("a", "1");
    Pair v2 = new Pair("a", "2");
    IMap<String, Pair> objectMap = hz.getMap("objectMap");
    IMap<String, Pair> binaryMap = hz.getMap("binaryMap");
    objectMap.put("1", v1);
    binaryMap.put("1", v1);
    assertTrue(objectMap.containsValue(v1));
    assertTrue(objectMap.containsValue(v2));
    assertTrue(binaryMap.containsValue(v1));
    assertFalse(binaryMap.containsValue(v2));
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MapConfig(com.hazelcast.config.MapConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 97 with MapConfig

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

the class EntryProcessorTest method setupImapForEntryProcessorWithIndex.

private IMap<Long, MyData> setupImapForEntryProcessorWithIndex() {
    Config config = getConfig();
    MapConfig testMapConfig = config.getMapConfig(MAP_NAME);
    testMapConfig.setInMemoryFormat(inMemoryFormat);
    testMapConfig.getMapIndexConfigs().add(new MapIndexConfig("lastValue", true));
    HazelcastInstance instance = createHazelcastInstance(config);
    return instance.getMap(MAP_NAME);
}
Also used : MapIndexConfig(com.hazelcast.config.MapIndexConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) Config(com.hazelcast.config.Config) MapIndexConfig(com.hazelcast.config.MapIndexConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 98 with MapConfig

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

the class DynamicMapConfigTest method createMapConfig.

private MapConfig createMapConfig() {
    MapConfig mapConfig = new MapConfig();
    mapConfig.setTimeToLiveSeconds(100);
    mapConfig.setMaxIdleSeconds(22);
    mapConfig.setEvictionPolicy(EvictionPolicy.LRU);
    mapConfig.setEvictionPercentage(35);
    mapConfig.setMinEvictionCheckMillis(199);
    mapConfig.setReadBackupData(false);
    mapConfig.setBackupCount(3);
    mapConfig.setAsyncBackupCount(2);
    mapConfig.setMaxSizeConfig(new MaxSizeConfig(111, MaxSizeConfig.MaxSizePolicy.FREE_HEAP_SIZE));
    return mapConfig;
}
Also used : MaxSizeConfig(com.hazelcast.config.MaxSizeConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 99 with MapConfig

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

the class DynamicMapConfigTest method updateMapConfig.

private void updateMapConfig(String mapName, HazelcastInstance node) throws InterruptedException, ExecutionException {
    MapConfig mapConfig = createMapConfig();
    Operation updateMapConfigOperation = new UpdateMapConfigOperation(mapName, mapConfig);
    executeOperation(node, updateMapConfigOperation);
}
Also used : MapConfig(com.hazelcast.config.MapConfig) UpdateMapConfigOperation(com.hazelcast.internal.management.operation.UpdateMapConfigOperation) Operation(com.hazelcast.spi.Operation) UpdateMapConfigOperation(com.hazelcast.internal.management.operation.UpdateMapConfigOperation)

Example 100 with MapConfig

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

the class EvictionTest method newConfigWithTTL.

private Config newConfigWithTTL(String mapName, int ttlSeconds) {
    Config config = getConfig();
    MapConfig mapConfig = config.getMapConfig(mapName + "*");
    mapConfig.setTimeToLiveSeconds(ttlSeconds);
    config.addMapConfig(mapConfig);
    return config;
}
Also used : MaxSizeConfig(com.hazelcast.config.MaxSizeConfig) MapConfig(com.hazelcast.config.MapConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) Config(com.hazelcast.config.Config) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MapConfig(com.hazelcast.config.MapConfig)

Aggregations

MapConfig (com.hazelcast.config.MapConfig)178 Config (com.hazelcast.config.Config)123 HazelcastInstance (com.hazelcast.core.HazelcastInstance)78 Test (org.junit.Test)75 QuickTest (com.hazelcast.test.annotation.QuickTest)68 ParallelTest (com.hazelcast.test.annotation.ParallelTest)62 MapStoreConfig (com.hazelcast.config.MapStoreConfig)43 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)41 NearCacheConfig (com.hazelcast.config.NearCacheConfig)27 MaxSizeConfig (com.hazelcast.config.MaxSizeConfig)26 MapIndexConfig (com.hazelcast.config.MapIndexConfig)20 QuorumConfig (com.hazelcast.config.QuorumConfig)19 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)18 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)16 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)14 NightlyTest (com.hazelcast.test.annotation.NightlyTest)12 PartitionedCluster (com.hazelcast.quorum.PartitionedCluster)10 CountDownLatch (java.util.concurrent.CountDownLatch)10 BeforeClass (org.junit.BeforeClass)10 AssertTask (com.hazelcast.test.AssertTask)9