X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ftest_filter_rewrite.cpp;h=7df4d0b05c0d41f2e3d02f8f2283fcc41d5eae1f;hb=577119fc1080b77c58b08db6d6c0114398494a33;hp=cb9c47ce1f4d9ca3d8134dc8f03f454919129bef;hpb=fe8ab21a7dfdd452298ec356395b2956c25d18fa;p=metaproxy-moved-to-github.git
diff --git a/src/test_filter_rewrite.cpp b/src/test_filter_rewrite.cpp
index cb9c47c..7df4d0b 100644
--- a/src/test_filter_rewrite.cpp
+++ b/src/test_filter_rewrite.cpp
@@ -38,20 +38,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
using namespace boost::unit_test;
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";
}
};
BOOST_GLOBAL_FIXTURE( TestConfig );
+*/
BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
{
@@ -60,23 +63,36 @@ 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"
- " https?://)(?<pxhost>[^ /?#]+)/(?<pxpath>[^ /]+)"
"/(?<host>[^ /]+)(?<path>[^ ]*)'\n"
" to='${proto}${host}${path}' />\n"
- " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
" \n"
- " \n"
- " https?://)(?<host>[^/?# "'>]+)/(?<path>[^ "'>]+)'\n"
- " to='${proto}${pxhost}/${pxpath}/${host}/${path}' />\n"
+ " to='${proto}${pxhost}/${pxpath}/${host}/${path}' />\n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
+ " \n"
" \n"
"\n"
;
@@ -89,14 +105,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;
@@ -123,14 +139,14 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
"xified"
""
" An absolute link"
- ""
+ ""
" Another abs link"
- ""
+ ""
"