- txCohort.get().canCommit().get(5, TimeUnit.SECONDS);
- } catch (ExecutionException e) {
- Throwables.propagateIfInstanceOf(e.getCause(), Exception.class);
- Throwables.propagate(e.getCause());
+ txCohort.get().canCommit().get(10, TimeUnit.SECONDS);
+ fail("Expected NoShardLeaderException");
+ } catch (final ExecutionException e) {
+ final String msg = "Unexpected exception: "
+ + Throwables.getStackTraceAsString(e.getCause());
+ if (DistributedDataStore.class.equals(testParameter)) {
+ assertTrue(Throwables.getRootCause(e) instanceof NoShardLeaderException);
+ } else {
+ assertTrue(msg, Throwables.getRootCause(e) instanceof RequestTimeoutException);
+ }
+ }
+ } finally {
+ try {
+ if (writeTxToClose != null) {
+ writeTxToClose.close();
+ }
+ } catch (Exception e) {
+ // FIXME TransactionProxy.close throws IllegalStateException:
+ // Transaction is ready, it cannot be closed