 9826f31cc2
			
		
	
	
		9826f31cc2
		
	
	
	
	
		
			
			git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2536 fd906abe-77d9-0310-91a1-e0d9ade77398
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| ================================================
 | |
| Agents for Job Execution and Communication Tasks
 | |
| ================================================
 | |
| 
 | |
|   ($Id$)
 | |
| 
 | |
|   >>> config = '''
 | |
|   ... controller(names=['core.sample'])
 | |
|   ... scheduler(name='core')
 | |
|   ... logger(name='default', standard=30)
 | |
|   ... system.winapi = 'testing'
 | |
|   ... '''
 | |
|   >>> from cybertools.agent.main import setup
 | |
|   >>> master = setup(config)
 | |
|   Starting agent application...
 | |
|   Using controllers core.sample.
 | |
| 
 | |
| 
 | |
| OutlookCrawler
 | |
| ==============
 | |
| 
 | |
| The agent uses Twisted's cooperative multitasking model.
 | |
| 
 | |
| OutlookCrawler is derived from MailCrawler. The OutlookCrawler returns a deferred
 | |
| which itself holds a list of MailResource Objects.
 | |
| 
 | |
| Returns a deferred that must be supplied with a callback method (and in
 | |
| most cases also an errback method).
 | |
| 
 | |
| The TestCase here is using subsidiary methods which replace calls to the "real Outlook
 | |
| dlls".
 | |
| 
 | |
|   >>> controller = master.controllers[0]
 | |
|   >>> controller.createAgent('crawl.outlook', 'sample02')
 | |
| 
 | |
| In the next step we request the start of a job, again via the controller.
 | |
| 
 | |
|   >>> controller.enterJob('sample', 'sample02', params=dict(inbox=True))
 | |
| 
 | |
| The job is not executed immediately - we have to hand over control to
 | |
| the twisted reactor first.
 | |
| 
 | |
|   >>> from cybertools.agent.tests import tester
 | |
|   >>> tester.iterate()
 | |
|   Outlook.Application retrieved
 | |
|   Namespace MAPI retrieved
 | |
|   retrieving Outlook default folder
 | |
|   collecting Mails from folder
 | |
|   Job 00001 completed; result: [<...MailResource...>, <...MailResource...>, <...MailResource...>];
 |