Updating optimistic concurrency tests to use transactions.

Also fixing bugs found in the process.
I didn't run them, but it should be the same as it's now for ATS