ICE 3.4.2
[php5-ice-freebsdport.git] / py / test / Ice / proxy / Server.py
bloba36a70e19b76a716bd5767b22417fde3a6a94ec1
1 #!/usr/bin/env python
2 # **********************************************************************
4 # Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
6 # This copy of Ice is licensed to you under the terms described in the
7 # ICE_LICENSE file included in this distribution.
9 # **********************************************************************
11 import os, sys, traceback
13 import Ice
14 slice_dir = Ice.getSliceDir()
15 if not slice_dir:
16 print sys.argv[0] + ': Slice directory not found.'
17 sys.exit(1)
19 Ice.loadSlice("'-I" + slice_dir + "' Test.ice")
20 import Test, TestI
22 def run(args, communicator):
23 communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp")
24 adapter = communicator.createObjectAdapter("TestAdapter")
25 adapter.add(TestI.MyDerivedClassI(), communicator.stringToIdentity("test"))
26 adapter.activate()
27 communicator.waitForShutdown()
28 return True
30 try:
31 initData = Ice.InitializationData()
32 initData.properties = Ice.createProperties(sys.argv)
33 communicator = Ice.initialize(sys.argv, initData)
34 status = run(sys.argv, communicator)
35 except:
36 traceback.print_exc()
37 status = False
39 if communicator:
40 try:
41 communicator.destroy()
42 except:
43 traceback.print_exc()
44 status = False
46 sys.exit(not status)