in grpc-gcp-benchmarks/src/benchmarkTest/java/SpannerLoadTest.java [140:162]
public static void testListSessionsFuture() throws InterruptedException, ExecutionException {
logger.info("Start testing ListSessions Future..");
File configFile =
new File(SpannerLoadTest.class.getClassLoader().getResource(API_FILE).getFile());
ManagedChannel channel =
GcpManagedChannelBuilder.forDelegateBuilder(builder)
.withApiConfigJsonFile(configFile)
.build();
SpannerFutureStub stub = getSpannerFutureStub(channel);
List<String> futureNames = createFutureSessions(stub);
ListSessionsResponse responseList =
stub.listSessions(ListSessionsRequest.newBuilder().setDatabase(DATABASE).build()).get();
Set<String> trueNames = new HashSet<>();
for (Session s : responseList.getSessionsList()) {
trueNames.add(s.getName());
}
for (String name : futureNames) {
if (!trueNames.contains(name)) {
logger.warning(String.format("Listed Sessions doesn't contain session %s", name));
}
}
deleteFutureSessions(stub, futureNames);
}