source: TI12-security/trunk/python/ndg.security.test/ndg/security/test/sessionmanagerclient/wsgi/sessionManagerServerApp.py @ 4680

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.test/ndg/security/test/sessionmanagerclient/wsgi/sessionManagerServerApp.py@4680
Revision 4680, 1.7 KB checked in by pjkersha, 12 years ago (diff)

Global replace to fix copyright from STFC & NERC to STFC alone because it's not possible to have copyright held by two orgs.

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