use of com.thinkaurelius.titan.diskstorage.ReadBuffer in project titan by thinkaurelius.
the class SerializerTest method longWriteTest.
@Test
public void longWriteTest() {
// 26 chars
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int no = 100;
DataOutput out = serialize.getDataOutput(128, true);
for (int i = 0; i < no; i++) {
String str = base + (i + 1);
out.writeObjectNotNull(str);
}
ReadBuffer b = out.getStaticBuffer().asReadBuffer();
if (printStats)
log.debug(bufferStats(b));
for (int i = 0; i < no; i++) {
String str = base + (i + 1);
String read = serialize.readObjectNotNull(b, String.class);
assertEquals(str, read);
}
assertFalse(b.hasRemaining());
}
use of com.thinkaurelius.titan.diskstorage.ReadBuffer in project titan by thinkaurelius.
the class SerializerTest method largeWriteTest.
@Test
public void largeWriteTest() {
// 26 chars
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String str = "";
for (int i = 0; i < 100; i++) str += base;
DataOutput out = serialize.getDataOutput(128, true);
out.writeObjectNotNull(str);
ReadBuffer b = out.getStaticBuffer().asReadBuffer();
if (printStats)
log.debug(bufferStats(b));
assertEquals(str, serialize.readObjectNotNull(b, String.class));
assertFalse(b.hasRemaining());
}
use of com.thinkaurelius.titan.diskstorage.ReadBuffer in project titan by thinkaurelius.
the class SerializerTest method classSerialization.
@Test
public void classSerialization() {
DataOutput out = serialize.getDataOutput(128, true);
out.writeObjectNotNull(Boolean.class);
out.writeObjectNotNull(Byte.class);
out.writeObjectNotNull(Double.class);
ReadBuffer b = out.getStaticBuffer().asReadBuffer();
assertEquals(Boolean.class, serialize.readObjectNotNull(b, Class.class));
assertEquals(Byte.class, serialize.readObjectNotNull(b, Class.class));
assertEquals(Double.class, serialize.readObjectNotNull(b, Class.class));
}
use of com.thinkaurelius.titan.diskstorage.ReadBuffer in project titan by thinkaurelius.
the class SerializerTest method enumSerializeTest.
@Test
public void enumSerializeTest() {
DataOutput out = serialize.getDataOutput(128, true);
out.writeObjectNotNull(TestEnum.Two);
ReadBuffer b = out.getStaticBuffer().asReadBuffer();
if (printStats)
log.debug(bufferStats(b));
assertEquals(TestEnum.Two, serialize.readObjectNotNull(b, TestEnum.class));
assertFalse(b.hasRemaining());
}
Aggregations