You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/08/15 15:20:32 UTC

svn commit: r566141 - in /activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net: URITest.cpp URITest.h

Author: tabish
Date: Wed Aug 15 06:20:31 2007
New Revision: 566141

URL: http://svn.apache.org/viewvc?view=rev&rev=566141
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Adding start of URI class

Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h

Modified: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp?view=diff&rev=566141&r1=566140&r2=566141
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.cpp Wed Aug 15 06:20:31 2007
@@ -30,6 +30,127 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void URITest::test() {
+void URITest::test_Constructor_String() {
 
+//    const std::string constructorTests[27] = {
+//        "http://user@www.google.com:45/search?q=helpinfo#somefragment",
+//        // http with authority, query and fragment
+//        "ftp://ftp.is.co.za/rfc/rfc1808.txt", // ftp
+//        "gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles",
+//        // gopher
+//        "mailto:mduerst@ifi.unizh.ch", // mailto
+//        "news:comp.infosystems.www.servers.unix", // news
+//        "telnet://melvyl.ucop.edu/", // telnet
+//        "http://123.24.17.98/test", // IPv4 authority
+//        "http://www.google.com:80/test",// domain name authority
+//        "http://joe@[3ffe:2a00:100:7031::1]:80/test",
+//        // IPv6 authority, with userinfo and port
+//        "/relative", // relative starting with /
+//        "//relative", // relative starting with //
+//        "relative", // relative with no /
+//        "#fragment",// relative just with fragment
+//        "http://user@host:80", // UI, host,port
+//        "http://user@host", // ui, host
+//        "http://host", // host
+//        "http://host:80", // host,port
+//        "http://joe@:80", // ui, port (becomes registry-based)
+//        "file:///foo/bar", // empty authority, non empty path
+//        "ht?tp://hoe@host:80", // miscellaneous tests
+//        "mai/lto:hey?joe#man", "http://host/a%20path#frag",
+//        // path with an escaped octet for space char
+//        "http://host/a%E2%82%ACpath#frag",
+//        // path with escaped octet for unicode char, not USASCII
+//        "http://host/a\u20ACpath#frag",
+//        // path with unicode char, not USASCII equivalent to
+//        // = "http://host/a\u0080path#frag",
+//        "http://host%20name/", // escaped octets in host (becomes
+//        // registry based)
+//        "http://host\u00DFname/", // unicodechar in host (becomes
+//        // registry based)
+//        // equivalent to = "http://host\u00dfname/",
+//        "ht123-+tp://www.google.com:80/test", // legal chars in scheme
+//    };
+//
+//    for( int i = 0; i < 27; i++ ) {
+//        try {
+//            new URI(constructorTests[i]);
+//        } catch ( URISyntaxException e ) {
+//            CPPUNIT_FAIL( string( "Failed to construct URI for: " ) +
+//                          constructorTests[i] + " : " +
+//                          e.getMessage() );
+//        }
+//    }
+
+    std::vector<const char*> constructorTestsInvalid;
+    // space char in path, not in escaped
+    constructorTestsInvalid.push_back( "http:///a path#frag" );
+    // octet form, with no host
+    constructorTestsInvalid.push_back( "http://host/a[path#frag" );
+    // an illegal char, not in escaped octet form, should throw an exception
+    // invalid escape sequence in path
+    constructorTestsInvalid.push_back( "http://host/a%path#frag" );
+    // incomplete escape sequence in path
+    constructorTestsInvalid.push_back( "http://host/a%#frag" );
+    // space char in fragment, not in
+    constructorTestsInvalid.push_back( "http://host#a frag" );
+    // escaped octet form, no path
+    // illegal char in fragment
+    constructorTestsInvalid.push_back( "http://host/a#fr#ag" );
+    // invalid escape sequence in fragment,
+    constructorTestsInvalid.push_back( "http:///path#fr%ag" );
+    // with no host
+    // incomplete escape sequence in fragment
+    constructorTestsInvalid.push_back( "http://host/path#frag%" );
+    // space char in query, not in escaped octet form
+    constructorTestsInvalid.push_back( "http://host/path?a query#frag" );
+    // invalid escape sequence in query, no path
+    constructorTestsInvalid.push_back( "http://host?query%ag" );
+    // incomplete escape sequence in query, with no host
+    constructorTestsInvalid.push_back( "http:///path?query%" );
+    // invalid char in scheme specific part
+    constructorTestsInvalid.push_back( "mailto:user^name@fklkf.com"  );
+
+//    for( size_t i = 0; i < constructorTestsInvalid.size(); i++ ) {
+//        try {
+//            new URI( constructorTestsInvalid[i] );
+//            CPPUNIT_FAIL( string( "Failed to throw URISyntaxException for: " ) +
+//                          constructorTestsInvalid[i] );
+//        } catch( URISyntaxException e ) {}
+//    }
+
+//    std::string invalid2[18] = {
+//        // authority validation
+//        "http://user@[3ffe:2x00:100:7031::1]:80/test", // malformed
+//        // IPv6 authority
+//        "http://[ipv6address]/apath#frag", // malformed ipv6 address
+//        "http://[ipv6address/apath#frag", // malformed ipv6 address
+//        "http://ipv6address]/apath#frag", // illegal char in host name
+//        "http://ipv6[address/apath#frag",
+//        "http://ipv6addr]ess/apath#frag",
+//        "http://ipv6address[]/apath#frag",
+//        // illegal char in username...
+//        "http://us[]er@host/path?query#frag", "http://host name/path", // illegal
+//        // char
+//        // in
+//        // authority
+//        "http://host^name#fragment", // illegal char in authority
+//        "telnet://us er@hostname/", // illegal char in authority
+//        // missing components
+//        "//", // Authority expected
+//        "ascheme://", // Authority expected
+//        "ascheme:", // Scheme-specific part expected
+//        // scheme validation
+//        "a scheme://reg/", // illegal char
+//        "1scheme://reg/", // non alpha char as 1st char
+//        "asche\u00dfme:ssp", // unicode char , not USASCII
+//        "asc%20heme:ssp" // escape octets
+//    };
+//
+//    for( int i = 0; i < 18; i++ ) {
+//        try {
+//            new URI( invalid2[i] );
+//            CPPUNIT_FAIL(
+//                string( "Failed to throw URISyntaxException for: " ) + invalid2[i] );
+//        } catch( URISyntaxException e ) {}
+//    }
 }

Modified: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h?view=diff&rev=566141&r1=566140&r2=566141
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/net/URITest.h Wed Aug 15 06:20:31 2007
@@ -27,7 +27,7 @@
     class URITest : public CppUnit::TestFixture {
 
         CPPUNIT_TEST_SUITE( URITest );
-        CPPUNIT_TEST( test );
+        CPPUNIT_TEST( test_Constructor_String );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -35,7 +35,7 @@
         URITest();
         virtual ~URITest() {}
 
-        void test();
+        void test_Constructor_String();
 
     };