public void test_restartSafe_oneWrite(){
  IAtomicStore store=(IAtomicStore)getStore();
  try {
    assertTrue(store.isStable());
    final Random r=new Random();
    final int len=100;
    final byte[] expected=new byte[len];
    r.nextBytes(expected);
    final ByteBuffer tmp=ByteBuffer.wrap(expected);
    final long addr1=store.write(tmp);
    assertEquals(len,tmp.position());
    assertEquals(tmp.position(),tmp.limit());
    ByteBuffer actual=store.read(addr1);
    assertEquals(expected,actual);
    assertEquals(0,actual.position());
    assertEquals(expected.length,actual.limit());
    store.commit();
    store=(IAtomicStore)reopenStore(store);
    assertTrue(store.isStable());
    actual=store.read(addr1);
    assertEquals(expected,actual);
  }
  finally {
    store.destroy();
  }
}

public void test_restartSafe_oneWrite ( ) { IAtomicStore store = ( IAtomicStore ) getStore ( ) ; try { assertTrue ( store . isStable ( ) ) ; final Random r = new Random ( ) ; final int len = 100 ; final byte [ ] expected = new byte [ len ] ; r . nextBytes ( expected ) ; final ByteBuffer tmp = ByteBuffer . wrap ( expected ) ; final long addr1 = store . write ( tmp ) ; assertEquals ( len , tmp . position ( ) ) ; assertEquals ( tmp . position ( ) , tmp . limit ( ) ) ; ByteBuffer actual = store . read ( addr1 ) ; assertEquals ( expected , actual ) ; assertEquals ( 0 , actual . position ( ) ) ; assertEquals ( expected . length , actual . limit ( ) ) ; store . commit ( ) ; store = ( IAtomicStore ) reopenStore ( store ) ; assertTrue ( store . isStable ( ) ) ; actual = store . read ( addr1 ) ; assertEquals ( expected , actual ) ; } finally { store . destroy ( ) ; } }
writes a record , verifies the write then commits the store . closes and reopens the store and finally verifies the write on the reopened store .
