X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftest_filter_rewrite.cpp;h=65cb4c08fd140425d27b20e258c2f62debea150e;hb=167d92e5c6533c592b5a204b638a606ff6e2b428;hp=b16768f11f9bd832145772db7801cda08792984e;hpb=917e40f8768670e2c6da49e9d44ca92f01ea52ac;p=metaproxy-moved-to-github.git diff --git a/src/test_filter_rewrite.cpp b/src/test_filter_rewrite.cpp index b16768f..65cb4c0 100644 --- a/src/test_filter_rewrite.cpp +++ b/src/test_filter_rewrite.cpp @@ -42,14 +42,14 @@ namespace mp = metaproxy_1; * The global testconfig is commented out, as it won't even compile * on old Centos5 machines struct TestConfig { - TestConfig() + TestConfig() { - std::cout << "global setup\n"; + std::cout << "global setup\n"; yaz_log_init_level(YLOG_ALL); } - ~TestConfig() - { - std::cout << "global teardown\n"; + ~TestConfig() + { + std::cout << "global teardown\n"; } }; @@ -63,12 +63,13 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) std::cout << "Running non-xml config test case" << std::endl; mp::RouterChain router; mp::filter::HttpRewrite fhr; - + std::string xmlconf = "\n" "\n" " \n" + " \n" " \n" " \n" " \n" - " \n" + " \n" + " \n" " \n" " \n" + " \n" " \n" " \n" + " to='${proto}${pxhost}/${pxpath}/${host}/${path}' />\n" " \n" - " \n" - " \n" + " \n" + " \n" + " \n" + " \n" " \n" "\n" ; @@ -99,14 +104,14 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) xmlNode *root_element = xmlDocGetRootElement(doc); fhr.configure(root_element, true, ""); xmlFreeDoc(doc); - + router.append(fhr); // create an http request mp::Package pack; mp::odr odr; - Z_GDU *gdu_req = z_get_HTTP_Request_uri(odr, + Z_GDU *gdu_req = z_get_HTTP_Request_uri(odr, "http://proxyhost/proxypath/targetsite/page1.html", 0, 1); pack.request() = gdu_req; @@ -133,14 +138,14 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) "xified" "" " An absolute link" - "" + "" " Another abs link" - "" + "" ""; int r; @@ -184,7 +189,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) Z_GDU *gdu_res_rew = pack.response().get(); BOOST_CHECK(gdu_res_rew); BOOST_CHECK_EQUAL(gdu_res_rew->which, Z_GDU_HTTP_Response); - + Z_HTTP_Response *hres = gdu_res_rew->u.HTTP_Response; BOOST_CHECK(hres); @@ -196,13 +201,15 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 ) char *resp_result; int resp_result_len; resp_result = odr_getbuf(enc, &resp_result_len, 0); - + BOOST_CHECK(resp_result); BOOST_CHECK_EQUAL((size_t) resp_result_len, strlen(resp_expected)); std::cout << "Rewritten result:\n" << std::endl; + fflush(stdout); fwrite(resp_result, 1, resp_result_len, stdout); - std::cout << "\nRewritten result buf len: " << resp_result_len + fflush(stdout); + std::cout << "\nRewritten result buf len: " << resp_result_len << std::endl; BOOST_CHECK(memcmp(resp_result, resp_expected, resp_result_len) == 0);