Class MockDatabaseAdminConnection (2.33.0)

A class to mock DatabaseAdminConnection.

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

See Also

This example for how to test your application with GoogleTest. While the example showcases types from the BigQuery library, the underlying principles apply for any pair of *Client and *Connection.

Functions

virtual options()

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

Returns
Type Description
Options

virtual ListDatabases(google::spanner::admin::database::v1::ListDatabasesRequest)

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

Parameter
Name Description
request google::spanner::admin::database::v1::ListDatabasesRequest
Returns
Type Description
StreamRange< google::spanner::admin::database::v1::Database >

virtual CreateDatabase(google::longrunning::Operation const &)

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

Parameter
Name Description
operation google::longrunning::Operation const &
Returns
Type Description
future< StatusOr< google::spanner::admin::database::v1::Database > >

virtual GetDatabase(google::spanner::admin::database::v1::GetDatabaseRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::GetDatabaseRequest const &
Returns
Type Description
StatusOr< google::spanner::admin::database::v1::Database >

virtual UpdateDatabase(google::longrunning::Operation const &)

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

Parameter
Name Description
operation google::longrunning::Operation const &
Returns
Type Description
future< StatusOr< google::spanner::admin::database::v1::Database > >

virtual UpdateDatabaseDdl(google::longrunning::Operation const &)

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

Parameter
Name Description
operation google::longrunning::Operation const &
Returns
Type Description
future< StatusOr< google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata > >

virtual DropDatabase(google::spanner::admin::database::v1::DropDatabaseRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::DropDatabaseRequest const &
Returns
Type Description
Status

virtual GetDatabaseDdl(google::spanner::admin::database::v1::GetDatabaseDdlRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::GetDatabaseDdlRequest const &
Returns
Type Description
StatusOr< google::spanner::admin::database::v1::GetDatabaseDdlResponse >

virtual SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &)

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

Parameter
Name Description
request google::iam::v1::SetIamPolicyRequest const &
Returns
Type Description
StatusOr< google::iam::v1::Policy >

virtual GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &)

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

Parameter
Name Description
request google::iam::v1::GetIamPolicyRequest const &
Returns
Type Description
StatusOr< google::iam::v1::Policy >

virtual TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &)

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

Parameter
Name Description
request google::iam::v1::TestIamPermissionsRequest const &
Returns
Type Description
StatusOr< google::iam::v1::TestIamPermissionsResponse >

virtual CreateBackup(google::longrunning::Operation const &)

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

Parameter
Name Description
operation google::longrunning::Operation const &
Returns
Type Description
future< StatusOr< google::spanner::admin::database::v1::Backup > >

virtual CopyBackup(google::longrunning::Operation const &)

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

Parameter
Name Description
operation google::longrunning::Operation const &
Returns
Type Description
future< StatusOr< google::spanner::admin::database::v1::Backup > >

virtual GetBackup(google::spanner::admin::database::v1::GetBackupRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::GetBackupRequest const &
Returns
Type Description
StatusOr< google::spanner::admin::database::v1::Backup >

virtual UpdateBackup(google::spanner::admin::database::v1::UpdateBackupRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::UpdateBackupRequest const &
Returns
Type Description
StatusOr< google::spanner::admin::database::v1::Backup >

virtual DeleteBackup(google::spanner::admin::database::v1::DeleteBackupRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::DeleteBackupRequest const &
Returns
Type Description
Status

virtual ListBackups(google::spanner::admin::database::v1::ListBackupsRequest)

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

Parameter
Name Description
request google::spanner::admin::database::v1::ListBackupsRequest
Returns
Type Description
StreamRange< google::spanner::admin::database::v1::Backup >

virtual RestoreDatabase(google::longrunning::Operation const &)

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

Parameter
Name Description
operation google::longrunning::Operation const &
Returns
Type Description
future< StatusOr< google::spanner::admin::database::v1::Database > >

virtual ListDatabaseOperations(google::spanner::admin::database::v1::ListDatabaseOperationsRequest)

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

Parameter
Name Description
request google::spanner::admin::database::v1::ListDatabaseOperationsRequest
Returns
Type Description
StreamRange< google::longrunning::Operation >

virtual ListBackupOperations(google::spanner::admin::database::v1::ListBackupOperationsRequest)

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

Parameter
Name Description
request google::spanner::admin::database::v1::ListBackupOperationsRequest
Returns
Type Description
StreamRange< google::longrunning::Operation >

virtual ListDatabaseRoles(google::spanner::admin::database::v1::ListDatabaseRolesRequest)

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

Parameter
Name Description
request google::spanner::admin::database::v1::ListDatabaseRolesRequest
Returns
Type Description
StreamRange< google::spanner::admin::database::v1::DatabaseRole >

virtual CreateBackupSchedule(google::spanner::admin::database::v1::CreateBackupScheduleRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::CreateBackupScheduleRequest const &
Returns
Type Description
StatusOr< google::spanner::admin::database::v1::BackupSchedule >

virtual GetBackupSchedule(google::spanner::admin::database::v1::GetBackupScheduleRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::GetBackupScheduleRequest const &
Returns
Type Description
StatusOr< google::spanner::admin::database::v1::BackupSchedule >

virtual UpdateBackupSchedule(google::spanner::admin::database::v1::UpdateBackupScheduleRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::UpdateBackupScheduleRequest const &
Returns
Type Description
StatusOr< google::spanner::admin::database::v1::BackupSchedule >

virtual DeleteBackupSchedule(google::spanner::admin::database::v1::DeleteBackupScheduleRequest const &)

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

Parameter
Name Description
request google::spanner::admin::database::v1::DeleteBackupScheduleRequest const &
Returns
Type Description
Status

virtual ListBackupSchedules(google::spanner::admin::database::v1::ListBackupSchedulesRequest)

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

Parameter
Name Description
request google::spanner::admin::database::v1::ListBackupSchedulesRequest
Returns
Type Description
StreamRange< google::spanner::admin::database::v1::BackupSchedule >

virtual ListOperations(google::longrunning::ListOperationsRequest)

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

Parameter
Name Description
request google::longrunning::ListOperationsRequest
Returns
Type Description
StreamRange< google::longrunning::Operation >

virtual GetOperation(google::longrunning::GetOperationRequest const &)

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

Parameter
Name Description
request google::longrunning::GetOperationRequest const &
Returns
Type Description
StatusOr< google::longrunning::Operation >

virtual DeleteOperation(google::longrunning::DeleteOperationRequest const &)

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

Parameter
Name Description
request google::longrunning::DeleteOperationRequest const &
Returns
Type Description
Status

virtual CancelOperation(google::longrunning::CancelOperationRequest const &)

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

Parameter
Name Description
request google::longrunning::CancelOperationRequest const &
Returns
Type Description
Status