3636import com .google .cloud .spanner .Key ;
3737import com .google .cloud .spanner .KeySet ;
3838import com .google .cloud .spanner .Mutation ;
39+ import com .google .cloud .spanner .ParallelIntegrationTest ;
3940import com .google .cloud .spanner .Spanner ;
4041import com .google .cloud .spanner .SpannerException ;
4142import com .google .cloud .spanner .Struct ;
4849import java .util .concurrent .ExecutionException ;
4950import java .util .concurrent .Executor ;
5051import java .util .concurrent .Executors ;
51- import org .junit .After ;
5252import org .junit .Before ;
5353import org .junit .BeforeClass ;
5454import org .junit .ClassRule ;
55+ import org .junit .Ignore ;
5556import org .junit .Test ;
57+ import org .junit .experimental .categories .Category ;
5658import org .junit .runner .RunWith ;
5759import org .junit .runners .Parameterized ;
5860import org .junit .runners .Parameterized .Parameter ;
5961import org .junit .runners .Parameterized .Parameters ;
6062
6163@ RunWith (Parameterized .class )
64+ @ Category (ParallelIntegrationTest .class )
6265public class ITTransactionManagerAsyncTest {
6366
6467 @ Parameter (0 )
@@ -76,8 +79,8 @@ public static Collection<Object[]> data() {
7679
7780 @ ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv ();
7881 private static Database db ;
79- private Spanner spanner ;
80- private DatabaseClient client ;
82+ private static Spanner spanner ;
83+ private static DatabaseClient client ;
8184
8285 @ BeforeClass
8386 public static void setUpDatabase () {
@@ -89,20 +92,15 @@ public static void setUpDatabase() {
8992 + " K STRING(MAX) NOT NULL,"
9093 + " BoolValue BOOL,"
9194 + ") PRIMARY KEY (K)" );
95+ spanner = env .getTestHelper ().getClient ();
96+ client = spanner .getDatabaseClient (db .getId ());
9297 }
9398
9499 @ Before
95100 public void clearTable () {
96- spanner = env .getTestHelper ().getClient ();
97- client = spanner .getDatabaseClient (db .getId ());
98101 client .write (ImmutableList .of (Mutation .delete ("T" , KeySet .all ())));
99102 }
100103
101- @ After
102- public void closeSpanner () {
103- spanner .close ();
104- }
105-
106104 @ Test
107105 public void testSimpleInsert () throws ExecutionException , InterruptedException {
108106 try (AsyncTransactionManager manager = client .transactionManagerAsync ()) {
@@ -224,6 +222,8 @@ public ApiFuture<Void> apply(TransactionContext txn, Void input) throws Exceptio
224222 }
225223 }
226224
225+ @ Ignore (
226+ "Cloud Spanner now seems to return CANCELLED instead of ABORTED when a transaction is invalidated by a later transaction in the same session" )
227227 @ Test
228228 public void testAbortAndRetry () throws InterruptedException , ExecutionException {
229229 assumeFalse (
0 commit comments