Search in sources :

Example 31 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 32 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 33 with EntryView

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

the class AbstractEvictableRecordStore method sampleAndForceRemoveEntries.

@Override
public void sampleAndForceRemoveEntries(int entryCountToRemove) {
    Queue<Data> keysToRemove = new LinkedList<>();
    Iterable<EntryView> sample = storage.getRandomSamples(entryCountToRemove);
    for (EntryView entryView : sample) {
        Data dataKey = storage.extractDataKeyFromLazy(entryView);
        keysToRemove.add(dataKey);
    }
    Data dataKey;
    while ((dataKey = keysToRemove.poll()) != null) {
        evict(dataKey, true);
    }
}
Also used : EntryView(com.hazelcast.core.EntryView) Data(com.hazelcast.internal.serialization.Data) LinkedList(java.util.LinkedList)

Example 34 with EntryView

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

the class MapProxySupport method getEntryViewInternal.

protected EntryView getEntryViewInternal(Data key) {
    int partitionId = partitionService.getPartitionId(key);
    MapOperation operation = operationProvider.createGetEntryViewOperation(name, key);
    operation.setThreadId(getThreadId());
    operation.setServiceName(SERVICE_NAME);
    try {
        Future future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
        return (EntryView) toObject(future.get());
    } catch (Throwable t) {
        throw rethrow(t);
    }
}
Also used : EntryView(com.hazelcast.core.EntryView) Future(java.util.concurrent.Future) InternalCompletableFuture.newCompletedFuture(com.hazelcast.spi.impl.InternalCompletableFuture.newCompletedFuture) InvocationFuture(com.hazelcast.spi.impl.operationservice.impl.InvocationFuture) InternalCompletableFuture(com.hazelcast.spi.impl.InternalCompletableFuture) CompletableFuture(java.util.concurrent.CompletableFuture) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 35 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());
    assertEquals(Long.MAX_VALUE, view.getMaxIdle());
    assertEquals(Long.MAX_VALUE, view.getTtl());
}
Also used : EntryView(com.hazelcast.core.EntryView) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest) BasicMapTest(com.hazelcast.map.BasicMapTest)

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