{
File testFile = new File( testDir, "test-file.txt" );
+ testFile.getParentFile().mkdirs();
+
testFile.createNewFile();
FileUtils.fileWrite( testFile.getAbsolutePath(), "original contents" );
event.commit();
- assertTrue( "Test file is not yet created", testFile.exists() );
+ contents = FileUtils.fileRead( testFile.getAbsolutePath() );
+
+ assertEquals( "Test contents have not changed", "modified contents", contents );
event.rollback();
- assertFalse( "Test file is has been deleted after rollback", testFile.exists() );
- assertFalse( "Test file parent directories has been rolledback too", testDir.exists() );
- assertTrue( "target directory still exists", new File( PlexusTestCase.getBasedir(), "target" ).exists() );
+ contents = FileUtils.fileRead( testFile.getAbsolutePath() );
+
+ assertEquals( "Test contents have not changed", "original contents", contents );
}
public void testCreateRollbackCommit()
{
super.tearDown();
- FileUtils.deleteDirectory( new File( testDir, "target/transaction-tests" ).getAbsolutePath() );
+ FileUtils.deleteDirectory( new File( PlexusTestCase.getBasedir(),
+ "target/transaction-tests" ).getAbsolutePath() );
}
}