public class RemoteSpannerHelper extends Object
Modifier | Constructor and Description |
---|---|
protected |
RemoteSpannerHelper(SpannerOptions options,
InstanceId instanceId,
Spanner client) |
Modifier and Type | Method and Description |
---|---|
void |
cleanUp()
Deletes all the databases created via
createTestDatabase . |
static RemoteSpannerHelper |
create(InstanceId instanceId)
Creates a
RemoteSpannerHelper bound to the given instance ID. |
static RemoteSpannerHelper |
create(SpannerOptions options,
InstanceId instanceId)
Creates a
RemoteSpannerHelper for the given option and bound to the given instance ID. |
Database |
createTestDatabase(Iterable<String> statements)
Creates a test database defined by
statements in the test instance. |
Database |
createTestDatabase(String... statements)
Creates a test database defined by
statements . |
BatchClient |
getBatchClient(Database db) |
Spanner |
getClient() |
DatabaseClient |
getDatabaseClient(Database db) |
InstanceId |
getInstanceId() |
SpannerOptions |
getOptions() |
String |
getUniqueDatabaseId()
Returns a database id which is guaranteed to be unique within the context of this environment.
|
protected RemoteSpannerHelper(SpannerOptions options, InstanceId instanceId, Spanner client)
public SpannerOptions getOptions()
public Spanner getClient()
public DatabaseClient getDatabaseClient(Database db)
public BatchClient getBatchClient(Database db)
public InstanceId getInstanceId()
public Database createTestDatabase(String... statements) throws SpannerException
statements
. A CREATE DATABASE ...
statement
should not be included; an appropriate name will be chosen and the statement generated
accordingly.SpannerException
public String getUniqueDatabaseId()
public Database createTestDatabase(Iterable<String> statements) throws SpannerException
statements
in the test instance. A CREATE
DATABASE ...
statement should not be included; an appropriate name will be chosen and the
statement generated accordingly.SpannerException
public void cleanUp()
createTestDatabase
. Shuts down the client.public static RemoteSpannerHelper create(InstanceId instanceId) throws Throwable
RemoteSpannerHelper
bound to the given instance ID. All databases created
using this will be created in the given instance.Throwable
public static RemoteSpannerHelper create(SpannerOptions options, InstanceId instanceId) throws Throwable
RemoteSpannerHelper
for the given option and bound to the given instance ID.
All databases created using this will be created in the given instance.Throwable
Copyright © 2019 Google LLC. All rights reserved.