use of com.google.api.ads.admanager.axis.v202205.ResultSet in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerTestCases method testReadAsync.
void testReadAsync() throws InterruptedException {
System.out.println("\nTestReadAsync");
ManagedChannel channel = getChannel();
SpannerStub stub = getStub(channel);
AsyncResponseObserver<Session> sessionObs = new AsyncResponseObserver<>();
stub.createSession(CreateSessionRequest.newBuilder().setDatabase(database).build(), sessionObs);
ReadRequest request = ReadRequest.newBuilder().setSession(sessionObs.get().getName()).setTable("small_table").setKeySet(KeySet.newBuilder().setAll(true).build()).addColumns("users").addColumns("firstname").addColumns("lastname").build();
AsyncCall<ReadRequest, ResultSet> asyncCall = (ReadRequest req, AsyncResponseObserver<ResultSet> resp) -> stub.read(req, resp);
doTestAsync(channel, request, asyncCall);
deleteAndCloseAsync(stub, channel, sessionObs.get().getName());
}
use of com.google.api.ads.admanager.axis.v202205.ResultSet in project grpc-gcp-java by GoogleCloudPlatform.
the class SpannerIntegrationTest method testExecuteSqlFuture.
@Test
public void testExecuteSqlFuture() throws Exception {
SpannerFutureStub stub = getSpannerFutureStub();
List<String> futureNames = createFutureSessions(stub);
for (String futureName : futureNames) {
ListenableFuture<ResultSet> responseFuture = stub.executeSql(ExecuteSqlRequest.newBuilder().setSession(futureName).setSql("select * FROM Users").build());
// The ChannelRef which is bound with the current affinity key.
GcpManagedChannel.ChannelRef currentChannel = gcpChannel.affinityKeyToChannelRef.get(futureName);
// Verify the channel is in use.
assertEquals(1, currentChannel.getActiveStreamsCount());
ResultSet response = responseFuture.get();
assertEquals(1, response.getRowsCount());
assertEquals(USERNAME, response.getRows(0).getValuesList().get(1).getStringValue());
assertEquals(0, currentChannel.getActiveStreamsCount());
}
deleteFutureSessions(stub, futureNames);
}
use of com.google.api.ads.admanager.axis.v202205.ResultSet in project cassandra by apache.
the class ListUsersStatement method formatResults.
@Override
protected ResultMessage formatResults(List<RoleResource> sortedRoles) {
ResultSet.ResultMetadata resultMetadata = new ResultSet.ResultMetadata(metadata);
ResultSet result = new ResultSet(resultMetadata);
IRoleManager roleManager = DatabaseDescriptor.getRoleManager();
INetworkAuthorizer networkAuthorizer = DatabaseDescriptor.getNetworkAuthorizer();
for (RoleResource role : sortedRoles) {
if (!roleManager.canLogin(role))
continue;
result.addColumnValue(UTF8Type.instance.decompose(role.getRoleName()));
result.addColumnValue(BooleanType.instance.decompose(Roles.hasSuperuserStatus(role)));
result.addColumnValue(UTF8Type.instance.decompose(networkAuthorizer.authorize(role).toString()));
}
return new ResultMessage.Rows(result);
}
use of com.google.api.ads.admanager.axis.v202205.ResultSet in project cassandra by apache.
the class BurnTestUtil method generateRows.
public static ResultMessage.Rows generateRows(int idx, SizeCaps sizeCaps) {
Random rnd = new Random(idx);
List<ColumnSpecification> columns = new ArrayList<>();
for (int i = 0; i < sizeCaps.columnCountCap; i++) {
columns.add(new ColumnSpecification("ks", "cf", new ColumnIdentifier(bytes(rnd, 5, 10), BytesType.instance), BytesType.instance));
}
List<List<ByteBuffer>> rows = new ArrayList<>();
int count = rnd.nextInt(sizeCaps.rowsCountCap);
for (int i = 0; i < count; i++) {
List<ByteBuffer> row = new ArrayList<>();
for (int j = 0; j < sizeCaps.columnCountCap; j++) row.add(bytes(rnd, sizeCaps.valueMinSize, sizeCaps.valueMaxSize));
rows.add(row);
}
ResultSet resultSet = new ResultSet(new ResultSet.ResultMetadata(columns), rows);
return new ResultMessage.Rows(resultSet);
}
Aggregations