use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestOrderedNumeric method testEncodedBigDecimalLength.
@Test
public void testEncodedBigDecimalLength() {
final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
for (final DataType<Number> type : new OrderedNumeric[] { new OrderedNumeric(Order.ASCENDING), new OrderedNumeric(Order.DESCENDING) }) {
for (final Number val : BIG_DECIMAL_VALUES) {
buffer.setPosition(0);
type.encode(buffer, val);
assertEquals("encodedLength does not match actual, " + val, buffer.getPosition(), type.encodedLength(val));
}
}
}
use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestOrderedNumeric method testEncodedNullLength.
@Test
public void testEncodedNullLength() {
final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
final DataType<Number> type = new OrderedNumeric(Order.ASCENDING);
buffer.setPosition(0);
type.encode(buffer, null);
type.encode(new SimplePositionedMutableByteRange(20), null);
assertEquals("encodedLength does not match actual, " + null, buffer.getPosition(), type.encodedLength(null));
}
use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestOrderedNumeric method testEncodedDoubleLength.
@Test
public void testEncodedDoubleLength() {
final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
for (final OrderedNumeric type : new OrderedNumeric[] { new OrderedNumeric(Order.ASCENDING), new OrderedNumeric(Order.DESCENDING) }) {
for (final Double val : DOUBLE_VALUES) {
buffer.setPosition(0);
type.encodeDouble(buffer, val);
assertEquals("encodedLength does not match actual, " + val, buffer.getPosition(), type.encodedLength(val));
}
}
}
use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestOrderedNumeric method testEncodedLongLength.
@Test
public void testEncodedLongLength() {
final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
for (final OrderedNumeric type : new OrderedNumeric[] { new OrderedNumeric(Order.ASCENDING), new OrderedNumeric(Order.DESCENDING) }) {
for (final Long val : LONG_VALUES) {
buffer.setPosition(0);
type.encodeLong(buffer, val);
assertEquals("encodedLength does not match actual, " + val, buffer.getPosition(), type.encodedLength(val));
}
}
}
use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestRawBytes method testEncodedLength.
@Test
public void testEncodedLength() {
final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
for (final DataType<byte[]> type : new RawBytes[] { new RawBytes(Order.ASCENDING), new RawBytes(Order.DESCENDING) }) {
for (final byte[] val : VALUES) {
buffer.setPosition(0);
type.encode(buffer, val);
assertEquals("encodedLength does not match actual, " + Arrays.toString(val), buffer.getPosition(), type.encodedLength(val));
}
}
}
Aggregations