public void test_sessionProtection(){
  final Properties p=getProperties();
  p.setProperty(AbstractTransactionService.Options.MIN_RELEASE_AGE,"0");
  final Journal store=getJournal(p);
  try {
    final IRWStrategy bs=(IRWStrategy)store.getBufferStrategy();
    final byte[] buf=new byte[300];
    r.nextBytes(buf);
    final ByteBuffer bb=ByteBuffer.wrap(buf);
    final long faddr=store.write(bb);
    final IRawTx tx=bs.newTx();
    ByteBuffer rdBuf=store.read(faddr);
    bb.position(0);
    assertEquals(bb,rdBuf);
    store.delete(faddr);
    bb.position(0);
    rdBuf=store.read(faddr);
    assertEquals(bb,rdBuf);
    tx.close();
    store.commit();
  }
  finally {
    store.destroy();
  }
}

public void test_sessionProtection ( ) { final Properties p = getProperties ( ) ; p . setProperty ( AbstractTransactionService . Options . MIN_RELEASE_AGE , "0" ) ; final Journal store = getJournal ( p ) ; try { final IRWStrategy bs = ( IRWStrategy ) store . getBufferStrategy ( ) ; final byte [ ] buf = new byte [ 300 ] ; r . nextBytes ( buf ) ; final ByteBuffer bb = ByteBuffer . wrap ( buf ) ; final long faddr = store . write ( bb ) ; final IRawTx tx = bs . newTx ( ) ; ByteBuffer rdBuf = store . read ( faddr ) ; bb . position ( 0 ) ; assertEquals ( bb , rdBuf ) ; store . delete ( faddr ) ; bb . position ( 0 ) ; rdBuf = store . read ( faddr ) ; assertEquals ( bb , rdBuf ) ; tx . close ( ) ; store . commit ( ) ; } finally { store . destroy ( ) ; } }
tests whether tasks are able to access and modify data safely by emulating transactions by calling activatetx and deactivatetx directly .
