RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
testing/historical_bid_request_test.cc
00001 /* historical_bid_request_test.cc
00002    Jeremy Barnes, 19 February 2013
00003    Copyright (c) 2013 Datacratic Inc.  All rights reserved.
00004 
00005    Test cases for the Historical bid request parser.
00006 */
00007 
00008 
00009 #define BOOST_TEST_MAIN
00010 #define BOOST_TEST_DYN_LINK
00011 
00012 #include <boost/test/unit_test.hpp>
00013 #include "rtbkit/common/bid_request.h"
00014 #include "soa/types/json_parsing.h"
00015 #include "jml/utils/filter_streams.h"
00016 
00017 using namespace std;
00018 using namespace ML;
00019 using namespace Datacratic;
00020 using namespace RTBKIT;
00021 
00022 string bidRequest = "{\"!!CV\":\"0.1\",\"exchange\":\"abcd\",\"id\":\"8b703eb9-5ebf-4001-15e8-10d6000003a0\",\"ipAddress\":\"76.aa.xx.yy\",\"language\":\"en\",\"location\":{\"cityName\":\"Grande Prairie\",\"countryCode\":\"CA\",\"dma\":0,\"postalCode\":\"0\",\"regionCode\":\"AB\",\"timezoneOffsetMinutes\":240},\"protocolVersion\":\"0.3\",\"provider\":\"xxx1\",\"segments\":{\"xxx1\":null},\"imp\":[{\"formats\":[\"160x600\"],\"id\":\"22202919\",\"position\":\"NONE\",\"reservePrice\":0}],\"timestamp\":1336313462.550589,\"url\":\"http://emedtv.com/search.html?searchString=\xe2\x80\xa2skin\",\"userAgent\":\"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)\",\"userIds\":{\"ag\":\"7d837be6-94de-11e1-841f-68b599c88614\",\"abcd\":\"PV08FEPS1KQAAGcrbUsAAABY\",\"prov\":\"7d837be6-94de-11e1-841f-68b599c88614\",\"xchg\":\"PV08FEPS1KQAAGcrbUsAAABY\"}}";
00023 
00024 BOOST_AUTO_TEST_CASE( test_parse_historical_bid_request )
00025 {
00026     std::unique_ptr<BidRequest> br(BidRequest::parse("rtbkit", bidRequest));
00027 
00028     BOOST_CHECK_EQUAL(br->url.toString(), "http://emedtv.com/search.html?searchString=%E2%80%A2skin");
00029     BOOST_CHECK_EQUAL(br->userAgent, "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");
00030     
00031 }
00032 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator