File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
google-cloud-spanner/src/test/java/com/google/cloud/spanner/it Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 5252import com .google .common .collect .Sets ;
5353import com .google .common .util .concurrent .SettableFuture ;
5454import com .google .common .util .concurrent .Uninterruptibles ;
55+ import com .google .spanner .v1 .TransactionOptions .IsolationLevel ;
56+ import com .google .spanner .v1 .TransactionOptions .ReadWrite .ReadLockMode ;
5557import java .util .ArrayList ;
5658import java .util .Arrays ;
5759import java .util .Collections ;
@@ -213,6 +215,19 @@ public void basicsUsingQuery() throws InterruptedException {
213215 });
214216 }
215217
218+ @ Test
219+ public void isolationLevelAndReadLockModeTest () {
220+ TransactionCallable <Long > callable =
221+ transaction ->
222+ transaction .executeUpdate (Statement .of ("INSERT INTO T (K, V) VALUES ('test1', 2)" ));
223+ TransactionRunner runner =
224+ client .readWriteTransaction (
225+ Options .isolationLevel (IsolationLevel .REPEATABLE_READ ),
226+ Options .readLockMode (ReadLockMode .OPTIMISTIC ));
227+ Long updatedRows = runner .run (callable );
228+ assertThat (updatedRows ).isEqualTo (1L );
229+ }
230+
216231 @ Test
217232 public void userExceptionPreventsCommit () {
218233 class UserException extends Exception {
You can’t perform that action at this time.
0 commit comments