use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class AbstractTestObjectFile method objectfile_04.
@Test
public void objectfile_04() {
Block block1 = file.allocWrite(10);
fill(block1.getByteBuffer());
file.completeWrite(block1);
Block block2 = file.allocWrite(20);
fill(block2.getByteBuffer());
file.completeWrite(block2);
long x1 = block1.getId();
long x2 = block2.getId();
assertFalse(x1 == x2);
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class ObjectFileTrans method abortWrite.
@Override
public void abortWrite(Block block) {
if (passthrough) {
base.abortWrite(block);
return;
}
block = new Block(block.getId() - otherAllocOffset, block.getByteBuffer());
transObjects.abortWrite(block);
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class AbstractTestBlockMgr method file03.
@Test
public void file03() {
Block block = blockMgr.allocate(BlkSize);
ByteBuffer bb = block.getByteBuffer();
fill(bb, (byte) 2);
long id = block.getId();
blockMgr.write(block);
blockMgr.release(block);
Block block2 = blockMgr.getRead(id);
ByteBuffer bb2 = block2.getByteBuffer();
assertEquals(bb2.capacity(), BlkSize);
assertEquals(bb2.get(0), (byte) 2);
assertEquals(bb2.get(BlkSize - 1), (byte) 2);
blockMgr.release(block2);
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class ObjectFileTrans method completeWrite.
@Override
public void completeWrite(Block block) {
if (passthrough) {
base.completeWrite(block);
return;
}
block = new Block(block.getId() - otherAllocOffset, block.getByteBuffer());
transObjects.completeWrite(block);
}
use of org.apache.jena.tdb.base.block.Block in project jena by apache.
the class AbstractTestBlockMgr method multiAccess01.
@Test
public void multiAccess01() {
Block block1 = blockMgr.allocate(BlkSize);
Block block2 = blockMgr.allocate(BlkSize);
long id1 = block1.getId();
long id2 = block2.getId();
ByteBuffer bb1 = block1.getByteBuffer();
ByteBuffer bb2 = block2.getByteBuffer();
fill(bb1, (byte) 1);
fill(bb2, (byte) 2);
blockMgr.write(block1);
blockMgr.write(block2);
blockMgr.release(block1);
blockMgr.release(block2);
Block block3 = blockMgr.getRead(id1);
Block block4 = blockMgr.getRead(id2);
ByteBuffer bb_1 = block3.getByteBuffer();
ByteBuffer bb_2 = block4.getByteBuffer();
contains(bb_1, (byte) 1);
contains(bb_2, (byte) 2);
blockMgr.release(block3);
blockMgr.release(block4);
}
Aggregations