Search in sources :

Example 11 with ITConnection

use of com.google.cloud.spanner.connection.ITAbstractSpannerTest.ITConnection in project java-spanner by googleapis.

the class AbstractMockServerTest method createConnection.

ITConnection createConnection(List<StatementExecutionInterceptor> interceptors, List<TransactionRetryListener> transactionRetryListeners) {
    ConnectionOptions.Builder builder = ConnectionOptions.newBuilder().setUri(getBaseUrl()).setStatementExecutionInterceptors(interceptors);
    ConnectionOptions options = builder.build();
    ITConnection connection = createITConnection(options);
    for (TransactionRetryListener listener : transactionRetryListeners) {
        connection.addTransactionRetryListener(listener);
    }
    return connection;
}
Also used : ITConnection(com.google.cloud.spanner.connection.ITAbstractSpannerTest.ITConnection)

Aggregations

ITConnection (com.google.cloud.spanner.connection.ITAbstractSpannerTest.ITConnection)11 Test (org.junit.Test)8 SpannerException (com.google.cloud.spanner.SpannerException)7 Statement (com.google.cloud.spanner.Statement)7 StatusRuntimeException (io.grpc.StatusRuntimeException)7 ResultSet (com.google.cloud.spanner.ResultSet)4 AbortInterceptor (com.google.cloud.spanner.connection.ITAbstractSpannerTest.AbortInterceptor)2 CountTransactionRetryListener (com.google.cloud.spanner.connection.it.ITTransactionRetryTest.CountTransactionRetryListener)2 Timestamp (com.google.cloud.Timestamp)1 ErrorCode (com.google.cloud.spanner.ErrorCode)1 StatementResult (com.google.cloud.spanner.MockSpannerServiceImpl.StatementResult)1 ImmutableList (com.google.common.collect.ImmutableList)1 Truth.assertThat (com.google.common.truth.Truth.assertThat)1 ByteString (com.google.protobuf.ByteString)1 CommitRequest (com.google.spanner.v1.CommitRequest)1 ExecuteBatchDmlRequest (com.google.spanner.v1.ExecuteBatchDmlRequest)1 ExecuteSqlRequest (com.google.spanner.v1.ExecuteSqlRequest)1 Status (io.grpc.Status)1 Collections (java.util.Collections)1 CoreMatchers.equalTo (org.hamcrest.CoreMatchers.equalTo)1