use of org.apache.jena.dboe.transaction.txn.StateMgrDataIdx in project jena by apache.
the class TestStateMgrData method state_data_02.
@Test
public void state_data_02() {
BufferChannel x = FileFactory.createBufferChannelMem();
long[] data = { 2, 3 };
StateMgrDataIdx sm = new StateMgrDataIdx(x, data);
sm.writeState();
sm.set(1, 99L);
sm.writeState();
ByteBuffer bb = ByteBuffer.allocate(2 * Long.BYTES);
x.read(bb, 0);
assertEquals(99L, bb.getLong(Long.BYTES));
}
use of org.apache.jena.dboe.transaction.txn.StateMgrDataIdx in project jena by apache.
the class TestStateMgrData method state_data_03.
@Test
public void state_data_03() {
BufferChannel x = FileFactory.createBufferChannelMem();
{
ByteBuffer bb = ByteBuffer.allocate(Long.BYTES);
bb.putLong(0, -8888);
bb.rewind();
x.write(bb);
bb.putLong(0, -1234);
bb.rewind();
x.write(bb);
x.sync();
}
long[] data = { 2, 3 };
StateMgrDataIdx sm = new StateMgrDataIdx(x, data);
assertEquals(-8888L, sm.get(0));
assertEquals(-1234L, sm.get(1));
}
use of org.apache.jena.dboe.transaction.txn.StateMgrDataIdx in project jena by apache.
the class TestStateMgrData method state_data_01.
@Test
public void state_data_01() {
BufferChannel x = FileFactory.createBufferChannelMem();
long[] data = { 2, 3 };
StateMgrDataIdx sm = new StateMgrDataIdx(x, data);
assertEquals(data.length, sm.getData().length);
assertEquals(2L, sm.get(0));
assertEquals(3L, sm.get(1));
// Test initial state written
ByteBuffer bb = ByteBuffer.allocate(2 * Long.BYTES);
x.read(bb, 0);
assertEquals(2L, bb.getLong(0));
assertEquals(3L, bb.getLong(Long.BYTES));
}
Aggregations