Search in sources :

Example 11 with OWALChangesTree

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

the class OSimpleKeySerializerTest 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];
    simpleKeySerializer.serializeNativeObject(OBJECT, data, 0);
    final OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(simpleKeySerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(simpleKeySerializer.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 12 with OWALChangesTree

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

the class CharSerializerTest 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];
    charSerializer.serializeNative(OBJECT, data, 0);
    OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(charSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(charSerializer.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 13 with OWALChangesTree

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

the class DateSerializerTest 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];
    dateSerializer.serializeNativeObject(OBJECT, data, 0);
    final OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(OBJECT);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    Assert.assertEquals(dateSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(dateSerializer.deserializeFromByteBufferObject(buffer, walChanges, serializationOffset), calendar.getTime());
}
Also used : OWALChangesTree(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChangesTree) OWALChanges(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWALChanges) Calendar(java.util.Calendar) ByteBuffer(java.nio.ByteBuffer)

Example 14 with OWALChangesTree

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

the class DecimalSerializerTest 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];
    decimalSerializer.serializeNativeObject(OBJECT, data, 0);
    final OWALChanges walChanges = new OWALChangesTree();
    walChanges.setBinaryValue(buffer, data, serializationOffset);
    Assert.assertEquals(decimalSerializer.getObjectSizeInByteBuffer(buffer, walChanges, serializationOffset), FIELD_SIZE);
    Assert.assertEquals(decimalSerializer.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 15 with OWALChangesTree

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

the class FloatSerializerTest method testSerializeWALChanges.

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