Add initial cppunit test to webdav, 'local' only, neon version

This is a 'local' test, meaning it can be done without a
WebDAV server.

It's the first one, so very trivial...

Change-Id: Idf660c7482c86251be02536106f079ac6bdef4b4
Reviewed-on: https://gerrit.libreoffice.org/21658
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
Giuseppe Castagno
2016-01-19 07:44:51 +01:00
committed by Markus Mohrhard
parent c43fdd7409
commit 1f9f1fe342
3 changed files with 135 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,ucb_webdav_local))
$(eval $(call gb_CppunitTest_use_api,ucb_webdav_local, \
offapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_libraries,ucb_webdav_local, \
comphelper \
cppu \
cppuhelper \
sal \
salhelper \
test \
ucbhelper \
))
$(eval $(call gb_CppunitTest_use_library_objects,ucb_webdav_local, \
ucpdav1 \
))
$(eval $(call gb_CppunitTest_use_externals,ucb_webdav_local,\
boost_headers \
libxml2 \
neon \
openssl \
))
$(eval $(call gb_CppunitTest_use_custom_headers,ucb_webdav_local,\
officecfg/registry \
))
$(eval $(call gb_CppunitTest_add_exception_objects,ucb_webdav_local, \
ucb/qa/cppunit/webdav/webdav_local_neon \
))
$(eval $(call gb_CppunitTest_set_include,ucb_webdav_local,\
$$(INCLUDE) \
-I$(SRCDIR)/ucb/source/ucp/webdav-neon \
))
$(eval $(call gb_CppunitTest_use_static_libraries,ucb_webdav_local))
# vim: set noet sw=4 ts=4:

View File

@@ -31,6 +31,20 @@ $(eval $(call gb_Module_add_targets,ucb,\
))
endif
ifeq ($(WITH_WEBDAV),neon)
$(eval $(call gb_Module_add_check_targets,ucb,\
CppunitTest_ucb_webdav_local_neon \
))
endif
ifeq ($(WITH_WEBDAV),serf)
## Placeholder for future serf local test implementation
endif
$(eval $(call gb_Module_add_subsequentcheck_targets,ucb,\
JunitTest_ucb_complex \
JunitTest_ucb_unoapi \

View File

@@ -0,0 +1,66 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <test/bootstrapfixture.hxx>
#include <cppunit/plugin/TestPlugIn.h>
#include "NeonUri.hxx"
namespace
{
class webdav_local_test: public test::BootstrapFixture
{
public:
webdav_local_test() : BootstrapFixture( true, true ) {}
// initialise your test code values here.
void setUp( ) override;
void tearDown( ) override;
void NeonUriTest();
// Change the following lines only, if you add, remove or rename
// member functions of the current class,
// because these macros are need by auto register mechanism.
CPPUNIT_TEST_SUITE( webdav_local_test );
CPPUNIT_TEST( NeonUriTest );
CPPUNIT_TEST_SUITE_END();
}; // class webdav_local_test
// initialise your test code values here.
void webdav_local_test::setUp()
{
}
void webdav_local_test::tearDown()
{
}
void webdav_local_test::NeonUriTest()
{
//try URL decomposition
OUString aURL( "http://user%40anothername@server.biz:8040/aService/asegment/nextsegment/check.this?test=true&link=http://anotherserver.com/%3Fcheck=theapplication%26os=linuxintel%26lang=en-US%26version=5.2.0" );
webdav_ucp::NeonUri aURI( aURL );
CPPUNIT_ASSERT_EQUAL( OUString( "http" ), aURI.GetScheme() );
CPPUNIT_ASSERT_EQUAL( OUString( "server.biz" ), aURI.GetHost() );
CPPUNIT_ASSERT_EQUAL( OUString( "user%40anothername" ), aURI.GetUserInfo() );
CPPUNIT_ASSERT_EQUAL( sal_Int32( 8040 ), aURI.GetPort() );
CPPUNIT_ASSERT_EQUAL( OUString( "/aService/asegment/nextsegment/check.this?test=true&link=http://anotherserver.com/%3Fcheck=theapplication%26os=linuxintel%26lang=en-US%26version=5.2.0" ), aURI.GetPath( ) );
}
CPPUNIT_TEST_SUITE_REGISTRATION( webdav_local_test );
} // namespace rtl_random
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */