use of com.hazelcast.config.ReplicatedMapConfig in project hazelcast by hazelcast.
the class ReplicatedMapListenerTest method testRegisterListenerViaConfiguration.
@Test
public void testRegisterListenerViaConfiguration() {
String mapName = randomMapName();
Config config = new Config();
ReplicatedMapConfig replicatedMapConfig = config.getReplicatedMapConfig(mapName);
EntryListenerConfig listenerConfig = new EntryListenerConfig();
final EventCountingListener<Integer, Integer> listener = new EventCountingListener<>();
listenerConfig.setImplementation(listener);
replicatedMapConfig.addEntryListenerConfig(listenerConfig);
HazelcastInstance instance = createHazelcastInstance(config);
ReplicatedMap<Object, Object> replicatedMap = instance.getReplicatedMap(mapName);
replicatedMap.put(3, 3);
assertTrueEventually(() -> {
assertEquals(1, listener.addCount.get());
assertEquals(Integer.valueOf(3), listener.keys.peek());
}, 10);
}
use of com.hazelcast.config.ReplicatedMapConfig in project hazelcast by hazelcast.
the class ReplicatedMapLoadingTest method testAsyncFillUp.
@Test
public void testAsyncFillUp() {
Config config = new Config();
String mapName = randomMapName();
ReplicatedMapConfig replicatedMapConfig = config.getReplicatedMapConfig(mapName);
replicatedMapConfig.setAsyncFillup(true);
TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory();
fillMapsAndAssertMapSizeEventually(nodeFactory, config, mapName);
}
use of com.hazelcast.config.ReplicatedMapConfig in project hazelcast by hazelcast.
the class ReplicatedMapLoadingTest method testSyncFillUp.
@Test
public void testSyncFillUp() {
Config config = new Config();
String mapName = randomMapName();
ReplicatedMapConfig replicatedMapConfig = config.getReplicatedMapConfig(mapName);
replicatedMapConfig.setAsyncFillup(false);
TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory();
fillMapsAndAssertMapSizeEventually(nodeFactory, config, mapName);
}
use of com.hazelcast.config.ReplicatedMapConfig in project hazelcast by hazelcast.
the class ReplicatedMapServiceTest method testGetLocalReplicatedMapStatsNoObjectGenerationIfDisabledStats.
@Test
public void testGetLocalReplicatedMapStatsNoObjectGenerationIfDisabledStats() {
String name = randomMapName();
ReplicatedMapConfig replicatedMapConfig = new ReplicatedMapConfig();
replicatedMapConfig.setName(name);
replicatedMapConfig.setStatisticsEnabled(false);
nodeEngine.getConfig().addReplicatedMapConfig(replicatedMapConfig);
ReplicatedMapService service = new ReplicatedMapService(nodeEngine);
LocalReplicatedMapStats stats = service.getLocalReplicatedMapStats(name);
LocalReplicatedMapStats stats2 = service.getLocalReplicatedMapStats(name);
LocalReplicatedMapStats stats3 = service.getLocalReplicatedMapStats(name);
assertSame(stats, stats2);
assertSame(stats2, stats3);
}
use of com.hazelcast.config.ReplicatedMapConfig in project hazelcast by hazelcast.
the class ReplicatedMapAbstractTest method buildConfig.
protected Config buildConfig(Config config, InMemoryFormat inMemoryFormat) {
ReplicatedMapConfig replicatedMapConfig = config.getReplicatedMapConfig("default");
replicatedMapConfig.setInMemoryFormat(inMemoryFormat);
return config;
}
Aggregations