'Test loading an application file in different dump format.'

def testLoadApplication(self):

    a = service.Application('hello')
    baseconfig = {'file': None, 'source': None, 'python': None}
    for style in 'source    pickle'.split():
        config = baseconfig.copy()
        config[{'pickle': 'file'}.get(style, style)] = 'helloapplication'
        sob.IPersistable(a).setStyle(style)
        sob.IPersistable(a).save(filename='helloapplication')
        a1 = app.getApplication(config, None)
        self.assertEqual(service.IService(a1).name, 'hello')
    config = baseconfig.copy()
    config['python'] = 'helloapplication'
    with open('helloapplication', 'w') as f:
        f.writelines(['from    twisted.application    import    service\n', "application    =    service.Application('hello')\n"])
    a1 = app.getApplication(config, None)
    self.assertEqual(service.IService(a1).name, 'hello')
