Search in sources :

Example 11 with MapConfig

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

the class TestFullApplicationContext method testWhenBothMapEvictionPolicyClassNameAndEvictionPolicySet.

@Test
public void testWhenBothMapEvictionPolicyClassNameAndEvictionPolicySet() {
    MapConfig mapConfig = config.getMapConfig("mapBothMapEvictionPolicyClassNameAndEvictionPolicy");
    String expectedComparatorClassName = "com.hazelcast.map.eviction.LRUEvictionPolicy";
    assertEquals(expectedComparatorClassName, mapConfig.getMapEvictionPolicy().getClass().getName());
}
Also used : MapConfig(com.hazelcast.config.MapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 12 with MapConfig

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

the class TestFullApplicationContext method testFullQueryCacheConfig.

@Test
public void testFullQueryCacheConfig() {
    MapConfig mapConfig = config.getMapConfig("map-with-query-cache");
    QueryCacheConfig queryCacheConfig = mapConfig.getQueryCacheConfigs().get(0);
    EntryListenerConfig entryListenerConfig = queryCacheConfig.getEntryListenerConfigs().get(0);
    assertTrue(entryListenerConfig.isIncludeValue());
    assertFalse(entryListenerConfig.isLocal());
    assertEquals("com.hazelcast.spring.DummyEntryListener", entryListenerConfig.getClassName());
    assertFalse(queryCacheConfig.isIncludeValue());
    assertEquals("my-query-cache-1", queryCacheConfig.getName());
    assertEquals(12, queryCacheConfig.getBatchSize());
    assertEquals(33, queryCacheConfig.getBufferSize());
    assertEquals(12, queryCacheConfig.getDelaySeconds());
    assertEquals(InMemoryFormat.OBJECT, queryCacheConfig.getInMemoryFormat());
    assertTrue(queryCacheConfig.isCoalesce());
    assertFalse(queryCacheConfig.isPopulate());
    assertIndexesEqual(queryCacheConfig);
    assertEquals("__key > 12", queryCacheConfig.getPredicateConfig().getSql());
    assertEquals(EvictionPolicy.LRU, queryCacheConfig.getEvictionConfig().getEvictionPolicy());
    assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT, queryCacheConfig.getEvictionConfig().getMaximumSizePolicy());
    assertEquals(111, queryCacheConfig.getEvictionConfig().getSize());
}
Also used : QueryCacheConfig(com.hazelcast.config.QueryCacheConfig) MapConfig(com.hazelcast.config.MapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) EntryListenerConfig(com.hazelcast.config.EntryListenerConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 13 with MapConfig

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

the class TestFullApplicationContext method testMapEvictionPolicyImpl.

@Test
public void testMapEvictionPolicyImpl() {
    MapConfig mapConfig = config.getMapConfig("mapWithMapEvictionPolicyImpl");
    assertEquals(DummyMapEvictionPolicy.class, mapConfig.getMapEvictionPolicy().getClass());
}
Also used : MapConfig(com.hazelcast.config.MapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 14 with MapConfig

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

the class TestFullApplicationContext method testMapEvictionPolicyClassName.

@Test
public void testMapEvictionPolicyClassName() {
    MapConfig mapConfig = config.getMapConfig("mapWithMapEvictionPolicyClassName");
    String expectedComparatorClassName = "com.hazelcast.map.eviction.LRUEvictionPolicy";
    assertEquals(expectedComparatorClassName, mapConfig.getMapEvictionPolicy().getClass().getName());
}
Also used : MapConfig(com.hazelcast.config.MapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Example 15 with MapConfig

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

the class MapConfigRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject root) {
    final JsonObject result = new JsonObject();
    result.add("update", update);
    if (update) {
        final Set<Member> members = mcs.getHazelcastInstance().getCluster().getMembers();
        for (Member member : members) {
            mcs.callOnMember(member, new UpdateMapConfigOperation(mapName, config.getMapConfig()));
        }
        result.add("updateResult", "success");
    } else {
        MapConfig cfg = (MapConfig) mcs.callOnThis(new GetMapConfigOperation(mapName));
        if (cfg != null) {
            result.add("hasMapConfig", true);
            result.add("mapConfig", new MapConfigDTO(cfg).toJson());
        } else {
            result.add("hasMapConfig", false);
        }
    }
    root.add("result", result);
}
Also used : GetMapConfigOperation(com.hazelcast.internal.management.operation.GetMapConfigOperation) MapConfigDTO(com.hazelcast.internal.management.dto.MapConfigDTO) JsonObject(com.eclipsesource.json.JsonObject) UpdateMapConfigOperation(com.hazelcast.internal.management.operation.UpdateMapConfigOperation) MapConfig(com.hazelcast.config.MapConfig) Member(com.hazelcast.core.Member)

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