Search in sources :

Example 21 with OWALChangesTree

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

the class IntegerSerializerTest method testSerializeWALChanges.

public void testSerializeWALChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder());
    final byte[] data = new byte[FIELD_SIZE];
    integerSerializer.serializeNative(OBJECT, data, 0);
    OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(integerSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(integerSerializer.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 22 with OWALChangesTree

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

the class ShortSerializerTest method testSerializationWALChanges.

public void testSerializationWALChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder());
    final byte[] data = new byte[FIELD_SIZE];
    shortSerializer.serializeNative(OBJECT, data, 0);
    final OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(shortSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(shortSerializer.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 23 with OWALChangesTree

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

the class StringSerializerTest method testSerializeWALChanges.

public void testSerializeWALChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE - 7 + serializationOffset).order(ByteOrder.nativeOrder());
    final byte[] data = new byte[FIELD_SIZE - 7];
    stringSerializer.serializeNativeObject(OBJECT, data, 0);
    OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(stringSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE - 7);
    Assert.assertEquals(stringSerializer.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 24 with OWALChangesTree

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

the class DateTimeSerializerTest method testSerializeWALChanges.

public void testSerializeWALChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder());
    final byte[] data = new byte[FIELD_SIZE];
    dateTimeSerializer.serializeNativeObject(OBJECT, data, 0);
    final OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(dateTimeSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(dateTimeSerializer.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 25 with OWALChangesTree

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

the class DoubleSerializerTest method testSerializeWALChanges.

public void testSerializeWALChanges() {
    final int serializationOffset = 5;
    final ByteBuffer buffer = ByteBuffer.allocateDirect(FIELD_SIZE + serializationOffset).order(ByteOrder.nativeOrder());
    final byte[] data = new byte[FIELD_SIZE];
    doubleSerializer.serializeNativeObject(OBJECT, data, 0);
    final OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(doubleSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(doubleSerializer.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