Class MockDataConnection (2.21.0)

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

See Mocking the Cloud Bigtable C++ Client with Google Mock for a complete example that mocks Table calls.

Constructors

MockDataConnection()

Functions

virtual options()

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

Returns
TypeDescription
Options

virtual Apply(std::string const &, SingleRowMutation)

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

Parameters
NameDescription
table_name std::string const &
mut SingleRowMutation
Returns
TypeDescription
Status

virtual AsyncApply(std::string const &, SingleRowMutation)

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

Parameters
NameDescription
table_name std::string const &
mut SingleRowMutation
Returns
TypeDescription
future< Status >

virtual BulkApply(std::string const &, BulkMutation)

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

Parameters
NameDescription
table_name std::string const &
mut BulkMutation
Returns
TypeDescription
std::vector< FailedMutation >

virtual AsyncBulkApply(std::string const &, BulkMutation)

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

Parameters
NameDescription
table_name std::string const &
mut BulkMutation
Returns
TypeDescription
future< std::vector< FailedMutation > >

virtual ReadRows(std::string const &, RowSet, std::int64_t, Filter)

Prefer to use ReadRowsFull() in mocks.

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

Parameters
NameDescription
table_name std::string const &
row_set RowSet
rows_limit std::int64_t
filter Filter
Returns
TypeDescription
RowReader

virtual ReadRowsFull(ReadRowsParams)

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

Parameter
NameDescription
params ReadRowsParams
Returns
TypeDescription
RowReader

virtual ReadRow(std::string const &, std::string, Filter)

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

Parameters
NameDescription
table_name std::string const &
row_key std::string
filter Filter
Returns
TypeDescription
StatusOr< std::pair< bool, Row > >

virtual CheckAndMutateRow(std::string const &, std::string, Filter, std::vector< Mutation >, std::vector< Mutation >)

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

Parameters
NameDescription
table_name std::string const &
row_key std::string
filter Filter
true_mutations std::vector< Mutation >
false_mutations std::vector< Mutation >
Returns
TypeDescription
StatusOr< MutationBranch >

virtual AsyncCheckAndMutateRow(std::string const &, std::string, Filter, std::vector< Mutation >, std::vector< Mutation >)

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

Parameters
NameDescription
table_name std::string const &
row_key std::string
filter Filter
true_mutations std::vector< Mutation >
false_mutations std::vector< Mutation >
Returns
TypeDescription
future< StatusOr< MutationBranch > >

virtual SampleRows(std::string const &)

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

Parameter
NameDescription
table_name std::string const &
Returns
TypeDescription
StatusOr< std::vector< RowKeySample > >

virtual AsyncSampleRows(std::string const &)

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

Parameter
NameDescription
table_name std::string const &
Returns
TypeDescription
future< StatusOr< std::vector< RowKeySample > > >

virtual ReadModifyWriteRow(google::bigtable::v2::ReadModifyWriteRowRequest)

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

Parameter
NameDescription
request google::bigtable::v2::ReadModifyWriteRowRequest
Returns
TypeDescription
StatusOr< Row >

virtual AsyncReadModifyWriteRow(google::bigtable::v2::ReadModifyWriteRowRequest)

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

Parameter
NameDescription
request google::bigtable::v2::ReadModifyWriteRowRequest
Returns
TypeDescription
future< StatusOr< Row > >

virtual AsyncReadRows(std::string const &, std::function< future< bool >(Row)>, std::function< void(Status)>, RowSet, std::int64_t, Filter)

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

Parameters
NameDescription
table_name std::string const &
on_row std::function< future< bool >(Row)>
on_finish std::function< void(Status)>
row_set RowSet
rows_limit std::int64_t
filter Filter
Returns
TypeDescription
void

virtual AsyncReadRow(std::string const &, std::string, Filter)

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

Parameters
NameDescription
table_name std::string const &
row_key std::string
filter Filter
Returns
TypeDescription
future< StatusOr< std::pair< bool, Row > > >