Search in sources :

Example 16 with EntryView

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

the class PutIfAbsentMapMergePolicyTest method merge_existingValueAbsent.

@Test
public void merge_existingValueAbsent() {
    EntryView existing = entryWithGivenValue(null);
    EntryView merging = entryWithGivenValue(MERGING);
    assertEquals(MERGING, 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 17 with EntryView

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

the class MapReplicationSupportingService method handleUpdate.

private void handleUpdate(MapReplicationUpdate replicationUpdate) {
    EntryView entryView = replicationUpdate.getEntryView();
    MapMergePolicy mergePolicy = replicationUpdate.getMergePolicy();
    String mapName = replicationUpdate.getMapName();
    MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
    MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(mapName);
    Data dataKey = mapServiceContext.toData(entryView.getKey(), mapContainer.getPartitioningStrategy());
    MapOperation operation = operationProvider.createMergeOperation(mapName, dataKey, entryView, mergePolicy, true);
    try {
        int partitionId = nodeEngine.getPartitionService().getPartitionId(entryView.getKey());
        Future f = nodeEngine.getOperationService().invokeOnPartition(SERVICE_NAME, operation, partitionId);
        f.get();
    } catch (Throwable t) {
        throw ExceptionUtil.rethrow(t);
    }
}
Also used : EntryView(com.hazelcast.core.EntryView) Future(java.util.concurrent.Future) Data(com.hazelcast.nio.serialization.Data) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapMergePolicy(com.hazelcast.map.merge.MapMergePolicy) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 18 with EntryView

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

the class LazyEntryViewFromRecordTest method test_equals.

@Test
public void test_equals() throws Exception {
    EntryView entryView = createDefaultEntryView();
    assertTrue(view.equals(entryView) && entryView.equals(view));
}
Also used : EntryView(com.hazelcast.core.EntryView) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 19 with EntryView

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

the class LazyEntryViewFromRecordTest method test_hashCode.

@Test
public void test_hashCode() throws Exception {
    EntryView entryView = createDefaultEntryView();
    assertEquals(entryView.hashCode(), view.hashCode());
}
Also used : EntryView(com.hazelcast.core.EntryView) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 20 with EntryView

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

the class ClientMapBasicTest method testGetEntryView.

@Test
public void testGetEntryView() {
    IMap<String, String> map = client.getMap(randomString());
    String key = "Key";
    String value = "Value";
    map.put(key, value);
    EntryView view = map.getEntryView(key);
    assertEquals(key, view.getKey());
    assertEquals(value, view.getValue());
}
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)30 Test (org.junit.Test)14 ParallelTest (com.hazelcast.test.annotation.ParallelTest)11 QuickTest (com.hazelcast.test.annotation.QuickTest)11 Record (com.hazelcast.map.impl.record.Record)10 Data (com.hazelcast.nio.serialization.Data)9 EntryViews.createSimpleEntryView (com.hazelcast.map.impl.EntryViews.createSimpleEntryView)6 IMap (com.hazelcast.core.IMap)2 MapContainer (com.hazelcast.map.impl.MapContainer)2 MapEventPublisher (com.hazelcast.map.impl.event.MapEventPublisher)2 MapOperation (com.hazelcast.map.impl.operation.MapOperation)2 Future (java.util.concurrent.Future)2 JsonObject (com.eclipsesource.json.JsonObject)1 EntryEventType (com.hazelcast.core.EntryEventType)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 Node (com.hazelcast.instance.Node)1 MapOperationProvider (com.hazelcast.map.impl.operation.MapOperationProvider)1 MergeOperation (com.hazelcast.map.impl.operation.MergeOperation)1 RecordInfo (com.hazelcast.map.impl.record.RecordInfo)1 Records.buildRecordInfo (com.hazelcast.map.impl.record.Records.buildRecordInfo)1