180
class DecoratorServer(Server):
181
"""Server for the TransportDecorator for testing with.
183
To use this when subclassing TransportDecorator, override override the
184
get_decorator_class method.
187
def start_server(self, server=None):
188
"""See bzrlib.transport.Server.start_server.
190
:server: decorate the urls given by server. If not provided a
191
LocalServer is created.
193
if server is not None:
194
self._made_server = False
195
self._server = server
197
from bzrlib.transport.local import LocalURLServer
198
self._made_server = True
199
self._server = LocalURLServer()
200
self._server.start_server()
202
def stop_server(self):
203
if self._made_server:
204
self._server.stop_server()
206
def get_decorator_class(self):
207
"""Return the class of the decorators we should be constructing."""
208
raise NotImplementedError(self.get_decorator_class)
210
def get_url_prefix(self):
211
"""What URL prefix does this decorator produce?"""
212
return self.get_decorator_class()._get_url_prefix()
214
def get_bogus_url(self):
215
"""See bzrlib.transport.Server.get_bogus_url."""
216
return self.get_url_prefix() + self._server.get_bogus_url()
219
"""See bzrlib.transport.Server.get_url."""
220
return self.get_url_prefix() + self._server.get_url()
223
180
def get_test_permutations():
224
181
"""Return the permutations to be used in testing.