Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import com.google.common.hash.PrimitiveSink;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

/**
* {@link ResultSet} implementation that keeps a running checksum that can be used to determine
Expand Down Expand Up @@ -117,7 +116,7 @@ public boolean next() {
}

@VisibleForTesting
HashCode getChecksum() throws InterruptedException, ExecutionException {
HashCode getChecksum() {
// HashCode is immutable and can be safely returned.
return checksumCalculator.getChecksum();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public void getter() throws Exception {
}

@Test
public void getterForIncorrectType() throws Exception {
public void getterForIncorrectType() {
Mockito.when(reader.getType()).thenReturn(Type.struct(StructField.of("F1", type)));
int columnIndex = 0;
Mockito.when(reader.isNull(columnIndex)).thenReturn(false);
Expand Down Expand Up @@ -367,7 +367,7 @@ public void getterForIncorrectType() throws Exception {
}

@Test
public void getterWhenNull() throws Exception {
public void getterWhenNull() {
Mockito.when(reader.getType()).thenReturn(Type.struct(StructField.of("F1", type)));
Mockito.when(reader.isNull(0)).thenReturn(true);
try {
Expand All @@ -379,7 +379,7 @@ public void getterWhenNull() throws Exception {
}

@Test
public void getterByNameWhenNull() throws Exception {
public void getterByNameWhenNull() {
Mockito.when(reader.getType()).thenReturn(Type.struct(StructField.of("F1", type)));
Mockito.when(reader.isNull(0)).thenReturn(true);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void setUp() throws Exception {
}

@After
public void tearDown() throws Exception {
public void tearDown() {
mockSpanner.reset();
mockSpanner.removeAllExecutionTimes();
// This test case force-closes the Spanner instance as it would otherwise wait
Expand Down Expand Up @@ -209,7 +209,7 @@ public void run() {
runner.run(
new TransactionCallable<Long>() {
@Override
public Long run(TransactionContext transaction) throws Exception {
public Long run(TransactionContext transaction) {
return transaction.executeUpdate(UPDATE_STATEMENT);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void setUp() {
.thenAnswer(
new Answer<Backup.Builder>() {
@Override
public Builder answer(InvocationOnMock invocation) throws Throwable {
public Builder answer(InvocationOnMock invocation) {
return new Backup.Builder(dbClient, (BackupId) invocation.getArguments()[0]);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void testBatchReadOnlyTxnWithBound() throws Exception {
}

@Test
public void testBatchReadOnlyTxnWithTxnId() throws Exception {
public void testBatchReadOnlyTxnWithTxnId() {
when(txnID.getSessionId()).thenReturn(SESSION_NAME);
when(txnID.getTransactionId()).thenReturn(TXN_ID);
Timestamp t = Timestamp.parseTimestamp(TIMESTAMP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static void stopServer() throws InterruptedException {
}

@Before
public void setUp() throws IOException {
public void setUp() {
mockSpanner.reset();
mockSpanner.removeAllExecutionTimes();
}
Expand Down Expand Up @@ -237,7 +237,7 @@ public void testSpannerReturnsResourceExhausted() throws InterruptedException {
}

@Test
public void testPrepareSessionFailPropagatesToUser() throws InterruptedException {
public void testPrepareSessionFailPropagatesToUser() {
// Do not create any sessions by default.
// This also means that when a read/write session is requested, the session pool
// will start preparing a read session at that time. Any errors that might occur
Expand All @@ -256,7 +256,7 @@ public void testPrepareSessionFailPropagatesToUser() throws InterruptedException
runner.run(
new TransactionCallable<Void>() {
@Override
public Void run(TransactionContext transaction) throws Exception {
public Void run(TransactionContext transaction) {
return null;
}
});
Expand Down Expand Up @@ -297,7 +297,7 @@ public void testPrepareSessionFailDoesNotPropagateToUser() throws InterruptedExc
runner.run(
new TransactionCallable<Void>() {
@Override
public Void run(TransactionContext transaction) throws Exception {
public Void run(TransactionContext transaction) {
return null;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public void listBackups() {
}

@Test
public void updateBackup() throws Exception {
public void updateBackup() {
Timestamp t =
Timestamp.ofTimeMicroseconds(
TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import io.grpc.Server;
import io.grpc.Status;
import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -110,7 +109,7 @@ public static void stopServer() throws Exception {

@SuppressWarnings("rawtypes")
@Before
public void setUp() throws IOException {
public void setUp() {
mockDatabaseAdmin.reset();
mockOperations.reset();
SpannerOptions.Builder builder = SpannerOptions.newBuilder();
Expand Down Expand Up @@ -214,7 +213,7 @@ public ManagedChannelBuilder apply(ManagedChannelBuilder input) {
}

@After
public void tearDown() throws Exception {
public void tearDown() {
mockDatabaseAdmin.reset();
mockDatabaseAdmin.removeAllExecutionTimes();
mockOperations.reset();
Expand Down Expand Up @@ -311,7 +310,7 @@ public void databaseBackup() throws InterruptedException, ExecutionException {
}

@Test
public void dbAdminCreateBackupAlreadyExists() throws InterruptedException, ExecutionException {
public void dbAdminCreateBackupAlreadyExists() throws InterruptedException {
OperationFuture<Backup, CreateBackupMetadata> op =
client.createBackup(INSTANCE_ID, BCK_ID, DB_ID, after7Days());
try {
Expand All @@ -325,7 +324,7 @@ public void dbAdminCreateBackupAlreadyExists() throws InterruptedException, Exec
}

@Test
public void backupCreateAlreadyExists() throws InterruptedException, ExecutionException {
public void backupCreateAlreadyExists() throws InterruptedException {
Backup backup =
client
.newBackupBuilder(BackupId.of(PROJECT_ID, INSTANCE_ID, BCK_ID))
Expand All @@ -343,7 +342,7 @@ public void backupCreateAlreadyExists() throws InterruptedException, ExecutionEx
}

@Test
public void databaseBackupAlreadyExists() throws InterruptedException, ExecutionException {
public void databaseBackupAlreadyExists() throws InterruptedException {
Database db = client.getDatabase(INSTANCE_ID, DB_ID);
OperationFuture<Backup, CreateBackupMetadata> op =
db.backup(
Expand All @@ -362,7 +361,7 @@ public void databaseBackupAlreadyExists() throws InterruptedException, Execution
}

@Test
public void dbAdminCreateBackupDbNotFound() throws InterruptedException, ExecutionException {
public void dbAdminCreateBackupDbNotFound() throws InterruptedException {
final String backupId = "other-backup-id";
OperationFuture<Backup, CreateBackupMetadata> op =
client.createBackup(INSTANCE_ID, backupId, "does-not-exist", after7Days());
Expand All @@ -376,7 +375,7 @@ public void dbAdminCreateBackupDbNotFound() throws InterruptedException, Executi
}

@Test
public void backupCreateDbNotFound() throws InterruptedException, ExecutionException {
public void backupCreateDbNotFound() throws InterruptedException {
final String backupId = "other-backup-id";
Backup backup =
client
Expand All @@ -394,7 +393,7 @@ public void backupCreateDbNotFound() throws InterruptedException, ExecutionExcep
}

@Test
public void databaseBackupDbNotFound() throws InterruptedException, ExecutionException {
public void databaseBackupDbNotFound() throws InterruptedException {
final String backupId = "other-backup-id";
Database db =
new Database(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public Void apply(Builder<?, ?> input) {
}

@After
public void tearDown() throws Exception {
public void tearDown() {
spanner.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static void stopServer() throws InterruptedException {
}

@Before
public void setUp() throws IOException {
public void setUp() {
spanner =
SpannerOptions.newBuilder()
.setProjectId(TEST_PROJECT)
Expand All @@ -137,7 +137,7 @@ public void setUp() throws IOException {
}

@After
public void tearDown() throws Exception {
public void tearDown() {
spanner.close();
mockSpanner.reset();
mockSpanner.removeAllExecutionTimes();
Expand Down Expand Up @@ -185,7 +185,7 @@ public void testExecutePartitionedDmlWithException() {
}

@Test
public void testPartitionedDmlDoesNotTimeout() throws Exception {
public void testPartitionedDmlDoesNotTimeout() {
mockSpanner.setExecuteSqlExecutionTime(SimulatedExecutionTime.ofMinimumAndRandomTime(10, 0));
final RetrySettings retrySettings =
RetrySettings.newBuilder()
Expand Down Expand Up @@ -218,7 +218,7 @@ public void testPartitionedDmlDoesNotTimeout() throws Exception {
.run(
new TransactionCallable<Void>() {
@Override
public Void run(TransactionContext transaction) throws Exception {
public Void run(TransactionContext transaction) {
transaction.executeUpdate(UPDATE_STATEMENT);
return null;
}
Expand All @@ -233,7 +233,7 @@ public Void run(TransactionContext transaction) throws Exception {
}

@Test
public void testPartitionedDmlWithLowerTimeout() throws Exception {
public void testPartitionedDmlWithLowerTimeout() {
mockSpanner.setExecuteSqlExecutionTime(SimulatedExecutionTime.ofMinimumAndRandomTime(1000, 0));
SpannerOptions.Builder builder =
SpannerOptions.newBuilder()
Expand Down Expand Up @@ -265,7 +265,7 @@ public void testPartitionedDmlWithLowerTimeout() throws Exception {
.run(
new TransactionCallable<Long>() {
@Override
public Long run(TransactionContext transaction) throws Exception {
public Long run(TransactionContext transaction) {
return transaction.executeUpdate(UPDATE_STATEMENT);
}
});
Expand All @@ -274,7 +274,7 @@ public Long run(TransactionContext transaction) throws Exception {
}

@Test
public void testPartitionedDmlWithHigherTimeout() throws Exception {
public void testPartitionedDmlWithHigherTimeout() {
mockSpanner.setExecuteSqlExecutionTime(SimulatedExecutionTime.ofMinimumAndRandomTime(100, 0));
SpannerOptions.Builder builder =
SpannerOptions.newBuilder()
Expand Down Expand Up @@ -313,7 +313,7 @@ public void testPartitionedDmlWithHigherTimeout() throws Exception {
.run(
new TransactionCallable<Long>() {
@Override
public Long run(TransactionContext transaction) throws Exception {
public Long run(TransactionContext transaction) {
return transaction.executeUpdate(UPDATE_STATEMENT);
}
});
Expand All @@ -326,7 +326,7 @@ public Long run(TransactionContext transaction) throws Exception {
}

@Test
public void testPartitionedDmlRetriesOnUnavailable() throws Exception {
public void testPartitionedDmlRetriesOnUnavailable() {
mockSpanner.setExecuteSqlExecutionTime(
SimulatedExecutionTime.ofException(Status.UNAVAILABLE.asRuntimeException()));
SpannerOptions.Builder builder =
Expand Down Expand Up @@ -387,7 +387,7 @@ public void testDatabaseOrInstanceDoesNotExistOnPrepareSession() throws Exceptio
.run(
new TransactionCallable<Void>() {
@Override
public Void run(TransactionContext transaction) throws Exception {
public Void run(TransactionContext transaction) {
return null;
}
});
Expand Down Expand Up @@ -440,7 +440,7 @@ public void testDatabaseOrInstanceDoesNotExistOnInitialization() throws Exceptio
}

@Test
public void testDatabaseOrInstanceDoesNotExistOnCreate() throws Exception {
public void testDatabaseOrInstanceDoesNotExistOnCreate() {
StatusRuntimeException[] exceptions =
new StatusRuntimeException[] {
SpannerExceptionFactoryTest.newStatusResourceNotFoundException(
Expand Down Expand Up @@ -578,7 +578,7 @@ private void testExceptionOnPrepareSession(StatusRuntimeException exception)
.run(
new TransactionCallable<Void>() {
@Override
public Void run(TransactionContext transaction) throws Exception {
public Void run(TransactionContext transaction) {
return null;
}
});
Expand All @@ -594,7 +594,7 @@ public Void run(TransactionContext transaction) throws Exception {
.run(
new TransactionCallable<Void>() {
@Override
public Void run(TransactionContext transaction) throws Exception {
public Void run(TransactionContext transaction) {
return null;
}
});
Expand Down Expand Up @@ -665,7 +665,7 @@ public void testDatabaseOrInstanceIsDeletedAndThenRecreated() throws Exception {
.run(
new TransactionCallable<Void>() {
@Override
public Void run(TransactionContext transaction) throws Exception {
public Void run(TransactionContext transaction) {
return null;
}
});
Expand All @@ -690,7 +690,7 @@ public Void run(TransactionContext transaction) throws Exception {
.run(
new TransactionCallable<Void>() {
@Override
public Void run(TransactionContext transaction) throws Exception {
public Void run(TransactionContext transaction) {
return null;
}
});
Expand Down Expand Up @@ -737,7 +737,7 @@ public void testAllowNestedTransactions() throws InterruptedException {
.run(
new TransactionCallable<Long>() {
@Override
public Long run(TransactionContext transaction) throws Exception {
public Long run(TransactionContext transaction) {
assertThat(client.pool.getNumberOfSessionsInPool()).isEqualTo(minSessions - 1);
return transaction.executeUpdate(UPDATE_STATEMENT);
}
Expand Down Expand Up @@ -772,7 +772,7 @@ public void testNestedTransactionsUsingTwoDatabases() throws InterruptedExceptio
.run(
new TransactionCallable<Long>() {
@Override
public Long run(TransactionContext transaction) throws Exception {
public Long run(TransactionContext transaction) {
// Client1 should have 1 session checked out.
// Client2 should have 0 sessions checked out.
assertThat(client1.pool.getNumberOfSessionsInPool()).isEqualTo(minSessions - 1);
Expand All @@ -783,7 +783,7 @@ public Long run(TransactionContext transaction) throws Exception {
.run(
new TransactionCallable<Long>() {
@Override
public Long run(TransactionContext transaction) throws Exception {
public Long run(TransactionContext transaction) {
// Both clients should now have 1 session checked out.
assertThat(client1.pool.getNumberOfSessionsInPool())
.isEqualTo(minSessions - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void setUp() {
.thenAnswer(
new Answer<Backup.Builder>() {
@Override
public Backup.Builder answer(InvocationOnMock invocation) throws Throwable {
public Backup.Builder answer(InvocationOnMock invocation) {
return new Backup.Builder(dbClient, (BackupId) invocation.getArguments()[0]);
}
});
Expand Down
Loading