From a9f3821d99828297ccd1eee67216af3d55aa5ab8 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Sun, 14 Jul 2013 11:02:59 -0500 Subject: [PATCH] rename echo_client to testee client to better reflect its role --- SConstruct | 42 +++---------------- .../CMakeLists.txt | 2 +- .../{echo_client => testee_client}/SConscript | 6 +-- .../testee_client.cpp} | 30 ++++++------- 4 files changed, 26 insertions(+), 54 deletions(-) rename examples/{echo_client => testee_client}/CMakeLists.txt (85%) rename examples/{echo_client => testee_client}/SConscript (70%) rename examples/{echo_client/echo_client.cpp => testee_client/testee_client.cpp} (71%) diff --git a/SConstruct b/SConstruct index b84d00395..3a82ab9b7 100644 --- a/SConstruct +++ b/SConstruct @@ -203,21 +203,21 @@ if not env['PLATFORM'].startswith('win'): # Main test application #main = SConscript('#/examples/dev/SConscript',variant_dir = builddir + 'dev',duplicate = 0) -# testee_server -testee_server = SConscript('#/examples/testee_server/SConscript',variant_dir = builddir + 'testee_server',duplicate = 0) - # echo_server echo_server = SConscript('#/examples/echo_server/SConscript',variant_dir = builddir + 'echo_server',duplicate = 0) # echo_server_tls -if not env['PLATFORM'].startswith('win'): +if tls_build: echo_server_tls = SConscript('#/examples/echo_server_tls/SConscript',variant_dir = builddir + 'echo_server_tls',duplicate = 0) # broadcast_server broadcast_server = SConscript('#/examples/broadcast_server/SConscript',variant_dir = builddir + 'broadcast_server',duplicate = 0) -# echo_client -echo_client = SConscript('#/examples/echo_client/SConscript',variant_dir = builddir + 'echo_client',duplicate = 0) +# testee_server +testee_server = SConscript('#/examples/testee_server/SConscript',variant_dir = builddir + 'testee_server',duplicate = 0) + +# testee_client +testee_client = SConscript('#/examples/testee_client/SConscript',variant_dir = builddir + 'testee_client',duplicate = 0) # utility_client utility_client = SConscript('#/examples/utility_client/SConscript',variant_dir = builddir + 'utility_client',duplicate = 0) @@ -234,33 +234,3 @@ if not env['PLATFORM'].startswith('win'): # print_server print_server = SConscript('#/examples/print_server/SConscript',variant_dir = builddir + 'print_server',duplicate = 0) - -# -#wsperf = SConscript('#/examples/wsperf/SConscript', -# variant_dir = builddir + 'wsperf', -# duplicate = 0) - -#echo_server = SConscript('#/examples/echo_server/SConscript', -# variant_dir = builddir + 'echo_server', -# duplicate = 0) - -#if tls_build: -# echo_server_tls = SConscript('#/examples/echo_server_tls/SConscript', -# variant_dir = builddir + 'echo_server_tls', -# duplicate = 0) - -#echo_client = SConscript('#/examples/echo_client/SConscript', -# variant_dir = builddir + 'echo_client', -# duplicate = 0) - -#chat_client = SConscript('#/examples/chat_client/SConscript', -# variant_dir = builddir + 'chat_client', -# duplicate = 0) - -#chat_server = SConscript('#/examples/chat_server/SConscript', -# variant_dir = builddir + 'chat_server', -# duplicate = 0) - -#concurrent_server = SConscript('#/examples/concurrent_server/SConscript', -# variant_dir = builddir + 'concurrent_server', -# duplicate = 0) diff --git a/examples/echo_client/CMakeLists.txt b/examples/testee_client/CMakeLists.txt similarity index 85% rename from examples/echo_client/CMakeLists.txt rename to examples/testee_client/CMakeLists.txt index a3d6d3b2e..da24203b1 100644 --- a/examples/echo_client/CMakeLists.txt +++ b/examples/testee_client/CMakeLists.txt @@ -2,7 +2,7 @@ file (GLOB SOURCE_FILES *.cpp) file (GLOB HEADER_FILES *.hpp) -init_target (echo_client) +init_target (testee_client) build_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES}) diff --git a/examples/echo_client/SConscript b/examples/testee_client/SConscript similarity index 70% rename from examples/echo_client/SConscript rename to examples/testee_client/SConscript index 82c2317ea..9547f3fc4 100644 --- a/examples/echo_client/SConscript +++ b/examples/testee_client/SConscript @@ -1,4 +1,4 @@ -## Main development example +## Autobahn test client example ## Import('env') @@ -15,9 +15,9 @@ prgs = [] # if a C++11 environment is available build using that, otherwise use boost if env_cpp11.has_key('WSPP_CPP11_ENABLED'): ALL_LIBS = boostlibs(['system'],env_cpp11) + [platform_libs] + [polyfill_libs] - prgs += env_cpp11.Program('echo_client', ["echo_client.cpp"], LIBS = ALL_LIBS) + prgs += env_cpp11.Program('testee_client', ["testee_client.cpp"], LIBS = ALL_LIBS) else: ALL_LIBS = boostlibs(['system','random'],env) + [platform_libs] + [polyfill_libs] - prgs += env.Program('echo_client', ["echo_client.cpp"], LIBS = ALL_LIBS) + prgs += env.Program('testee_client', ["testee_client.cpp"], LIBS = ALL_LIBS) Return('prgs') diff --git a/examples/echo_client/echo_client.cpp b/examples/testee_client/testee_client.cpp similarity index 71% rename from examples/echo_client/echo_client.cpp rename to examples/testee_client/testee_client.cpp index 3972977d4..6bdc70624 100644 --- a/examples/echo_client/echo_client.cpp +++ b/examples/testee_client/testee_client.cpp @@ -19,7 +19,8 @@ void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) { client::connection_ptr con = c->get_con_from_hdl(hdl); if (con->get_resource() == "/getCaseCount") { - std::cout << "Detected " << msg->get_payload() << " test cases." << std::endl; + std::cout << "Detected " << msg->get_payload() << " test cases." + << std::endl; case_count = atoi(msg->get_payload().c_str()); } else { c->send(hdl, msg->get_payload(), msg->get_opcode()); @@ -28,7 +29,7 @@ void on_message(client* c, websocketpp::connection_hdl hdl, message_ptr msg) { int main(int argc, char* argv[]) { // Create a server endpoint - client echo_client; + client c; std::string uri = "ws://localhost:9001"; @@ -38,36 +39,37 @@ int main(int argc, char* argv[]) { try { // We expect there to be a lot of errors, so suppress them - echo_client.clear_access_channels(websocketpp::log::alevel::all); - echo_client.clear_error_channels(websocketpp::log::elevel::all); + c.clear_access_channels(websocketpp::log::alevel::all); + c.clear_error_channels(websocketpp::log::elevel::all); // Initialize ASIO - echo_client.init_asio(); + c.init_asio(); // Register our handlers - echo_client.set_message_handler(bind(&on_message,&echo_client,::_1,::_2)); + c.set_message_handler(bind(&on_message,&c,::_1,::_2)); websocketpp::lib::error_code ec; - client::connection_ptr con = echo_client.get_connection(uri+"/getCaseCount", ec); - echo_client.connect(con); + client::connection_ptr con = c.get_connection(uri+"/getCaseCount", ec); + c.connect(con); // Start the ASIO io_service run loop - echo_client.run(); + c.run(); std::cout << "case count: " << case_count << std::endl; for (int i = 1; i <= case_count; i++) { - echo_client.reset(); + c.reset(); std::stringstream url; - url << uri << "/runCase?case=" << i << "&agent=" << websocketpp::user_agent; + url << uri << "/runCase?case=" << i << "&agent=" + << websocketpp::user_agent; - con = echo_client.get_connection(url.str(), ec); + con = c.get_connection(url.str(), ec); - echo_client.connect(con); + c.connect(con); - echo_client.run(); + c.run(); } std::cout << "done" << std::endl;