16
16
17
17
package com .google .cloud .spanner .connection .it ;
18
18
19
+ import static com .google .cloud .spanner .testing .SpannerEmulatorHelper .isUsingEmulator ;
19
20
import static org .hamcrest .CoreMatchers .equalTo ;
20
21
import static org .hamcrest .CoreMatchers .is ;
21
22
import static org .hamcrest .MatcherAssert .assertThat ;
@@ -490,7 +491,7 @@ public void testAbortWithResultSetFullyConsumed() {
490
491
public void testAbortWithConcurrentInsert () {
491
492
assumeFalse (
492
493
"concurrent transactions are not supported on the emulator" ,
493
- env . getTestHelper (). isEmulator ());
494
+ isUsingEmulator ());
494
495
AbortInterceptor interceptor = new AbortInterceptor (0 );
495
496
try (ITConnection connection =
496
497
createConnection (interceptor , new CountTransactionRetryListener ())) {
@@ -527,7 +528,7 @@ public void testAbortWithConcurrentInsert() {
527
528
public void testAbortWithConcurrentDelete () {
528
529
assumeFalse (
529
530
"concurrent transactions are not supported on the emulator" ,
530
- env . getTestHelper (). isEmulator ());
531
+ isUsingEmulator ());
531
532
AbortInterceptor interceptor = new AbortInterceptor (0 );
532
533
// first insert two test records
533
534
try (ITConnection connection = createConnection ()) {
@@ -568,7 +569,7 @@ public void testAbortWithConcurrentDelete() {
568
569
public void testAbortWithConcurrentUpdate () {
569
570
assumeFalse (
570
571
"concurrent transactions are not supported on the emulator" ,
571
- env . getTestHelper (). isEmulator ());
572
+ isUsingEmulator ());
572
573
AbortInterceptor interceptor = new AbortInterceptor (0 );
573
574
// first insert two test records
574
575
try (ITConnection connection = createConnection ()) {
@@ -614,7 +615,7 @@ public void testAbortWithConcurrentUpdate() {
614
615
public void testAbortWithUnseenConcurrentInsert () {
615
616
assumeFalse (
616
617
"concurrent transactions are not supported on the emulator" ,
617
- env . getTestHelper (). isEmulator ());
618
+ isUsingEmulator ());
618
619
AbortInterceptor interceptor = new AbortInterceptor (0 );
619
620
try (ITConnection connection =
620
621
createConnection (interceptor , new CountTransactionRetryListener ())) {
@@ -664,7 +665,7 @@ public void testAbortWithUnseenConcurrentInsert() {
664
665
public void testAbortWithUnseenConcurrentInsertAbortOnNext () {
665
666
assumeFalse (
666
667
"concurrent transactions are not supported on the emulator" ,
667
- env . getTestHelper (). isEmulator ());
668
+ isUsingEmulator ());
668
669
// no calls to next(), this should succeed
669
670
assertThat (testAbortWithUnseenConcurrentInsertAbortOnNext (0 ) >= 1 , is (true ));
670
671
// 1 call to next() should also succeed, as there were 2 records in the original result set
@@ -688,7 +689,7 @@ private int testAbortWithUnseenConcurrentInsertAbortOnNext(int callsToNext)
688
689
throws AbortedDueToConcurrentModificationException {
689
690
assumeFalse (
690
691
"concurrent transactions are not supported on the emulator" ,
691
- env . getTestHelper (). isEmulator ());
692
+ isUsingEmulator ());
692
693
int retries = 0 ;
693
694
clearTable ();
694
695
clearStatistics ();
@@ -750,7 +751,7 @@ private int testAbortWithUnseenConcurrentInsertAbortOnNext(int callsToNext)
750
751
public void testAbortWithConcurrentInsertAndContinue () {
751
752
assumeFalse (
752
753
"concurrent transactions are not supported on the emulator" ,
753
- env . getTestHelper (). isEmulator ());
754
+ isUsingEmulator ());
754
755
AbortInterceptor interceptor = new AbortInterceptor (0 );
755
756
try (ITConnection connection =
756
757
createConnection (interceptor , new CountTransactionRetryListener ())) {
@@ -962,7 +963,7 @@ protected boolean shouldAbort(String statement, ExecutionStep step) {
962
963
public void testNestedAbortWithConcurrentInsert () {
963
964
assumeFalse (
964
965
"concurrent transactions are not supported on the emulator" ,
965
- env . getTestHelper (). isEmulator ());
966
+ isUsingEmulator ());
966
967
AbortInterceptor interceptor =
967
968
new AbortInterceptor (0 ) {
968
969
private boolean alreadyAborted = false ;
@@ -1027,7 +1028,7 @@ protected boolean shouldAbort(String statement, ExecutionStep step) {
1027
1028
public void testAbortWithDifferentUpdateCount () {
1028
1029
assumeFalse (
1029
1030
"concurrent transactions are not supported on the emulator" ,
1030
- env . getTestHelper (). isEmulator ());
1031
+ isUsingEmulator ());
1031
1032
AbortInterceptor interceptor = new AbortInterceptor (0 );
1032
1033
// first insert two test records
1033
1034
try (ITConnection connection = createConnection ()) {
@@ -1075,7 +1076,7 @@ public void testAbortWithDifferentUpdateCount() {
1075
1076
public void testAbortWithExceptionOnSelect () {
1076
1077
assumeFalse (
1077
1078
"resume after error in transaction is not supported on the emulator" ,
1078
- env . getTestHelper (). isEmulator ());
1079
+ isUsingEmulator ());
1079
1080
AbortInterceptor interceptor = new AbortInterceptor (0 );
1080
1081
// first insert two test records
1081
1082
try (ITConnection connection = createConnection ()) {
@@ -1127,7 +1128,7 @@ public void testAbortWithExceptionOnSelect() {
1127
1128
public void testAbortWithExceptionOnSelectAndConcurrentModification () {
1128
1129
assumeFalse (
1129
1130
"concurrent transactions are not supported on the emulator" ,
1130
- env . getTestHelper (). isEmulator ());
1131
+ isUsingEmulator ());
1131
1132
boolean abortedDueToConcurrentModification = false ;
1132
1133
AbortInterceptor interceptor = new AbortInterceptor (0 );
1133
1134
// first insert two test records
@@ -1197,7 +1198,7 @@ public void testAbortWithExceptionOnSelectAndConcurrentModification() {
1197
1198
public void testAbortWithExceptionOnInsertAndConcurrentModification () {
1198
1199
assumeFalse (
1199
1200
"concurrent transactions are not supported on the emulator" ,
1200
- env . getTestHelper (). isEmulator ());
1201
+ isUsingEmulator ());
1201
1202
boolean abortedDueToConcurrentModification = false ;
1202
1203
AbortInterceptor interceptor = new AbortInterceptor (0 );
1203
1204
// first insert two test records
@@ -1266,7 +1267,7 @@ public void testAbortWithExceptionOnInsertAndConcurrentModification() {
1266
1267
public void testAbortWithDroppedTableConcurrentModification () {
1267
1268
assumeFalse (
1268
1269
"concurrent transactions are not supported on the emulator" ,
1269
- env . getTestHelper (). isEmulator ());
1270
+ isUsingEmulator ());
1270
1271
boolean abortedDueToConcurrentModification = false ;
1271
1272
AbortInterceptor interceptor = new AbortInterceptor (0 );
1272
1273
// first insert two test records
@@ -1331,7 +1332,7 @@ public void testAbortWithDroppedTableConcurrentModification() {
1331
1332
public void testAbortWithInsertOnDroppedTableConcurrentModification () {
1332
1333
assumeFalse (
1333
1334
"concurrent transactions are not supported on the emulator" ,
1334
- env . getTestHelper (). isEmulator ());
1335
+ isUsingEmulator ());
1335
1336
boolean abortedDueToConcurrentModification = false ;
1336
1337
AbortInterceptor interceptor = new AbortInterceptor (0 );
1337
1338
// first insert two test records
@@ -1393,7 +1394,7 @@ public void testAbortWithInsertOnDroppedTableConcurrentModification() {
1393
1394
public void testAbortWithCursorHalfwayDroppedTableConcurrentModification () {
1394
1395
assumeFalse (
1395
1396
"concurrent transactions are not supported on the emulator" ,
1396
- env . getTestHelper (). isEmulator ());
1397
+ isUsingEmulator ());
1397
1398
boolean abortedDueToConcurrentModification = false ;
1398
1399
AbortInterceptor interceptor = new AbortInterceptor (0 );
1399
1400
// first insert two test records
@@ -1548,7 +1549,7 @@ public void testRetryHighAbortRate() {
1548
1549
public void testAbortWithConcurrentInsertOnEmptyTable () {
1549
1550
assumeFalse (
1550
1551
"concurrent transactions are not supported on the emulator" ,
1551
- env . getTestHelper (). isEmulator ());
1552
+ isUsingEmulator ());
1552
1553
AbortInterceptor interceptor = new AbortInterceptor (0 );
1553
1554
try (ITConnection connection =
1554
1555
createConnection (interceptor , new CountTransactionRetryListener ())) {
0 commit comments