source: TI12-security/trunk/python/ndg.security.test/ndg/security/test/combinedservices/serverapp.py @ 4464

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.test/ndg/security/test/combinedservices/serverapp.py@4464
Revision 4464, 1.5 KB checked in by pjkersha, 12 years ago (diff)

Added a test deployment to try out Session Manager and Attribute Authority WSGIs running under the same Paste instance. Tested against Session Manager Client unit tests.

Line 
1#!/usr/bin/env python
2"""NDG Security test harness for Ccombined Session Manager and Attribute
3Authority services running under a single Paste instance.
4
5NERC Data Grid Project
6
7This software may be distributed under the terms of the Q Public License,
8version 1.0 or later.
9"""
10__author__ = "P J Kershaw"
11__date__ = "20/11/08"
12__copyright__ = "(C) 2008 STFC & NERC"
13__contact__ = "Philip.Kershaw@stfc.ac.uk"
14__revision__ = "$Id$"
15import os
16
17def infoApp(environ, start_response):
18    start_response('200 OK', [('Content-type', 'text/plain')])
19    return "NDG Security Services Unit Tests"
20
21def app_factory(global_config, **local_conf):
22    return infoApp
23
24
25# Initialize environment for unit tests
26if 'NDGSEC_COMBINED_SRVS_UNITTEST_DIR' not in os.environ:
27    os.environ['NDGSEC_COMBINED_SRVS_UNITTEST_DIR'] = \
28                                    os.path.abspath(os.path.dirname(__file__))
29   
30# To start the Site A Attribute Authority run
31# $ paster serve site-a.ini or run this file as a script
32# $ ./siteAServerApp.py [port #]
33if __name__ == '__main__':
34    import sys
35    import logging
36    logging.basicConfig(level=logging.DEBUG)
37
38    if len(sys.argv) > 1:
39        port = int(sys.argv[1])
40    else:
41        port = 5000
42       
43    cfgFilePath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
44                               'services.ini')
45       
46    from paste.httpserver import serve
47    from paste.deploy import loadapp
48
49    app = loadapp('config:%s' % cfgFilePath)
50    serve(app, host='0.0.0.0', port=port)
Note: See TracBrowser for help on using the repository browser.