use of com.cetsoft.imcache.offheap.bytebuffer.Pointer in project imcache by Cetsoft.
the class OffHeapByteBufferStoreTest method update.
/**
* Update.
*/
@Test
public void update() {
int size = 100;
byte[] bytes = new byte[size];
random.nextBytes(bytes);
Pointer pointer = bufferStore.store(bytes);
byte[] expectedBytes = new byte[size];
random.nextBytes(expectedBytes);
pointer = bufferStore.update(pointer, expectedBytes);
byte[] actualBytes = bufferStore.retrieve(pointer);
assertArrayEquals(expectedBytes, actualBytes);
}
use of com.cetsoft.imcache.offheap.bytebuffer.Pointer in project imcache by Cetsoft.
the class OffHeapByteBufferTest method updateGreaterExPayload.
/**
* Update greater ex payload.
*/
@Test
public void updateGreaterExPayload() {
int size = 100;
byte[] bytes = new byte[size];
random.nextBytes(bytes);
Pointer pointer = buffer.store(bytes);
byte[] expectedBytes = new byte[size + 5];
random.nextBytes(expectedBytes);
pointer = buffer.update(pointer, expectedBytes);
byte[] actualBytes = buffer.retrieve(pointer);
assertArrayEquals(expectedBytes, actualBytes);
}
use of com.cetsoft.imcache.offheap.bytebuffer.Pointer in project imcache by Cetsoft.
the class OffHeapByteBufferTest method update.
/**
* Update.
*/
@Test
public void update() {
int size = 100;
byte[] bytes = new byte[size];
random.nextBytes(bytes);
Pointer pointer = buffer.store(bytes);
byte[] expectedBytes = new byte[size];
random.nextBytes(expectedBytes);
pointer = buffer.update(pointer, expectedBytes);
byte[] actualBytes = buffer.retrieve(pointer);
assertArrayEquals(expectedBytes, actualBytes);
}
Aggregations