sru_z3950: relays facetList in otherInfo, additional info
[metaproxy-moved-to-github.git] / src / test_filter_rewrite.cpp
index 68acc0f..1f86a98 100644 (file)
@@ -43,7 +43,6 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
 {
     try
     {
-        std::cout << "Running non-xml config test case" << std::endl;
         mp::RouterChain router;
         mp::filter::HttpRewrite fhr;
 
@@ -68,9 +67,11 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
             " </request>\n"
             " <response verbose=\"1\">\n"
             "  <rule name=\"null\"/>\n"
+            "  <rule name=\"cx\">\n"
+            "     <rewrite from='^cx' to='cy'/>\n"
+            "  </rule>\n"
             "  <rule name=\"url\">\n"
             "     <rewrite from='foo' to='bar'/>\n"
-            "     <rewrite from='^cx' to='cy'/>\n"
             "     <rewrite from='"
     "(?&lt;proto>https?://)(?&lt;host>[^/?# &quot;&apos;>]+)/(?&lt;path>[^  &quot;&apos;>]+)'\n"
             "            to='${proto}${pxhost}/${pxpath}/${host}/${path}' />\n"
@@ -82,7 +83,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
             "    <within tag=\"body\" attr=\"background\" rule=\"null\"/>\n"
             "    <within tag=\"script\" attr=\"#text\" type=\"quoted-literal\" rule=\"url\"/>\n"
             "    <within tag=\"style\" attr=\"#text\" rule=\"url\"/>\n"
-            "    <within attr=\"href|src\" rule=\"url\"/>\n"
+            "    <within attr=\"href|src\" rule=\"url,cx\"/>\n"
             "    <within attr=\"onclick\" type=\"quoted-literal\" rule=\"url\"/>\n"
             "  </content>\n"
             "  <content type=\"quoted-literal\" mime=\".*javascript\">\n"
@@ -128,6 +129,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
             "</style>"
             "</head>"
             "<script>var jslink=\"http://targetsite/webservice.xml\";"
+            "for (i = 0; i<foo; i++) ;\n"
             "var some=\"foo\"; foo=1;"
             "</script>"
             "<body>"
@@ -144,7 +146,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
 
         const char *resp_expected =
             "HTTP/1.1 200 OK\r\n"
-            "Content-Length: 605\r\n"
+            "Content-Length: 631\r\n"
             "Content-Type: text/html\r\n"
             "Link: <http://proxyhost/proxypath/targetsite/file.xml>; rel=absolute\r\n"
             "Link: </dir/file.xml>; rel=relative\r\n"
@@ -157,6 +159,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
             "</style>"
             "</head>"
             "<script>var jslink=\"http://proxyhost/proxypath/targetsite/webservice.xml\";"
+            "for (i = 0; i<foo; i++) ;\n"
             "var some=\"bar\"; foo=1;"
             "</script>"
             "<body>"
@@ -208,7 +211,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
             {
                 //compare buffers
                 std::cout << "Expected result:\n" << resp_expected << "\n";
-                std::cout << "Got result:\n" << "\n";
+                std::cout << "Got result:\n";
                 fflush(stdout);
                 fwrite(resp_result, 1, resp_result_len, stdout);
                 fflush(stdout);
@@ -224,12 +227,10 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_1 )
     }
 }
 
-
 BOOST_AUTO_TEST_CASE( test_filter_rewrite_2 )
 {
     try
     {
-        std::cout << "Running non-xml config test case" << std::endl;
         mp::RouterChain router;
         mp::filter::HttpRewrite fhr;
 
@@ -355,7 +356,7 @@ BOOST_AUTO_TEST_CASE( test_filter_rewrite_2 )
             {
                 //compare buffers
                 std::cout << "Expected result:\n" << resp_expected << "\n";
-                std::cout << "Got result:\n" << "\n";
+                std::cout << "Got result:\n";
                 fflush(stdout);
                 fwrite(resp_result, 1, resp_result_len, stdout);
                 fflush(stdout);