Class MockDatabaseAdminConnection (2.21.0)

Application developers may want to test their code with simulated responses, including errors from a spanner::DatabaseAdminClient. To do so, construct a spanner::DatabaseAdminClient with an instance of this class. Then use the Google Test framework functions to program the behavior of this mock.

Functions

CreateDatabase(CreateDatabaseParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.CreateDatabase RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
CreateDatabaseParams
Returns
TypeDescription
future< StatusOr< google::spanner::admin::database::v1::Database > >

GetDatabase(GetDatabaseParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.GetDatabase RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
GetDatabaseParams
Returns
TypeDescription
StatusOr< google::spanner::admin::database::v1::Database >

GetDatabaseDdl(GetDatabaseDdlParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.GetDatabaseDdl RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
GetDatabaseDdlParams
Returns
TypeDescription
StatusOr< google::spanner::admin::database::v1::GetDatabaseDdlResponse >

UpdateDatabase(UpdateDatabaseParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.UpdateDatabase RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
UpdateDatabaseParams
Returns
TypeDescription
future< StatusOr< google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata > >

DropDatabase(DropDatabaseParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.DropDatabase RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
DropDatabaseParams
Returns
TypeDescription
Status

ListDatabases(ListDatabasesParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.DropDatabase RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
ListDatabasesParams
Returns
TypeDescription
ListDatabaseRange

virtual RestoreDatabase(RestoreDatabaseParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.RestoreDatabase RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
RestoreDatabaseParams
Returns
TypeDescription
future< StatusOr< google::spanner::admin::database::v1::Database > >

GetIamPolicy(GetIamPolicyParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.GetIamPolicy RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
GetIamPolicyParams
Returns
TypeDescription
StatusOr< google::iam::v1::Policy >

SetIamPolicy(SetIamPolicyParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.SetIamPolicy RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
SetIamPolicyParams
Returns
TypeDescription
StatusOr< google::iam::v1::Policy >

TestIamPermissions(TestIamPermissionsParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.TestIamPermissions RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
TestIamPermissionsParams
Returns
TypeDescription
StatusOr< google::iam::v1::TestIamPermissionsResponse >

virtual CreateBackup(CreateBackupParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.CreateBackup RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
CreateBackupParams
Returns
TypeDescription
future< StatusOr< google::spanner::admin::database::v1::Backup > >

virtual GetBackup(GetBackupParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.GetBackup RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
GetBackupParams
Returns
TypeDescription
StatusOr< google::spanner::admin::database::v1::Backup >

virtual DeleteBackup(DeleteBackupParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.DeleteBackup RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
DeleteBackupParams
Returns
TypeDescription
Status

virtual ListBackups(ListBackupsParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.ListBackups RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
ListBackupsParams
Returns
TypeDescription
ListBackupsRange

virtual UpdateBackup(UpdateBackupParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.UpdateBackup RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
UpdateBackupParams
Returns
TypeDescription
StatusOr< google::spanner::admin::database::v1::Backup >

virtual ListBackupOperations(ListBackupOperationsParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.ListBackupOperations RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
ListBackupOperationsParams
Returns
TypeDescription
ListBackupOperationsRange

virtual ListDatabaseOperations(ListDatabaseOperationsParams)

Define the interface for a google.spanner.v1.DatabaseAdmin.ListDatabaseOperations RPC.

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
ListDatabaseOperationsParams
Returns
TypeDescription
ListDatabaseOperationsRange

virtual options()

Returns
TypeDescription
Options