Search in sources :

Example 1 with Get

use of io.atomix.core.map.impl.AtomicCounterMapOperations.Get in project atomix by atomix.

the class AtomicCounterMapServiceTest method testSnapshot.

@Test
public void testSnapshot() throws Exception {
    AtomicCounterMapService service = new AtomicCounterMapService();
    service.put(new DefaultCommit<>(2, PUT, new Put("foo", 1), mock(Session.class), System.currentTimeMillis()));
    Buffer buffer = HeapBuffer.allocate();
    service.backup(buffer);
    service = new AtomicCounterMapService();
    service.restore(buffer.flip());
    long value = service.get(new DefaultCommit<>(2, GET, new Get("foo"), mock(Session.class), System.currentTimeMillis()));
    assertEquals(1, value);
}
Also used : Buffer(io.atomix.storage.buffer.Buffer) HeapBuffer(io.atomix.storage.buffer.HeapBuffer) Get(io.atomix.core.map.impl.AtomicCounterMapOperations.Get) AtomicCounterMapService(io.atomix.core.map.impl.AtomicCounterMapService) Put(io.atomix.core.map.impl.AtomicCounterMapOperations.Put) Test(org.junit.Test)

Aggregations

Get (io.atomix.core.map.impl.AtomicCounterMapOperations.Get)1 Put (io.atomix.core.map.impl.AtomicCounterMapOperations.Put)1 AtomicCounterMapService (io.atomix.core.map.impl.AtomicCounterMapService)1 Buffer (io.atomix.storage.buffer.Buffer)1 HeapBuffer (io.atomix.storage.buffer.HeapBuffer)1 Test (org.junit.Test)1