Search in sources :

Example 6 with OperationStashCallable

use of com.google.api.gax.rpc.testing.FakeOperationApi.OperationStashCallable in project gax-java by googleapis.

the class OperationCallableImplTest method callCancel.

@Test
public void callCancel() throws Exception {
    ApiCallContext defaultCallContext = FakeCallContext.createDefault();
    OperationStashCallable stashCallable = new OperationStashCallable();
    OperationCallable<Integer, String, Long> callable = stashCallable.withDefaultCallContext(defaultCallContext);
    OperationFuture<String, Long> operationFuture = callable.futureCall(45);
    callable.cancel(operationFuture.getName()).get();
    Truth.assertThat(stashCallable.wasCancelCalled()).isTrue();
    Truth.assertThat(stashCallable.getCancelContext()).isSameInstanceAs(defaultCallContext);
}
Also used : OperationStashCallable(com.google.api.gax.rpc.testing.FakeOperationApi.OperationStashCallable) Test(org.junit.Test)

Aggregations

OperationStashCallable (com.google.api.gax.rpc.testing.FakeOperationApi.OperationStashCallable)6 Test (org.junit.Test)6 FakeCallContext (com.google.api.gax.rpc.testing.FakeCallContext)3 FakeChannel (com.google.api.gax.rpc.testing.FakeChannel)3 Credentials (com.google.auth.Credentials)3