Package com.orientechnologies.common.directmemory

Examples of com.orientechnologies.common.directmemory.ODirectMemoryPointer


* @since 4/15/14
*/
@Test
public class ONullBucketTest {
  public void testEmptyBucket() {
    ODirectMemoryPointer pointer = new ODirectMemoryPointer(1024);
    OCachePointer cachePointer = new OCachePointer(pointer, new OLogSequenceNumber(0, 0));
    OCacheEntry cacheEntry = new OCacheEntry(0, 0, cachePointer, false);

    ONullBucket<String> bucket = new ONullBucket<String>(cacheEntry, ODurablePage.TrackMode.NONE, OStringSerializer.INSTANCE, true);
    Assert.assertNull(bucket.getValue());
View Full Code Here


    cachePointer.decrementReferrer();
  }

  public void testAddGetValue() throws IOException {
    ODirectMemoryPointer pointer = new ODirectMemoryPointer(1024);
    OCachePointer cachePointer = new OCachePointer(pointer, new OLogSequenceNumber(0, 0));
    OCacheEntry cacheEntry = new OCacheEntry(0, 0, cachePointer, false);

    ONullBucket<String> bucket = new ONullBucket<String>(cacheEntry, ODurablePage.TrackMode.NONE, OStringSerializer.INSTANCE, true);
View Full Code Here

    cachePointer.decrementReferrer();
  }

  public void testAddRemoveValue() throws IOException {
    ODirectMemoryPointer pointer = new ODirectMemoryPointer(1024);
    OCachePointer cachePointer = new OCachePointer(pointer, new OLogSequenceNumber(0, 0));
    OCacheEntry cacheEntry = new OCacheEntry(0, 0, cachePointer, false);

    ONullBucket<String> bucket = new ONullBucket<String>(cacheEntry, ODurablePage.TrackMode.NONE, OStringSerializer.INSTANCE, true);
View Full Code Here

    cachePointer.decrementReferrer();
  }

  public void testAddRemoveAddValue() throws IOException {
    ODirectMemoryPointer pointer = new ODirectMemoryPointer(1024);
    OCachePointer cachePointer = new OCachePointer(pointer, new OLogSequenceNumber(0, 0));
    OCacheEntry cacheEntry = new OCacheEntry(0, 0, cachePointer, false);

    ONullBucket<String> bucket = new ONullBucket<String>(cacheEntry, ODurablePage.TrackMode.NONE, OStringSerializer.INSTANCE, true);
View Full Code Here

    Assert.assertEquals(charSerializer.deserializeNativeObject(stream, 0), OBJECT);
  }

  public void testNativeDirectMemoryCompatibility() {
    charSerializer.serializeNative(OBJECT, stream, 0);
    ODirectMemoryPointer pointer = new ODirectMemoryPointer(stream);
    try {
      Assert.assertEquals(charSerializer.deserializeFromDirectMemoryObject(pointer, 0), OBJECT);
    } finally {
      pointer.free();
    }

  }
View Full Code Here

    Assert.assertEquals(decimalSerializer.deserializeNativeObject(stream, 0), OBJECT);
  }

  public void testNativeDirectMemoryCompatibility() {
    decimalSerializer.serializeNativeObject(OBJECT, stream, 0);
    ODirectMemoryPointer pointer = new ODirectMemoryPointer(stream);
    try {
      Assert.assertEquals(decimalSerializer.deserializeFromDirectMemoryObject(pointer, 0), OBJECT);
    } finally {
      pointer.free();
    }
  }
View Full Code Here

    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);

    ODirectMemoryPointer pointer = new ODirectMemoryPointer(stream);
    try {
      Assert.assertEquals(dateSerializer.deserializeFromDirectMemoryObject(pointer, 0), calendar.getTime());
    } finally {
      pointer.free();
    }
  }
View Full Code Here

  }

  public void testNativeDirectMemoryCompatibility() {
    stringSerializer.serializeNativeObject(OBJECT, stream, 7);

    ODirectMemoryPointer pointer = new ODirectMemoryPointer(stream);
    try {
      Assert.assertEquals(stringSerializer.deserializeFromDirectMemoryObject(pointer, 7), OBJECT);
    } finally {
      pointer.free();
    }
  }
View Full Code Here

  }

  public void testNativeDirectMemoryCompatibility() {
    binarySerializer.serializeNativeObject(OBJECT, stream, 0);

    ODirectMemoryPointer pointer = new ODirectMemoryPointer(stream);

    try {
      Assert.assertEquals(binarySerializer.deserializeFromDirectMemoryObject(pointer, 0), OBJECT);
    } finally {
      pointer.free();
    }
  }
View Full Code Here

      try {
        OCacheEntry cacheEntry = content.get(index);
        if (cacheEntry != null)
          return cacheEntry;

        ODirectMemoryPointer directMemoryPointer = new ODirectMemoryPointer(new byte[pageSize + 2 * ODurablePage.PAGE_PADDING]);
        OCachePointer cachePointer = new OCachePointer(directMemoryPointer, new OLogSequenceNumber(0, 0));
        cachePointer.incrementReferrer();

        cacheEntry = new OCacheEntry(id, index, cachePointer, false);

View Full Code Here

TOP

Related Classes of com.orientechnologies.common.directmemory.ODirectMemoryPointer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.