use of com.google.api.ads.admanager.axis.v202205.ResultSet in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerProbesTest method testExecuteSql.
@Test
public void testExecuteSql() throws Exception {
Value value = Value.newBuilder().setStringValue(TEST_USERNAME).build();
ListValue row = ListValue.newBuilder().addValues(value).build();
ResultSet response = ResultSet.newBuilder().addRows(row).build();
PartialResultSet responseList = PartialResultSet.newBuilder().addValues(value).build();
serviceImpl.addResponse(session);
serviceImpl.addResponse(response);
serviceImpl.addResponse(responseList);
serviceImpl.addResponse(emptyResponse);
SpannerProbes.executeSqlProber(stub);
verify(serviceImpl, times(1)).createSession(any(), any());
verify(serviceImpl, times(1)).executeSql(any(), any());
verify(serviceImpl, times(1)).executeStreamingSql(any(), any());
verify(serviceImpl, times(1)).deleteSession(any(), any());
}
use of com.google.api.ads.admanager.axis.v202205.ResultSet in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerProbesTest method testRead.
@Test
public void testRead() throws Exception {
Value value = Value.newBuilder().setStringValue(TEST_USERNAME).build();
ListValue row = ListValue.newBuilder().addValues(value).build();
ResultSet response = ResultSet.newBuilder().addRows(row).build();
PartialResultSet responseList = PartialResultSet.newBuilder().addValues(value).build();
serviceImpl.addResponse(session);
serviceImpl.addResponse(response);
serviceImpl.addResponse(responseList);
serviceImpl.addResponse(emptyResponse);
SpannerProbes.readProber(stub);
verify(serviceImpl, times(1)).createSession(any(), any());
verify(serviceImpl, times(1)).read(any(), any());
verify(serviceImpl, times(1)).streamingRead(any(), any());
verify(serviceImpl, times(1)).deleteSession(any(), any());
}
use of com.google.api.ads.admanager.axis.v202205.ResultSet in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerClientV1TestCases method testRead.
void testRead() throws InterruptedException {
System.out.println("\nTestRead");
SpannerClient client = getClient();
Session session = client.createSession(CreateSessionRequest.newBuilder().setDatabase(database).build());
ReadRequest request = ReadRequest.newBuilder().setSession(session.getName()).setTable(TABLE).setKeySet(KeySet.newBuilder().setAll(true).build()).addColumns("users").addColumns("firstname").addColumns("lastname").build();
RpcCall<ReadRequest, ResultSet> rpcCall = (ReadRequest req) -> client.read(req);
doTestBlocking(request, rpcCall);
cleanUpClient(client, session.getName());
}
use of com.google.api.ads.admanager.axis.v202205.ResultSet in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerTestCases method testExecuteSql.
void testExecuteSql() throws InterruptedException {
System.out.println("\nTestExecuteSql");
ManagedChannel channel = getChannel();
SpannerBlockingStub stub = getBlockingStub(channel);
Session session = stub.createSession(CreateSessionRequest.newBuilder().setDatabase(database).build());
ExecuteSqlRequest request = ExecuteSqlRequest.newBuilder().setSession(session.getName()).setSql("select * FROM " + TABLE).build();
BlockingCall<ExecuteSqlRequest, ResultSet> blockingCall = (ExecuteSqlRequest req) -> stub.executeSql(req);
doTestBlocking(channel, request, blockingCall);
stub.deleteSession(DeleteSessionRequest.newBuilder().setName(session.getName()).build());
channel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
}
use of com.google.api.ads.admanager.axis.v202205.ResultSet in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerTestCases method testExecuteSqlAsync.
void testExecuteSqlAsync() throws InterruptedException {
System.out.println("\nTestExecuteSqlAsync");
ManagedChannel channel = getChannel();
SpannerStub stub = getStub(channel);
AsyncResponseObserver<Session> sessionObs = new AsyncResponseObserver<>();
stub.createSession(CreateSessionRequest.newBuilder().setDatabase(database).build(), sessionObs);
ExecuteSqlRequest request = ExecuteSqlRequest.newBuilder().setSession(sessionObs.get().getName()).setSql("select * FROM " + TABLE).build();
AsyncCall<ExecuteSqlRequest, ResultSet> asyncCall = (ExecuteSqlRequest req, AsyncResponseObserver<ResultSet> resp) -> stub.executeSql(req, resp);
doTestAsync(channel, request, asyncCall);
deleteAndCloseAsync(stub, channel, sessionObs.get().getName());
}
Aggregations