Search in sources :

Example 1 with TransactionOption

use of com.google.cloud.spanner.Options.TransactionOption in project java-spanner by googleapis.

the class DatabaseClientImplTest method testTransactionManager_usesOptions.

@Test
public void testTransactionManager_usesOptions() {
    SessionPool pool = mock(SessionPool.class);
    PooledSessionFuture session = mock(PooledSessionFuture.class);
    when(pool.getSession()).thenReturn(session);
    TransactionOption option = mock(TransactionOption.class);
    DatabaseClientImpl client = new DatabaseClientImpl(pool);
    client.transactionManager(option);
    verify(session).transactionManager(option);
}
Also used : PooledSessionFuture(com.google.cloud.spanner.SessionPool.PooledSessionFuture) TransactionOption(com.google.cloud.spanner.Options.TransactionOption) Test(org.junit.Test)

Example 2 with TransactionOption

use of com.google.cloud.spanner.Options.TransactionOption in project java-spanner by googleapis.

the class DatabaseClientImplTest method testReadWriteTransaction_usesOptions.

@Test
public void testReadWriteTransaction_usesOptions() {
    SessionPool pool = mock(SessionPool.class);
    PooledSessionFuture session = mock(PooledSessionFuture.class);
    when(pool.getSession()).thenReturn(session);
    TransactionOption option = mock(TransactionOption.class);
    DatabaseClientImpl client = new DatabaseClientImpl(pool);
    client.readWriteTransaction(option);
    verify(session).readWriteTransaction(option);
}
Also used : PooledSessionFuture(com.google.cloud.spanner.SessionPool.PooledSessionFuture) TransactionOption(com.google.cloud.spanner.Options.TransactionOption) Test(org.junit.Test)

Example 3 with TransactionOption

use of com.google.cloud.spanner.Options.TransactionOption in project java-spanner by googleapis.

the class DatabaseClientImplTest method testRunAsync_usesOptions.

@Test
public void testRunAsync_usesOptions() {
    SessionPool pool = mock(SessionPool.class);
    PooledSessionFuture session = mock(PooledSessionFuture.class);
    when(pool.getSession()).thenReturn(session);
    TransactionOption option = mock(TransactionOption.class);
    DatabaseClientImpl client = new DatabaseClientImpl(pool);
    client.runAsync(option);
    verify(session).runAsync(option);
}
Also used : PooledSessionFuture(com.google.cloud.spanner.SessionPool.PooledSessionFuture) TransactionOption(com.google.cloud.spanner.Options.TransactionOption) Test(org.junit.Test)

Example 4 with TransactionOption

use of com.google.cloud.spanner.Options.TransactionOption in project java-spanner by googleapis.

the class DatabaseClientImplTest method testTransactionManagerAsync_usesOptions.

@Test
public void testTransactionManagerAsync_usesOptions() {
    SessionPool pool = mock(SessionPool.class);
    PooledSessionFuture session = mock(PooledSessionFuture.class);
    when(pool.getSession()).thenReturn(session);
    TransactionOption option = mock(TransactionOption.class);
    DatabaseClientImpl client = new DatabaseClientImpl(pool);
    client.transactionManagerAsync(option);
    verify(session).transactionManagerAsync(option);
}
Also used : PooledSessionFuture(com.google.cloud.spanner.SessionPool.PooledSessionFuture) TransactionOption(com.google.cloud.spanner.Options.TransactionOption) Test(org.junit.Test)

Aggregations

TransactionOption (com.google.cloud.spanner.Options.TransactionOption)4 PooledSessionFuture (com.google.cloud.spanner.SessionPool.PooledSessionFuture)4 Test (org.junit.Test)4