@Test
public void testReadThenWriteThenRollback() {
TxManager txman = new TxManager(superviser);
TxSession readSession = txman.openReadOnlySession();
NamedCache readA = readSession.connect(cacheA);
TxCacheWrapper dirtyA = new TxCacheWrapper(cacheA, new DirtyReadCacheAccessAdapter());
TxSession writeSession = txman.openReadWriteSession();
NamedCache writeA = writeSession.connect(cacheA);
Assert.assertThat(readA.get("A"), IsNull.nullValue());
Assert.assertThat(dirtyA.get("A"), IsNull.nullValue());
Assert.assertThat(writeA.get("A"), IsNull.nullValue());
writeA.put("A", "A");
Assert.assertThat(readA.get("A"), IsNull.nullValue());
Assert.assertThat((String)dirtyA.get("A"), Is.is("A"));
Assert.assertThat((String)writeA.get("A"), Is.is("A"));
writeSession.rollback();
Assert.assertThat(readA.get("A"), IsNull.nullValue());
readSession.commit();
Assert.assertThat(readA.get("A"), IsNull.nullValue());
Assert.assertThat(dirtyA.get("A"), IsNull.nullValue());
Assert.assertThat(writeA.get("A"), IsNull.nullValue());
writeSession.rollback();
}