assertTrue(f1.exists());
assertFalse(f2.exists());
assertFalse(f3.exists());
//
// transaction commit
Transaction tr1 = f.create(ctx);
File tf1 = tr1.prepare(f1);
RepoUtils.modifyFileAppend(tf1, "2");
tr1.done(tf1);
File tf2 = tr1.prepare(f2);
errorCollector.assertTrue(tf2.exists());
RepoUtils.modifyFileAppend(tf2, "A");
tr1.done(tf2);
tr1.commit();
errorCollector.assertTrue(f1.isFile());
errorCollector.assertTrue(f2.isFile());
errorCollector.assertEquals("12", read(f1));
errorCollector.assertEquals("A", read(f2));
//
// transaction rollback
assertFalse(f3.exists());
Transaction tr2 = f.create(ctx);
tf1 = tr2.prepare(f1);
RepoUtils.modifyFileAppend(tf1, "3");
tr2.done(tf1);
errorCollector.assertEquals("123", read(tf1));
tf2 = tr2.prepare(f2);
RepoUtils.modifyFileAppend(tf2, "B");
tr2.done(tf2);
errorCollector.assertEquals("AB", read(tf2));
File tf3 = tr2.prepare(f3);
errorCollector.assertTrue(tf3.exists());
RepoUtils.modifyFileAppend(tf3, "!");
tr2.done(tf3);
errorCollector.assertEquals("!", read(tf3));
tr2.rollback();
errorCollector.assertTrue(f1.isFile());
errorCollector.assertTrue(f2.isFile());
errorCollector.assertFalse(f3.isFile());
errorCollector.assertEquals("12", read(f1));
errorCollector.assertEquals("A", read(f2));