Search in sources :

Example 11 with BytesContainer

use of com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer in project orientdb by orientechnologies.

the class BytesContainerTest method testSimple.

@Test
public void testSimple() {
    BytesContainer bytesContainer = new BytesContainer();
    assertNotNull(bytesContainer.bytes);
    assertEquals(bytesContainer.offset, 0);
}
Also used : BytesContainer(com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer) Test(org.testng.annotations.Test)

Example 12 with BytesContainer

use of com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer in project orientdb by orientechnologies.

the class BytesContainerTest method testBorderReallocSimple.

@Test
public void testBorderReallocSimple() {
    BytesContainer bytesContainer = new BytesContainer();
    bytesContainer.alloc((short) 1024);
    int pos = bytesContainer.alloc((short) 1);
    bytesContainer.bytes[pos] = 0;
    assertTrue(bytesContainer.bytes.length >= 1025);
    assertEquals(bytesContainer.offset, 1025);
}
Also used : BytesContainer(com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer) Test(org.testng.annotations.Test)

Example 13 with BytesContainer

use of com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer in project orientdb by orientechnologies.

the class OVarIntSerializerTest method serializePositive.

@Test
public void serializePositive() {
    BytesContainer bytes = new BytesContainer();
    OVarIntSerializer.write(bytes, 20432343);
    bytes.offset = 0;
    assertEquals(OVarIntSerializer.readAsLong(bytes), 20432343l);
}
Also used : BytesContainer(com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer) Test(org.testng.annotations.Test)

Example 14 with BytesContainer

use of com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer in project orientdb by orientechnologies.

the class OVarIntSerializerTest method serializeCrazyPositive.

@Test
public void serializeCrazyPositive() {
    BytesContainer bytes = new BytesContainer();
    OVarIntSerializer.write(bytes, 16238);
    bytes.offset = 0;
    assertEquals(OVarIntSerializer.readAsLong(bytes), 16238l);
}
Also used : BytesContainer(com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer) Test(org.testng.annotations.Test)

Example 15 with BytesContainer

use of com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer in project orientdb by orientechnologies.

the class OVarIntSerializerTest method serializePosition.

@Test
public void serializePosition() {
    BytesContainer bytes = new BytesContainer();
    bytes.offset = OVarIntSerializer.write(bytes, 16238);
    assertEquals(OVarIntSerializer.readAsLong(bytes), 16238l);
}
Also used : BytesContainer(com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer) Test(org.testng.annotations.Test)

Aggregations

BytesContainer (com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer)17 Test (org.testng.annotations.Test)13 OBinaryField (com.orientechnologies.orient.core.serialization.serializer.record.binary.OBinaryField)3 ORecordNotFoundException (com.orientechnologies.orient.core.exception.ORecordNotFoundException)2 OrientMonoThreadTest (com.orientechnologies.orient.test.database.base.OrientMonoThreadTest)2 OException (com.orientechnologies.common.exception.OException)1 OCollate (com.orientechnologies.orient.core.collate.OCollate)1 OCommandExecutionException (com.orientechnologies.orient.core.exception.OCommandExecutionException)1 OQueryParsingException (com.orientechnologies.orient.core.exception.OQueryParsingException)1 OType (com.orientechnologies.orient.core.metadata.schema.OType)1 ORecord (com.orientechnologies.orient.core.record.ORecord)1 OSQLFunctionRuntime (com.orientechnologies.orient.core.sql.functions.OSQLFunctionRuntime)1 OQueryOperatorMatches (com.orientechnologies.orient.core.sql.operator.OQueryOperatorMatches)1 OSQLQuery (com.orientechnologies.orient.core.sql.query.OSQLQuery)1 ParseException (java.text.ParseException)1