Search in sources :

Example 16 with OWALChangesTree

use of com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree in project orientdb by orientechnologies.

the class LongSerializerTest method testSerializationWALChanges.

public void testSerializationWALChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset);
    final byte[] data = new byte[FIELD_SIZE];
    longSerializer.serializeNative(OBJECT, data, 0);
    OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(longSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(longSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT);
}
Also used : OWALChangesTree(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree) OWALChanges(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges) ByteBuffer(java.nio.ByteBuffer)

Example 17 with OWALChangesTree

use of com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree in project orientdb by orientechnologies.

the class OUUIDSerializerTest method testsSerializationWALChanges.

public void testsSerializationWALChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder());
    final byte[] data = new byte[FIELD_SIZE];
    uuidSerializer.serializeNativeObject(OBJECT, data, 0);
    OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(uuidSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(uuidSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT);
}
Also used : OWALChangesTree(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree) OWALChanges(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges) ByteBuffer(java.nio.ByteBuffer)

Example 18 with OWALChangesTree

use of com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree in project orientdb by orientechnologies.

the class BinarySerializerTest method testSerializeInWalChanges.

public void testSerializeInWalChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder());
    final byte[] data = new byte[FIELD_SIZE];
    final OWALChangesTree walChangesTree = new OWALChangesTree();
    binarySerializer.serializeNativeObject(OBJECT, data, 0);
    walChangesTree.add(data, serializationOffset);
    Assert.assertEquals(binarySerializer.getObjectSizeInByteBuffer(buffer, walChangesTree, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(binarySerializer.deserializeFromByteBufferObject(buffer, walChangesTree, serializationOffset), OBJECT);
}
Also used : OWALChangesTree(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree) ByteBuffer(java.nio.ByteBuffer)

Example 19 with OWALChangesTree

use of com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree in project orientdb by orientechnologies.

the class BooleanSerializerTest method testSerializationWalChanges.

public void testSerializationWalChanges() {
    final int serializationOffset = 5;
    byte[] data = new byte[FIELD_SIZE];
    ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder());
    booleanSerializer.serializeNative(OBJECT_TRUE, data, 0);
    OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(booleanSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(booleanSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT_TRUE);
    booleanSerializer.serializeNative(OBJECT_FALSE, data, 0);
    walChanges.setBinaryValue(buffer, data, 0);
    Assert.assertEquals(booleanSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(booleanSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT_FALSE);
}
Also used : OWALChangesTree(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree) OWALChanges(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges) ByteBuffer(java.nio.ByteBuffer)

Example 20 with OWALChangesTree

use of com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree in project orientdb by orientechnologies.

the class ByteSerializerTest method testSerializationInWALChanges.

public void testSerializationInWALChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder());
    final OWALChanges walChanges = new OWALChangesTree();
    final byte[] data = new byte[FIELD_SIZE];
    byteSerializer.serializeNative(OBJECT, data, 0);
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(byteSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(byteSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), OBJECT);
}
Also used : OWALChangesTree(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree) OWALChanges(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges) ByteBuffer(java.nio.ByteBuffer)

Aggregations

OWALChangesTree (com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree)41 ByteBuffer (java.nio.ByteBuffer)41 OWALChanges (com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges)21 OByteBufferPool (com.orientechnologies.common.directmemory.OByteBufferPool)19 OCacheEntry (com.orientechnologies.orient.core.storage.cache.OCacheEntry)19 OCachePointer (com.orientechnologies.orient.core.storage.cache.OCachePointer)19 OLogSequenceNumber (com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OLogSequenceNumber)19 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)4 OIndexRIDContainer (com.orientechnologies.orient.core.db.record.ridbag.sbtree.OIndexRIDContainer)4 ORecordId (com.orientechnologies.orient.core.id.ORecordId)4 HashSet (java.util.HashSet)4 Calendar (java.util.Calendar)1