本文整理汇总了C++中MockClient类的典型用法代码示例。如果您正苦于以下问题:C++ MockClient类的具体用法?C++ MockClient怎么用?C++ MockClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MockClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
CmdLine clp;
parse_cmd_line(argc, argv, clp);
TBSYS_LOGGER.rotateLog("multi_write.log");
TBSYS_LOGGER.setFileName("multi_write.log");
TBSYS_LOGGER.setLogLevel("info");
clp.log_all();
ob_init_memory_pool();
ObSchemaManager schema_mgr;
if (NULL != clp.schema_file)
{
tbsys::CConfig config;
if (!schema_mgr.parse_from_file(clp.schema_file, config))
{
TBSYS_LOG(WARN, "parse schema fail");
exit(-1);
}
}
else if (OB_SUCCESS != fetch_schema(clp.root_addr, clp.root_port, schema_mgr))
{
TBSYS_LOG(WARN, "fetch schema fail");
exit(-1);
}
schema_mgr.print_info();
MutatorBuilder mb;
mb.init(schema_mgr,
clp.prefix_start, clp.suffix_length,
clp.merge_addr, clp.merge_port, clp.table_start_version,
clp.max_cell, clp.max_row, clp.max_suffix);
if (OB_SUCCESS != mb.init_prefix_end(clp.prefix_end))
{
TBSYS_LOG(WARN, "init prerfix end fail");
exit(-1);
}
ObServer dst_host;
dst_host.set_ipv4_addr(clp.serv_addr, clp.serv_port);
MockClient client;
client.init(dst_host);
for (int64_t i = 0; i < clp.mutator_num; i++)
{
ObMutator mutator;
PageArena<char> allocer;
int ret = OB_SUCCESS;
if (OB_SUCCESS != (ret = mb.build_mutator(mutator, allocer, clp.using_id)))
{
TBSYS_LOG(WARN, "build_mutator fail ret=%d\n", ret);
break;
}
int64_t timeu = tbsys::CTimeUtil::getTime();
ret = client.ups_apply(mutator, TIMEOUT_MS);
TBSYS_LOG(INFO, "apply ret=%d timeu=%ld\n", ret, tbsys::CTimeUtil::getTime() - timeu);
}
client.destroy();
}
示例2: fetch_schema
int fetch_schema(const char *root_addr, const int32_t root_port, ObSchemaManager &schema_mgr)
{
int ret = OB_SUCCESS;
ObServer dst_host;
dst_host.set_ipv4_addr(root_addr, root_port);
MockClient client;
client.init(dst_host);
ret = client.fetch_schema(0, schema_mgr, TIMEOUT_MS);
client.destroy();
return ret;
}
示例3: deco
void DecorationTest::testSection()
{
MockBridge bridge;
auto decoSettings = QSharedPointer<KDecoration2::DecorationSettings>::create(&bridge);
MockDecoration deco(&bridge);
deco.setSettings(decoSettings);
MockSettings *settings = bridge.lastCreatedSettings();
settings->setLargeSpacing(0);
MockClient *client = bridge.lastCreatedClient();
client->setWidth(100);
client->setHeight(100);
QCOMPARE(deco.size(), QSize(100, 100));
QCOMPARE(deco.borderLeft(), 0);
QCOMPARE(deco.borderTop(), 0);
QCOMPARE(deco.borderRight(), 0);
QCOMPARE(deco.borderBottom(), 0);
QCOMPARE(deco.titleBar(), QRect());
QCOMPARE(deco.sectionUnderMouse(), Qt::NoSection);
QFETCH(QRect, titleBar);
QFETCH(QMargins, margins);
deco.setBorders(margins);
QCOMPARE(deco.borderLeft(), margins.left());
QCOMPARE(deco.borderTop(), margins.top());
QCOMPARE(deco.borderRight(), margins.right());
QCOMPARE(deco.borderBottom(), margins.bottom());
deco.setTitleBar(titleBar);
QCOMPARE(deco.titleBar(), titleBar);
QCOMPARE(deco.size(), QSize(100 + deco.borderLeft() + deco.borderRight(), 100 + deco.borderTop() + deco.borderBottom()));
QSignalSpy spy(&deco, SIGNAL(sectionUnderMouseChanged(Qt::WindowFrameSection)));
QVERIFY(spy.isValid());
QFETCH(QPoint, pos);
QHoverEvent event(QEvent::HoverMove, QPointF(pos), QPointF(pos));
QCoreApplication::sendEvent(&deco, &event);
QFETCH(Qt::WindowFrameSection, expected);
QCOMPARE(deco.sectionUnderMouse(), expected);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().first().value<Qt::WindowFrameSection>(), expected);
QHoverEvent event2(QEvent::HoverMove, QPointF(50, 50), QPointF(50, 50));
QCoreApplication::sendEvent(&deco, &event2);
QCOMPARE(deco.sectionUnderMouse(), Qt::NoSection);
QCOMPARE(spy.count(), 2);
QCOMPARE(spy.first().first().value<Qt::WindowFrameSection>(), expected);
QCOMPARE(spy.last().first().value<Qt::WindowFrameSection>(), Qt::NoSection);
}
示例4: total_scan
void total_scan(const char *fname, PageArena<char> &allocer, MockClient &client, const char *version_range)
{
ObScanner scanner;
ObScanParam scan_param;
read_scan_param(fname, SCAN_PARAM_SECTION, allocer, scan_param);
scan_param.set_version_range(str2range(version_range));
scan_param.set_is_read_consistency(false);
int64_t total_fullfilled_num = 0;
int64_t total_row_counter = 0;
int64_t total_timeu = 0;
while (true)
{
int64_t timeu = tbsys::CTimeUtil::getTime();
int err = client.ups_scan(scan_param, scanner, timeout);
timeu = tbsys::CTimeUtil::getTime() - timeu;
if (OB_SUCCESS != err)
{
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
break;
}
else
{
int64_t row_counter = 0;
while (OB_SUCCESS == scanner.next_cell())
{
ObCellInfo *ci = NULL;
bool is_row_changed = false;
scanner.get_cell(&ci, &is_row_changed);
//fprintf(stdout, "%s\n", updateserver::print_cellinfo(ci, "CLI_SCAN"));
if (is_row_changed)
{
row_counter++;
}
}
bool is_fullfilled = false;
int64_t fullfilled_num = 0;
ObRowkey last_rk;
scanner.get_last_row_key(last_rk);
scanner.get_is_req_fullfilled(is_fullfilled, fullfilled_num);
fprintf(stdout, "[SINGLE_SCAN] is_fullfilled=%s fullfilled_num=%ld row_counter=%ld timeu=%ld last_row_key=[%s]\n",
STR_BOOL(is_fullfilled), fullfilled_num, row_counter, timeu, to_cstring(last_rk));
total_fullfilled_num += fullfilled_num;
total_row_counter += row_counter;
total_timeu += timeu;
if (is_fullfilled)
{
break;
}
else
{
const_cast<ObNewRange*>(scan_param.get_range())->start_key_ = last_rk;
const_cast<ObNewRange*>(scan_param.get_range())->border_flag_.unset_min_value();
const_cast<ObNewRange*>(scan_param.get_range())->border_flag_.unset_inclusive_start();
}
}
}
fprintf(stdout, "[TOTAL_SCAN] total_fullfilled_num=%ld total_row_counter=%ld total_timeu=%ld\n",
total_fullfilled_num, total_row_counter, total_timeu);
}
示例5: apply
void apply(const char *fname, PageArena<char> &allocer, MockClient &client)
{
ObMutator mutator;
ObMutator result;
read_cell_infos(fname, CELL_INFOS_SECTION, allocer, mutator, result);
int err = client.ups_apply(mutator, timeout);
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
}
示例6: major_load_bypass
int major_load_bypass(MockClient &client)
{
int64_t loaded_num = 0;
int err = client.major_load_bypass(loaded_num, timeout);
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
fprintf(stdout, "loaded_num=%ld\n", loaded_num);
return err;
}
示例7: get_clog_master
void get_clog_master(MockClient &client)
{
ObServer server;
int err = client.get_clog_master(server, timeout);
char addr[256];
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
server.to_string(addr, sizeof(addr));
fprintf(stdout, "%s\n", addr);
}
示例8: dump_memtable
void dump_memtable(const char *dump_dir, MockClient &client)
{
if (NULL == dump_dir)
{
dump_dir = "/tmp";
}
int err = client.dump_memtable(dump_dir, timeout);
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
fprintf(stdout, "dump dest=[%s]\n", dump_dir);
}
示例9: reload_conf
void reload_conf(const char* fname, MockClient &client)
{
if (NULL == fname)
{
fname = "./default.conf";
}
int err = client.reload_conf(fname, timeout);
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
fprintf(stdout, "relaod fname=[%s]\n", fname);
}
示例10: get_last_frozen_version
void get_last_frozen_version(MockClient &client)
{
int64_t version = 0;
int err = client.get_last_frozen_version(version, timeout);
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
if (OB_SUCCESS == err)
{
fprintf(stdout, "last_frozen_version=%ld\n", version);
}
}
示例11: fetch_ups_stat_info
void fetch_ups_stat_info(MockClient &client)
{
oceanbase::updateserver::UpsStatMgr stat_mgr;
int err = client.fetch_ups_stat_info(stat_mgr, timeout);
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
if (OB_SUCCESS == err)
{
stat_mgr.print_info();
}
}
示例12: execute_sql
int execute_sql(MockClient &client, const char* sql_query)
{
int ret = OB_SUCCESS;
ObString query;
query.assign_ptr(const_cast<char*>(sql_query), static_cast<int32_t>(strlen(sql_query)));
printf("execute_sql, query=[%.*s]...\n", query.length(), query.ptr());
ret = client.execute_sql(query, timeout);
printf("ret=%d\n", ret);
return ret;
}
示例13: switch_commit_log
void switch_commit_log(MockClient &client)
{
uint64_t new_log_file_id = 0;
int err = client.switch_commit_log(new_log_file_id, timeout);
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
if (OB_SUCCESS == err)
{
fprintf(stdout, "new_log_file_id=%lu\n", new_log_file_id);
}
}
示例14: get_table_time_stamp
void get_table_time_stamp(MockClient &client, const uint64_t major_version)
{
int64_t time_stamp = 0;
int err = client.get_table_time_stamp(major_version, time_stamp, timeout);
fprintf(stdout, "[%s] err=%d\n", __FUNCTION__, err);
if (OB_SUCCESS == err)
{
fprintf(stdout, "major_version=%lu time_stamp=%ld %s\n", major_version, time_stamp, time2str(time_stamp));
}
}
示例15: get_check_row
bool get_check_row(const ObSchema &schema, const ObString &row_key, CellinfoBuilder &cb,
MockClient &client, const int64_t table_start_version, const bool using_id)
{
bool bret = false;
ObGetParam get_param;
const ObColumnSchema *iter = NULL;
for (iter = schema.column_begin(); iter != schema.column_end(); iter++)
{
ObCellInfo ci;
ci.row_key_ = row_key;
if (using_id)
{
ci.table_id_ = schema.get_table_id();
ci.column_id_ = iter->get_id();
}
else
{
ci.table_name_.assign_ptr(const_cast<char*>(schema.get_table_name()), strlen(schema.get_table_name()));
ci.column_name_.assign_ptr(const_cast<char*>(iter->get_name()), strlen(iter->get_name()));
}
get_param.add_cell(ci);
}
ObVersionRange version_range;
version_range.start_version_ = table_start_version;
version_range.border_flag_.set_max_value();
version_range.border_flag_.set_inclusive_start();
get_param.set_version_range(version_range);
ObScanner scanner;
int ret = client.ups_get(get_param, scanner, TIMEOUT_MS);
if (OB_SUCCESS == ret)
{
RowChecker rc;
while (OB_SUCCESS == scanner.next_cell())
{
ObCellInfo *ci = NULL;
if (OB_SUCCESS == scanner.get_cell(&ci))
{
if (!using_id)
{
trans_name2id(*ci, schema);
}
rc.add_cell(ci);
}
}
bret = rc.check_row(cb, schema);
}
else
{
TBSYS_LOG(WARN, "get ret=%d", ret);
}
return bret;
return true;
}