def batch_add_recipients(self, del_users=True):
		"""
		   returns the time required to add a batch of recipients in the inEnterprise system
		"""
		# clear the entire list to remove any values from previous run_benchmark
		del self.newly_created_user_ids[:]
		
		r = Recipient(self.config, self.batch_size)
		elapsed_time = r.create_batch()
		self.newly_created_user_ids = r.get_user_ids()
		if del_users:
			self.delete_newly_created_users()
		return elapsed_time
Example #2
0
		req = invoker.WSRequest(self.cfg)
		req.send(self._to_add_xml())
		response = req.parse()		
		errors = response.get_errors()
		if len(errors)>0:
			response.print_errors()		
		return response.get_elapsed_time()

	def _to_add_xml(self):
		str_list = []		
		for num in range(self.batch_size):
			user_id = self.user_ids_to_update.pop()
			str_list.append(SINGLE_UPDATE_USER_TEMPLATE %(user_id, 'bulk-update-%d' % user_id , 'bulk-update'))
		actual_xml = UPDATE_RECIPIENT_TEMPLATE % (self.cfg['username'],self.cfg['password'], ''.join(str_list))				
		return actual_xml
	
if __name__=='__main__':
	cfg = invoker.read_config(sys.argv[1])
	batch_size = int(sys.argv[2])
	users_to_update = int(sys.argv[3])

	r = Recipient(cfg, batch_size)
	r.create_all(users_to_update)
	user_ids_to_update = r.get_user_ids()
	print user_ids_to_update

	ur = UpdateRecipient(cfg, batch_size)
	ur.update(user_ids_to_update)

	delRep = DeleteRecipient(cfg, batch_size)
	delRep.delete(user_ids_to_update)