use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class PutIfAbsentMergePolicyTest method merge_existingValueAbsent.
@Test
@SuppressWarnings("ConstantConditions")
public void merge_existingValueAbsent() {
MapMergeTypes existing = null;
MapMergeTypes merging = mergingValueWithGivenValue(MERGING);
assertEquals(MERGING, mergePolicy.merge(merging, existing));
}
use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class PutIfAbsentMergePolicyTest method merge_bothValuesNull.
@Test
public void merge_bothValuesNull() {
MapMergeTypes existing = mergingValueWithGivenValue(null);
MapMergeTypes merging = mergingValueWithGivenValue(null);
assertNull(mergePolicy.merge(merging, existing));
}
use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class DiscardMergePolicyTest method merge_mergingNull.
@Test
@SuppressWarnings("ConstantConditions")
public void merge_mergingNull() {
MapMergeTypes existing = mergingValueWithGivenValue(EXISTING);
MapMergeTypes merging = null;
assertEquals(EXISTING, mergePolicy.merge(merging, existing));
}
use of com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes in project hazelcast by hazelcast.
the class AbstractWanCustomPublisherMapTest method runMergeOpForWAN.
private void runMergeOpForWAN(boolean enableWANReplicationEvent) {
// init hazelcast instances
String mapName = "merge_operation_generates_wan_replication_event";
initInstancesAndMap(mapName);
// get internal services to use in this test
HazelcastInstance node = instance1;
NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(node);
InternalPartitionService partitionService = nodeEngineImpl.getPartitionService();
OperationServiceImpl operationService = nodeEngineImpl.getOperationService();
SerializationService serializationService = nodeEngineImpl.getSerializationService();
MapService mapService = nodeEngineImpl.getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(mapName);
// prepare and send one merge operation
Data data = serializationService.toData(1);
MapOperation op;
SimpleEntryView<Data, Data> entryView = new SimpleEntryView<Data, Data>().withKey(data).withValue(data);
MapMergeTypes<Object, Object> mergingEntry = createMergingEntry(serializationService, entryView);
SplitBrainMergePolicy<Object, MapMergeTypes<Object, Object>, Object> mergePolicy = new com.hazelcast.spi.merge.PassThroughMergePolicy<>();
op = operationProvider.createMergeOperation(mapName, mergingEntry, mergePolicy, !enableWANReplicationEvent);
operationService.createInvocationBuilder(MapService.SERVICE_NAME, op, partitionService.getPartitionId(data)).invoke();
}
Aggregations