Search in sources :

Example 1 with EntryView

use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.

the class EntryBackupOperation method publishWanReplicationEvent.

private void publishWanReplicationEvent(EntryEventType eventType) {
    final MapContainer mapContainer = this.mapContainer;
    if (!mapContainer.isWanReplicationEnabled()) {
        return;
    }
    final MapEventPublisher mapEventPublisher = mapContainer.getMapServiceContext().getMapEventPublisher();
    final Data key = dataKey;
    if (EntryEventType.REMOVED == eventType) {
        mapEventPublisher.publishWanReplicationRemoveBackup(name, key, Clock.currentTimeMillis());
    } else {
        final Record record = recordStore.getRecord(key);
        if (record != null) {
            dataValue = mapContainer.getMapServiceContext().toData(dataValue);
            final EntryView entryView = createSimpleEntryView(key, dataValue, record);
            mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
        }
    }
}
Also used : EntryView(com.hazelcast.core.EntryView) EntryViews.createSimpleEntryView(com.hazelcast.map.impl.EntryViews.createSimpleEntryView) Data(com.hazelcast.nio.serialization.Data) Record(com.hazelcast.map.impl.record.Record) MapContainer(com.hazelcast.map.impl.MapContainer) MapEventPublisher(com.hazelcast.map.impl.event.MapEventPublisher)

Example 2 with EntryView

use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.

the class EntryOperation method publishWanReplicationEvent.

private void publishWanReplicationEvent() {
    final MapContainer mapContainer = this.mapContainer;
    if (mapContainer.getWanReplicationPublisher() == null && mapContainer.getWanMergePolicy() == null) {
        return;
    }
    final Data key = dataKey;
    if (REMOVED.equals(eventType)) {
        mapEventPublisher.publishWanReplicationRemove(name, key, getNow());
    } else {
        final Record record = recordStore.getRecord(key);
        if (record != null) {
            dataValue = toData(dataValue);
            final EntryView entryView = createSimpleEntryView(key, dataValue, record);
            mapEventPublisher.publishWanReplicationUpdate(name, entryView);
        }
    }
}
Also used : EntryView(com.hazelcast.core.EntryView) EntryViews.createSimpleEntryView(com.hazelcast.map.impl.EntryViews.createSimpleEntryView) Data(com.hazelcast.nio.serialization.Data) Record(com.hazelcast.map.impl.record.Record) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 3 with EntryView

use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.

the class AbstractMapMergePolicyTest method merge_draw_mergingWins.

@Test
public void merge_draw_mergingWins() {
    EntryView existing = entryWithGivenPropertyAndValue(1, EXISTING);
    EntryView merging = entryWithGivenPropertyAndValue(1, MERGING);
    assertEquals(MERGING, policy.merge("map", merging, existing));
}
Also used : EntryView(com.hazelcast.core.EntryView) Test(org.junit.Test)

Example 4 with EntryView

use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.

the class PassThroughMapMergePolicyTest method merge_mergingNull.

@Test
public void merge_mergingNull() {
    EntryView existing = entryWithGivenValue(EXISTING);
    EntryView merging = null;
    assertEquals(EXISTING, policy.merge("map", merging, existing));
}
Also used : EntryView(com.hazelcast.core.EntryView) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 5 with EntryView

use of com.hazelcast.core.EntryView in project hazelcast by hazelcast.

the class PutIfAbsentMapMergePolicyTest method merge_bothValuesNull.

@Test
public void merge_bothValuesNull() {
    EntryView existing = entryWithGivenValue(null);
    EntryView merging = entryWithGivenValue(null);
    assertNull(policy.merge("map", merging, existing));
}
Also used : EntryView(com.hazelcast.core.EntryView) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

EntryView (com.hazelcast.core.EntryView)40 Test (org.junit.Test)19 QuickTest (com.hazelcast.test.annotation.QuickTest)16 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)9 Record (com.hazelcast.map.impl.record.Record)8 Data (com.hazelcast.nio.serialization.Data)8 ParallelTest (com.hazelcast.test.annotation.ParallelTest)7 SlowTest (com.hazelcast.test.annotation.SlowTest)6 BasicMapTest (com.hazelcast.map.BasicMapTest)5 EntryViews.createSimpleEntryView (com.hazelcast.map.impl.EntryViews.createSimpleEntryView)5 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 Config (com.hazelcast.config.Config)2 MapConfig (com.hazelcast.config.MapConfig)2 Data (com.hazelcast.internal.serialization.Data)2 EntryCostEstimatorTest (com.hazelcast.map.EntryCostEstimatorTest)2 MapContainer (com.hazelcast.map.impl.MapContainer)2 MapEventPublisher (com.hazelcast.map.impl.event.MapEventPublisher)2 MapOperation (com.hazelcast.map.impl.operation.MapOperation)2 LazyEvictableEntryView (com.hazelcast.map.impl.recordstore.LazyEvictableEntryView)2 HashMap (java.util.HashMap)2