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 |
getUniqueBackupId()
Returns a backup id which is guaranteed to be unique within the context of this environment.
|
String |
getUniqueDatabaseId()
Returns a database id which is guaranteed to be unique within the context of this environment.
|
boolean |
isEmulator()
Deprecated.
use
EmulatorSpannerHelper.isUsingEmulator() instead. |
protected RemoteSpannerHelper(SpannerOptions options, InstanceId instanceId, Spanner client)
public SpannerOptions getOptions()
@Deprecated public boolean isEmulator()
EmulatorSpannerHelper.isUsingEmulator()
instead.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 String getUniqueBackupId()
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)
RemoteSpannerHelper
bound to the given instance ID. All databases created
using this will be created in the given instance.public static RemoteSpannerHelper create(SpannerOptions options, InstanceId instanceId)
RemoteSpannerHelper
for the given option and bound to the given instance ID.
All databases created using this will be created in the given instance.Copyright © 2021 Google LLC. All rights reserved.