RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
soa/logger/testing/remote_logger_test2.cc
00001 /* endpoint_test.cc
00002    Jeremy Barnes, 31 January 2011
00003    Copyright (c) 2011 Datacratic.  All rights reserved.
00004 
00005    Tests for the endpoints.
00006 */
00007 
00008 #define BOOST_TEST_MAIN
00009 #define BOOST_TEST_DYN_LINK
00010 
00011 #include <boost/test/unit_test.hpp>
00012 #include "soa/logger/remote_input.h"
00013 #include "soa/logger/remote_output.h"
00014 #include <sys/socket.h>
00015 #include "jml/utils/guard.h"
00016 #include "jml/arch/exception_handler.h"
00017 #include "jml/utils/testing/watchdog.h"
00018 #include "jml/utils/testing/fd_exhauster.h"
00019 #include "jml/arch/timers.h"
00020 
00021 using namespace std;
00022 using namespace ML;
00023 using namespace Datacratic;
00024 
00025 
00026 BOOST_AUTO_TEST_CASE( test_remote_logger )
00027 {
00028     // We try to stream a whole stack of messages through and check that they all
00029     // get to the other end.
00030 
00031     RemoteInput input;
00032     input.listen(-1, "localhost");
00033     int port = input.port();
00034 
00035     cerr << "port = " << port << endl;
00036 
00037     RemoteOutput output;
00038     output.connect(port, "localhost");
00039 
00040     for (int i = 0;  i < 1000;  ++i) {
00041         output.logMessage("channelname", "blah blah this is another message");
00042         output.barrier();
00043     }
00044     
00045     //output.close();
00046 
00047     output.shutdown();
00048     input.shutdown();
00049 }
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator