Rev 30: Add apache2-dav. in http://bazaar.launchpad.net/%7Evila/bzr/local-test-server
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Jun 5 08:43:48 BST 2008
At http://bazaar.launchpad.net/%7Evila/bzr/local-test-server
------------------------------------------------------------
revno: 30
revision-id: v.ladeuil+lp at free.fr-20080605074333-e7mhc533cplu1a9i
parent: v.ladeuil+lp at free.fr-20080604192336-idor6euv9esfpcn3
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: local_test_server
timestamp: Thu 2008-06-05 09:43:33 +0200
message:
Add apache2-dav.
* tests/test_utils.py:
(ServerAdapter.__init__): Add apache2-dav.
* test_server.py:
(Apache2DAVFeature): New class.
(LocalHTTPTestServer): Renamed from LocalTestServer.
(Apache2DAV): New class.
(get_test_permutations): Inject DAV server in webdav plugin if
server and plugin are available.
* server.py:
(Apache2DAV): New class.
* configs/apache2-dav.conf:
New file.
* config.py:
(Apache2DAV): New class.
added:
configs/apache2-dav.conf apache2dav.conf-20080604211810-6j1dwqo255dl2bc6-1
modified:
TODO todo-20080526134120-eibvvebw74t8j2xh-1
config.py __init__.py-20080523170713-0c8mnxio9r41iyhk-1
server.py server.py-20080524160639-rqhbexqatjqbwypw-1
test_server.py test_server.py-20080530070615-f555godexnk7frms-1
tests/test_utils.py test_utils.py-20080603162150-w01001l902j0gu95-1
-------------- next part --------------
=== modified file 'TODO'
--- a/TODO 2008-06-04 19:23:36 +0000
+++ b/TODO 2008-06-05 07:43:33 +0000
@@ -11,6 +11,8 @@
* server.py
+** self.coutput_config_path should be set in Server.
+
* config.py
** give better error messages for wrongly written config files
=== modified file 'config.py'
--- a/config.py 2008-06-04 11:19:19 +0000
+++ b/config.py 2008-06-05 07:43:33 +0000
@@ -110,6 +110,15 @@
_base_dir=_base_dir)
+class Apache2DAV(Apache2):
+
+ def __init__(self, _base_dir=None):
+ # FIXME: jumping over Apache2 >-/
+ Config.__init__(self, 'apache2-dav',
+ required_dirs=self._required_dirs,
+ _base_dir=_base_dir)
+
+
class Cherokee(Config):
def __init__(self, _base_dir=None):
=== added file 'configs/apache2-dav.conf'
--- a/configs/apache2-dav.conf 1970-01-01 00:00:00 +0000
+++ b/configs/apache2-dav.conf 2008-06-05 07:43:33 +0000
@@ -0,0 +1,64 @@
+#
+# Based on /etc/apache2/apache2.conf in Ubuntu Gusty
+#
+
+# This file will be interpolated by python see plugin source for
+# details.
+
+# Note that most of the directories below are usually owned by
+# root. We want directories writable by the user running the
+# tests.
+
+ServerRoot "%(base_dir)s"
+
+LockFile "%(var_lock_dir)s/accept.lock
+
+PidFile %(pid_file)s
+
+ErrorLog %(log_file)s
+LogFormat "%%h %%l %%u %%t \"%%r\" %%>s %%b \"%%{Referer}i\" \"%%{User-Agent}i\"" combined
+CustomLog %(var_log_dir)s/access.log combined
+LogLevel debug
+
+ServerName %(host)s
+Listen %(port)s
+
+# The following directives seems to activate the smallest apache2
+# server possible. If you know better, comments are very welcome.
+# More info at
+# http://localhost/doc/apache2-doc/manual/mod/worker.html
+StartServers 1
+MaxClients 5
+ThreadsPerChild 5
+
+# Tests will create symlinks in that directory to point to the
+# appropriate location
+DocumentRoot %(www_dir)s
+
+# required for
+#bzrlib.tests.test_transport_implementations.TransportTests.test_has_root_works
+LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so
+LoadModule autoindex_module /usr/lib/apache2/modules/mod_autoindex.so
+
+# the following may help for debug
+ServerSignature On
+
+LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so
+LoadModule dav_module /usr/lib/apache2/modules/mod_dav.so
+LoadModule dav_fs_module /usr/lib/apache2/modules/mod_dav_fs.so
+
+DAVLockDB %(www_dir)s/DAVLock
+<Directory %(www_dir)s>
+ DAV On
+ # DirectorySlash tells apache to reply with redirections if
+ # directories miss their final '/'. It does not play well with
+ # bzr (to they the least) and provide no benefits in our
+ # case. So just turn it off.
+ DirectorySlash Off
+# AuthType Basic
+# AuthName bzr
+# AuthUserFile %(etc_dir)s/basic.users
+# <LimitExcept GET OPTIONS>
+# Require valid-user
+# </LimitExcept>
+</Directory>
=== modified file 'server.py'
--- a/server.py 2008-06-04 13:33:54 +0000
+++ b/server.py 2008-06-05 07:43:33 +0000
@@ -256,6 +256,7 @@
def __init__(self, port, _conf=None):
if _conf is None:
_conf = config.Apache2()
+ # FIXME: it's weird to reverse parameter order
super(Apache2, self).__init__(_conf, port)
self.output_config_path = self.config.abspath('etc/apache2.conf')
@@ -343,11 +344,21 @@
print self._get_log_content()
+class Apache2DAV(Apache2):
+
+ def __init__(self, port, _conf=None):
+ if _conf is None:
+ _conf = config.Apache2DAV()
+ super(Apache2DAV, self).__init__(port, _conf=_conf)
+ self.output_config_path = self.config.abspath('etc/apache2-dav.conf')
+
+
class Cherokee(Server):
def __init__(self, port, _conf=None):
if _conf is None:
_conf = config.Cherokee()
+ # FIXME: it's weird to reverse parameter order
super(Cherokee, self).__init__(_conf, port)
self.output_config_path = self.config.abspath('etc/cherokee.conf')
@@ -375,6 +386,7 @@
def __init__(self, port, _conf=None):
if _conf is None:
_conf = config.Lighttpd()
+ # FIXME: it's weird to reverse parameter order
super(Lighttpd, self).__init__(_conf, port)
self.output_config_path = self.config.abspath('etc/cherokee.conf')
@@ -423,7 +435,9 @@
_servers = dict(apache2=Apache2(37000),
cherokee=Cherokee(37001),
- lighttpd=Lighttpd(37002))
+ lighttpd=Lighttpd(37002),
+ )
+_servers['apache2-dav']=Apache2DAV(37003)
def get_server(name):
return _servers.get(name, None)
=== modified file 'test_server.py'
--- a/test_server.py 2008-06-04 14:18:44 +0000
+++ b/test_server.py 2008-06-05 07:43:33 +0000
@@ -60,6 +60,11 @@
_server_name = 'apache2'
+class Apache2DAVFeature(LocalTestServerFeature):
+
+ _server_name = 'apache2-dav'
+
+
class CherokeeFeature(LocalTestServerFeature):
_server_name = 'cherokee'
@@ -70,7 +75,7 @@
_server_name = 'lighttpd'
-class LocalTestServer(transport.Server):
+class LocalHTTPTestServer(transport.Server):
# Must be set by daughter classes
_server_name = None
@@ -79,7 +84,7 @@
_url_protocol = 'http'
def __init__(self, _server=None):
- super(LocalTestServer, self).__init__()
+ super(LocalHTTPTestServer, self).__init__()
if _server is None:
_server = server.get_server(self._server_name)
self._server = _server
@@ -126,7 +131,7 @@
return self._url_protocol + '://127.0.0.1:1/'
-class Apache2(LocalTestServer):
+class Apache2(LocalHTTPTestServer):
_server_name = 'apache2'
@@ -153,7 +158,13 @@
_url_protocol = 'http+pycurl'
-class Cherokee(LocalTestServer):
+class Apache2DAV(Apache2):
+
+ _server_name = 'apache2-dav'
+ _url_protocol = 'http+webdav'
+
+
+class Cherokee(LocalHTTPTestServer):
_server_name = 'cherokee'
@@ -168,7 +179,7 @@
_url_protocol = 'http+pycurl'
-class Lighttpd(LocalTestServer):
+class Lighttpd(LocalHTTPTestServer):
_server_name = 'lighttpd'
@@ -198,6 +209,12 @@
except errors.DependencyNotPresent:
pycurl_present = False
+ try:
+ from bzrlib.plugins.webdav import webdav
+ webdav_present = True
+ except errors.DependencyNotPresent:
+ webdav_present = False
+
permutations = []
if Apache2Feature().available():
permutations.append((HttpTransport_urllib, Apache2_urllib))
@@ -211,4 +228,9 @@
permutations.append((HttpTransport_urllib, Lighttpd_urllib))
if pycurl_present:
permutations.append((PyCurlTransport, Lighttpd_pycurl))
+
+ if webdav_present:
+ if Apache2DAVFeature().available():
+ permutations.append((webdav.HttpDavTransport, Apache2DAV))
+
return permutations
=== modified file 'tests/test_utils.py'
--- a/tests/test_utils.py 2008-06-04 10:22:50 +0000
+++ b/tests/test_utils.py 2008-06-05 07:43:33 +0000
@@ -74,6 +74,13 @@
_server_feature_class=test_server.Apache2Feature,
_test_server_class=test_server.Apache2,
)),
+ ('apache2-dav', dict(
+ _server_name='apache2-dav',
+ _config_class=config.Apache2DAV,
+ _server_class=server.Apache2DAV,
+ _server_feature_class=test_server.Apache2DAVFeature,
+ _test_server_class=test_server.Apache2DAV,
+ )),
('cherokee', dict(
_server_name='cherokee',
_config_class=config.Cherokee,
More information about the bazaar-commits
mailing list