Search in sources :

Example 1 with BytesContainer

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

the class OVarIntSerializerTest method serializeZero.

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

Example 2 with BytesContainer

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

the class OVarIntSerializerTest method serializeMinLong.

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

Example 3 with BytesContainer

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

the class VarIntSpeedTest method cycle.

@Override
@Test(enabled = false)
public void cycle() {
    BytesContainer container = new BytesContainer();
    OVarIntSerializer.write(container, 20);
    OVarIntSerializer.write(container, 200);
    OVarIntSerializer.write(container, 20000);
    OVarIntSerializer.write(container, 200000000000000000L);
    container.offset = 0;
    OVarIntSerializer.readAsInteger(container);
    OVarIntSerializer.readAsInteger(container);
    OVarIntSerializer.readAsInteger(container);
    OVarIntSerializer.readAsLong(container);
}
Also used : BytesContainer(com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer) Test(org.testng.annotations.Test) OrientMonoThreadTest(com.orientechnologies.orient.test.database.base.OrientMonoThreadTest)

Example 4 with BytesContainer

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

the class AbstractComparatorTest method field.

protected OBinaryField field(final OType type, final Object value, OCollate collate) {
    BytesContainer bytes = new BytesContainer();
    bytes.offset = serializer.serializeValue(bytes, value, type, null);
    return new OBinaryField(null, type, bytes, collate);
}
Also used : BytesContainer(com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer) OBinaryField(com.orientechnologies.orient.core.serialization.serializer.record.binary.OBinaryField)

Example 5 with BytesContainer

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

the class IntgerSerializationSpeedTest method cycle.

@Override
@Test(enabled = false)
public void cycle() {
    BytesContainer container = new BytesContainer();
    OIntegerSerializer.INSTANCE.serialize(20, container.bytes, container.offset);
    container.skip(OIntegerSerializer.INT_SIZE);
    OIntegerSerializer.INSTANCE.serialize(200, container.bytes, container.offset);
    container.skip(OIntegerSerializer.INT_SIZE);
    OIntegerSerializer.INSTANCE.serialize(20000, container.bytes, container.offset);
    container.skip(OIntegerSerializer.INT_SIZE);
    OLongSerializer.INSTANCE.serialize(200000000000000000L, container.bytes, container.offset);
    container.skip(OLongSerializer.LONG_SIZE);
    container.offset = 0;
    OIntegerSerializer.INSTANCE.deserialize(container.bytes, container.offset);
    container.skip(OIntegerSerializer.INT_SIZE);
    OIntegerSerializer.INSTANCE.deserialize(container.bytes, container.offset);
    container.skip(OIntegerSerializer.INT_SIZE);
    OIntegerSerializer.INSTANCE.deserialize(container.bytes, container.offset);
    container.skip(OIntegerSerializer.INT_SIZE);
    OLongSerializer.INSTANCE.deserialize(container.bytes, container.offset);
    container.skip(OLongSerializer.LONG_SIZE);
}
Also used : BytesContainer(com.orientechnologies.orient.core.serialization.serializer.record.binary.BytesContainer) Test(org.testng.annotations.Test) OrientMonoThreadTest(com.orientechnologies.orient.test.database.base.OrientMonoThreadTest)

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