summaryrefslogtreecommitdiff
path: root/python/test/Ice/scope/Server.py
blob: 529b8c42ac376740807d3f9cbb91677fa596cac0 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/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('Test.ice')
import Test
import Inner
import Ice


class I1(Test.I):

    def opS(self, s1, current=None):
        return (s1, s1)

    def opSSeq(self, sseq1, current=None):
        return (sseq1, sseq1)

    def opSMap(self, smap1, current=None):
        return (smap1, smap1)

    def opC(self, c1, current=None):
        return (c1, c1)

    def opCSeq(self, cseq1, current=None):
        return (cseq1, cseq1)

    def opCMap(self, cmap1, current=None):
        return (cmap1, cmap1)

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


class I2(Test.Inner.Inner2.I):

    def opS(self, s1, current=None):
        return (s1, s1)

    def opSSeq(self, sseq1, current=None):
        return (sseq1, sseq1)

    def opSMap(self, smap1, current=None):
        return (smap1, smap1)

    def opC(self, c1, current=None):
        return (c1, c1)

    def opCSeq(self, cseq1, current=None):
        return (cseq1, cseq1)

    def opCMap(self, cmap1, current=None):
        return (cmap1, cmap1)

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


class I3(Test.Inner.I):

    def opS(self, s1, current=None):
        return (s1, s1)

    def opSSeq(self, sseq1, current=None):
        return (sseq1, sseq1)

    def opSMap(self, smap1, current=None):
        return (smap1, smap1)

    def opC(self, c1, current=None):
        return (c1, c1)

    def opCSeq(self, cseq1, current=None):
        return (cseq1, cseq1)

    def opCMap(self, cmap1, current=None):
        return (cmap1, cmap1)

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


class I4(Inner.Test.Inner2.I):

    def opS(self, s1, current=None):
        return (s1, s1)

    def opSSeq(self, sseq1, current=None):
        return (sseq1, sseq1)

    def opSMap(self, smap1, current=None):
        return (smap1, smap1)

    def opC(self, c1, current=None):
        return (c1, c1)

    def opCSeq(self, cseq1, current=None):
        return (cseq1, cseq1)

    def opCMap(self, cmap1, current=None):
        return (cmap1, cmap1)

    def shutdown(self, current=None):
        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(I1(), Ice.stringToIdentity("i1"))
            adapter.add(I2(), Ice.stringToIdentity("i2"))
            adapter.add(I3(), Ice.stringToIdentity("i3"))
            adapter.add(I4(), Ice.stringToIdentity("i4"))
            adapter.activate()
            communicator.waitForShutdown()