summaryrefslogtreecommitdiff
path: root/tools/qa/cppunit
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-04 10:13:17 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-04 13:28:14 +0200
commitfd32788092fcb29526ae73ae3bae6767dbb1e490 (patch)
tree0f0054d0f97983d79e9c2e511f97e532c1431eb3 /tools/qa/cppunit
parent2c4588340ee8387513dd067ecb53dc0058b12ccc (diff)
CMIS UCP: changed URLs to have hierarchical path
Hierarchical path is assumed in loads of places, changed the URLs to the following: * Binding URL is encoded in the authority part, the repository ID is set as a fragment of the binding URL. * The hierarchical path reflects one of the path to the document on the server :x Change-Id: I8214daeb1d9c9b0f6ab86bdf60875e7e4e5369f4
Diffstat (limited to 'tools/qa/cppunit')
-rw-r--r--tools/qa/cppunit/test_urlobj.cxx31
1 files changed, 23 insertions, 8 deletions
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index da11113111d1..0a3a714f2942 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -245,14 +245,29 @@ namespace tools_urlobj
void urlobjCmisTest( )
{
- INetURLObject aUrl( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "cmis+atom://foo.bar.com:8080/my%2Fcmis%2Fatom/path/to/content" ) ) );
- CPPUNIT_ASSERT_EQUAL( std::string( "foo.bar.com" ),
- OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::NO_DECODE ) ) );
- CPPUNIT_ASSERT( aUrl.GetPort( ) == 8080 );
- CPPUNIT_ASSERT_EQUAL( std::string( "/my%2Fcmis%2Fatom/path/to/content" ),
- OUSTR_TO_STDSTR( aUrl.GetURLPath( INetURLObject::NO_DECODE ) ) );
- CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong protocol found", INET_PROT_CMIS_ATOM, aUrl.GetProtocol( ) );
+ // Test with a username part
+ {
+ INetURLObject aUrl( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "vnd.libreoffice.cmis+atom://username@http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) ) );
+ CPPUNIT_ASSERT_EQUAL( std::string( "http://foo.bar.com:8080/my/cmis/atom#repo-id-encoded" ),
+ OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ) ) );
+ CPPUNIT_ASSERT_EQUAL( std::string( "username" ), OUSTR_TO_STDSTR( aUrl.GetUser( ) ) );
+ CPPUNIT_ASSERT_EQUAL( std::string( "/path/to/content" ),
+ OUSTR_TO_STDSTR( aUrl.GetURLPath( INetURLObject::NO_DECODE ) ) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong protocol found", INET_PROT_CMIS_ATOM, aUrl.GetProtocol( ) );
+ }
+
+ // Test without a username part
+ {
+ INetURLObject aUrl( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "vnd.libreoffice.cmis+atom://http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) ) );
+ CPPUNIT_ASSERT_EQUAL( std::string( "http://foo.bar.com:8080/my/cmis/atom#repo-id-encoded" ),
+ OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ) ) );
+ CPPUNIT_ASSERT( !aUrl.HasUserData() );
+ CPPUNIT_ASSERT_EQUAL( std::string( "/path/to/content" ),
+ OUSTR_TO_STDSTR( aUrl.GetURLPath( INetURLObject::NO_DECODE ) ) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong protocol found", INET_PROT_CMIS_ATOM, aUrl.GetProtocol( ) );
+ }
}
// Change the following lines only, if you add, remove or rename