summaryrefslogtreecommitdiff
path: root/python/test/Ice/packagemd/Server.py
blob: 04aae06b2f0c362ae246fa75653fa804e4330540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

from TestHelper import TestHelper
TestHelper.loadSlice('--all -I. Test.ice')
import Test
import Test1
import testpkg
import modpkg
import Ice


class InitialI(Test.Initial):

    def getTest1C2AsObject(self, current):
        return Test1.C2()

    def getTest1C2AsC1(self, current):
        return Test1.C2()

    def getTest1C2AsC2(self, current):
        return Test1.C2()

    def throwTest1E2AsE1(self, current):
        raise Test1.E2()

    def throwTest1E2AsE2(self, current):
        raise Test1.E2()

    def throwTest1Def(self, current):
        raise Test1._def()

    def getTest2C2AsObject(self, current):
        return testpkg.Test2.C2()

    def getTest2C2AsC1(self, current):
        return testpkg.Test2.C2()

    def getTest2C2AsC2(self, current):
        return testpkg.Test2.C2()

    def throwTest2E2AsE1(self, current):
        raise testpkg.Test2.E2()

    def throwTest2E2AsE2(self, current):
        raise testpkg.Test2.E2()

    def getTest3C2AsObject(self, current):
        return modpkg.Test3.C2()

    def getTest3C2AsC1(self, current):
        return modpkg.Test3.C2()

    def getTest3C2AsC2(self, current):
        return modpkg.Test3.C2()

    def throwTest3E2AsE1(self, current):
        raise modpkg.Test3.E2()

    def throwTest3E2AsE2(self, current):
        raise modpkg.Test3.E2()

    def shutdown(self, current):
        current.adapter.getCommunicator().shutdown()


class Server(TestHelper):

    def run(self, args):

        with self.initialize(args=args) as communicator:
            communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint())
            adapter = communicator.createObjectAdapter("TestAdapter")
            adapter.add(InitialI(), Ice.stringToIdentity("initial"))
            adapter.activate()
            communicator.waitForShutdown()