use of com.hazelcast.replicatedmap.ReplicatedMap in project hazelcast by hazelcast.
the class ClientReplicatedMapTest method clear_empties_internal_ttl_schedulers.
@Test
public void clear_empties_internal_ttl_schedulers() {
String mapName = "test";
HazelcastInstance node = factory.newHazelcastInstance(config);
HazelcastInstance client = factory.newHazelcastClient();
ReplicatedMap map = client.getReplicatedMap(mapName);
for (int i = 0; i < 1000; i++) {
map.put(i, i, 100, TimeUnit.DAYS);
}
map.clear();
assertAllTtlSchedulersEmpty(node.getReplicatedMap(mapName));
}
use of com.hazelcast.replicatedmap.ReplicatedMap in project hazelcast by hazelcast.
the class BatchStageTest method mapUsingReplicatedMap.
@Test
public void mapUsingReplicatedMap() {
// Given
List<Integer> input = sequence(itemCount);
String prefix = "value-";
String replicatedMapName = randomMapName();
ReplicatedMap<Integer, String> replicatedMap = member.getReplicatedMap(replicatedMapName);
for (int i : input) {
replicatedMap.put(i, prefix + i);
}
for (HazelcastInstance hz : allHazelcastInstances()) {
assertSizeEventually(itemCount, hz.getReplicatedMap(replicatedMapName));
}
// When
BatchStage<Entry<Integer, String>> stage = batchStageFromList(input).mapUsingReplicatedMap(replicatedMap, FunctionEx.identity(), Util::entry);
// Then
stage.writeTo(sink);
execute();
Function<Entry<Integer, String>, String> formatFn = e -> String.format("(%04d, %s)", e.getKey(), e.getValue());
assertEquals(streamToString(input.stream().map(i -> entry(i, prefix + i)), formatFn), streamToString(sinkStreamOfEntry(), formatFn));
}
use of com.hazelcast.replicatedmap.ReplicatedMap in project hazelcast by hazelcast.
the class DynamicConfigTest method testSameReplicatedMapConfig_canBeAddedTwice.
@Test
public void testSameReplicatedMapConfig_canBeAddedTwice() {
ReplicatedMapConfig config = new ReplicatedMapConfig(name);
driver.getConfig().addReplicatedMapConfig(config);
ReplicatedMap map = driver.getReplicatedMap(name);
driver.getConfig().addReplicatedMapConfig(config);
assertConfigurationsEqualOnAllMembers(config);
}
Aggregations