def setup_server(self): ServerLayer.__init__(self, self.__name__) self.log_file = os.path.join(self.log_path, 'mongodb.log') self.pid_file = os.path.join(self.run_path, 'mongodb.pid') self.lock_file = os.path.join(self.var_path, 'mongod.lock') self.mongod_bin = self.mongod_bin or 'mongod' # compute mongod arguments self.default_options = { 'port': self.storage_port, 'dbpath': self.var_path, 'pidfilepath': self.pid_file, 'logpath': self.log_file, 'rest': True, 'noprealloc': True, 'smallfiles': True, } all_options = {} all_options.update(self.default_options) all_options.update(self.extra_options) # compute "self.start_cmd" arguments_string = self._serialize_arguments(all_options) self.start_cmd = '{0} {1}'.format(self.mongod_bin, arguments_string) logger.debug('start_cmd=%s' % self.start_cmd) # compute "self.servers" self.servers = [ (self.hostname, self.storage_port), (self.hostname, self.console_port), ]
def setup_server(self): """ Start the ApacheDS daemon and capture its STDOUT and STDERR channels. export INSTANCE_DIRECTORY=`pwd`/instances/default /usr/local/apacheds-2.0.0-M23/bin/wrapper --console /usr/local/apacheds-2.0.0-M23/conf/wrapper.conf wrapper.debug=true """ ServerLayer.__init__(self, self.__name__, stdout=self.stdout_file, stderr=self.stderr_file) # Compute "self.start_cmd" os.environ['INSTANCE_DIRECTORY'] = self.workingdir # FIXME: *Optionally* use wrapper.debug=true cmd_arguments_string = u'--console "{configfile}" wrapper.debug=true'.format( configfile=self.apacheds_conf) self.start_cmd = u'{program} {arguments}'.format( program=self.apacheds_bin, arguments=cmd_arguments_string) print >> sys.stderr, 'self.start_cmd:', self.start_cmd logger.debug('start_cmd=%s' % self.start_cmd) # compute "self.servers" self.servers = [ (self.host, int(self.port)), ]
def tearDown(self): """ Tear down the test layer. Remove the working directory. """ ServerLayer.tearDown(self) # TODO: # maybe differentiate between cleaning up the working directory # on startup versus cleaning it up on teardown self.workspace_cleanup()
def start(self): """ Propagates start operation to ``ServerLayer``. Beforehand, brutally removes pid- and lock-files to be graceful if the last shutdown went wrong. """ os.path.exists(self.pid_file) and os.unlink(self.pid_file) os.path.exists(self.lock_file) and os.unlink(self.lock_file) ServerLayer.start(self)
def start(self): """ Propagates start operation to ``ServerLayer``. Beforehand, brutally removes pid- and lock-files to be graceful if the last shutdown went wrong. """ #print >>sys.stderr, 'self.settings:', self.settings os.path.exists(self.settings['pidfile']) and os.unlink(self.settings['pidfile']) os.path.exists(self.settings['argsfile']) and os.unlink(self.settings['argsfile']) ServerLayer.start(self)
def setup_server(self): """ Start the ``slapd`` daemon and capture its STDOUT and STDERR channels. """ ServerLayer.__init__(self, self.__name__, stdout=self.stdout_file, stderr=self.stderr_file) # Compute "self.start_cmd" cmd_arguments = OrderedDict() cmd_arguments['f'] = self.slapd_conf cmd_arguments['h'] = self.uri # FIXME: Use debug log level from yet another parameter cmd_arguments['d'] = 255 cmd_arguments_string = self.serialize_arguments(cmd_arguments) self.start_cmd = u'{program} {arguments}'.format(program=self.slapd_bin, arguments=cmd_arguments_string).encode('utf-8') print >>sys.stderr, 'self.start_cmd:', self.start_cmd logger.debug('start_cmd=%s' % self.start_cmd) # compute "self.servers" self.servers = [ (self.host, int(self.port)), ]