Search in sources :

Example 11 with MapConfigReadOnly

use of com.hazelcast.internal.config.MapConfigReadOnly in project hazelcast by hazelcast.

the class MapConfigTest method testEqualsAndHashCode.

@Test
public void testEqualsAndHashCode() {
    assumeDifferentHashCodes();
    EqualsVerifier.forClass(MapConfig.class).suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS).withPrefabValues(EvictionConfig.class, new EvictionConfig().setSize(300).setMaxSizePolicy(MaxSizePolicy.PER_PARTITION), new EvictionConfig().setSize(100).setMaxSizePolicy(MaxSizePolicy.PER_NODE)).withPrefabValues(MapStoreConfig.class, new MapStoreConfig().setEnabled(true).setClassName("red"), new MapStoreConfig().setEnabled(true).setClassName("black")).withPrefabValues(NearCacheConfig.class, new NearCacheConfig().setTimeToLiveSeconds(10).setMaxIdleSeconds(20).setInvalidateOnChange(false).setInMemoryFormat(InMemoryFormat.BINARY), new NearCacheConfig().setTimeToLiveSeconds(15).setMaxIdleSeconds(25).setInvalidateOnChange(true).setInMemoryFormat(InMemoryFormat.OBJECT)).withPrefabValues(WanReplicationRef.class, new WanReplicationRef().setName("red"), new WanReplicationRef().setName("black")).withPrefabValues(PartitioningStrategyConfig.class, new PartitioningStrategyConfig("red"), new PartitioningStrategyConfig("black")).withPrefabValues(MapConfigReadOnly.class, new MapConfigReadOnly(new MapConfig("red")), new MapConfigReadOnly(new MapConfig("black"))).withPrefabValues(MergePolicyConfig.class, new MergePolicyConfig(PutIfAbsentMergePolicy.class.getName(), 100), new MergePolicyConfig(DiscardMergePolicy.class.getName(), 200)).verify();
}
Also used : MapConfigReadOnly(com.hazelcast.internal.config.MapConfigReadOnly) PutIfAbsentMergePolicy(com.hazelcast.spi.merge.PutIfAbsentMergePolicy) DiscardMergePolicy(com.hazelcast.spi.merge.DiscardMergePolicy) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 12 with MapConfigReadOnly

use of com.hazelcast.internal.config.MapConfigReadOnly in project hazelcast by hazelcast.

the class MapConfigReadOnlyTest method getEntryListenerConfigsOfReadOnlyMapConfigShouldReturnUnmodifiable.

@Test(expected = UnsupportedOperationException.class)
public void getEntryListenerConfigsOfReadOnlyMapConfigShouldReturnUnmodifiable() {
    MapConfig config = new MapConfig().addEntryListenerConfig(new EntryListenerConfig()).addEntryListenerConfig(new EntryListenerConfig());
    List<EntryListenerConfig> listenerConfigs = new MapConfigReadOnly(config).getEntryListenerConfigs();
    listenerConfigs.add(new EntryListenerConfig());
}
Also used : MapConfigReadOnly(com.hazelcast.internal.config.MapConfigReadOnly) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 13 with MapConfigReadOnly

use of com.hazelcast.internal.config.MapConfigReadOnly in project hazelcast by hazelcast.

the class MapConfigReadOnlyTest method getWanReplicationRefOfReadOnlyMapConfigShouldReturnNullIfWanReplicationRefIsNull.

@Test
public void getWanReplicationRefOfReadOnlyMapConfigShouldReturnNullIfWanReplicationRefIsNull() {
    MapConfig config = new MapConfig().setWanReplicationRef(null);
    WanReplicationRef wanReplicationRef = new MapConfigReadOnly(config).getWanReplicationRef();
    assertNull(wanReplicationRef);
}
Also used : MapConfigReadOnly(com.hazelcast.internal.config.MapConfigReadOnly) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 14 with MapConfigReadOnly

use of com.hazelcast.internal.config.MapConfigReadOnly in project hazelcast by hazelcast.

the class MapConfigReadOnlyTest method getMapStoreConfigOfReadOnlyMapConfigShouldReturnUnmodifiable.

@Test(expected = UnsupportedOperationException.class)
public void getMapStoreConfigOfReadOnlyMapConfigShouldReturnUnmodifiable() {
    MapConfig config = new MapConfig().setMapStoreConfig(new MapStoreConfig());
    MapStoreConfig mapStoreConfig = new MapConfigReadOnly(config).getMapStoreConfig();
    mapStoreConfig.setEnabled(true);
}
Also used : MapConfigReadOnly(com.hazelcast.internal.config.MapConfigReadOnly) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 15 with MapConfigReadOnly

use of com.hazelcast.internal.config.MapConfigReadOnly in project hazelcast by hazelcast.

the class MapConfigReadOnlyTest method getPartitionLostListenerConfigsOfReadOnlyMapConfigShouldReturnUnmodifiable.

@Test(expected = UnsupportedOperationException.class)
public void getPartitionLostListenerConfigsOfReadOnlyMapConfigShouldReturnUnmodifiable() {
    MapConfig config = new MapConfig().addMapPartitionLostListenerConfig(new MapPartitionLostListenerConfig()).addMapPartitionLostListenerConfig(new MapPartitionLostListenerConfig());
    List<MapPartitionLostListenerConfig> listenerConfigs = new MapConfigReadOnly(config).getPartitionLostListenerConfigs();
    listenerConfigs.add(new MapPartitionLostListenerConfig());
}
Also used : MapConfigReadOnly(com.hazelcast.internal.config.MapConfigReadOnly) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MapConfigReadOnly (com.hazelcast.internal.config.MapConfigReadOnly)16 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)13 QuickTest (com.hazelcast.test.annotation.QuickTest)13 Test (org.junit.Test)13 EvictionConfig (com.hazelcast.config.EvictionConfig)2 MapConfig (com.hazelcast.config.MapConfig)2 MapContainer (com.hazelcast.map.impl.MapContainer)2 MapService (com.hazelcast.map.impl.MapService)2 IndexConfig (com.hazelcast.config.IndexConfig)1 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)1 DiscardMergePolicy (com.hazelcast.spi.merge.DiscardMergePolicy)1 PutIfAbsentMergePolicy (com.hazelcast.spi.merge.PutIfAbsentMergePolicy)1