summaryrefslogtreecommitdiff
path: root/python/test/Ice/optional/ServerAMD.py
blob: bd95c1feb3379020ebdb32b1b489ca2816dfc756 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2016 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.
#
# **********************************************************************

import os, sys, traceback

import Ice
Ice.loadSlice('TestAMD.ice')
import Test

class InitialI(Test.Initial):

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

    def pingPong_async(self, cb, o, current=None):
        cb.ice_response(o)

    def opOptionalException_async(self, cb, a, b, o, current=None):
        cb.ice_exception(Test.OptionalException(False, a, b, o))

    def opDerivedException_async(self, cb, a, b, o, current=None):
        cb.ice_exception(Test.DerivedException(False, a, b, o, b, o))

    def opRequiredException_async(self, cb, a, b, o, current=None):
        e = Test.RequiredException()
        e.a = a
        e.b = b
        e.o = o
        if b is not Ice.Unset:
            e.ss = b
        if o is not Ice.Unset:
            e.o2 = o
        cb.ice_exception(e)

    def opByte_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opBool_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opShort_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opInt_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opLong_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opFloat_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opDouble_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opString_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opMyEnum_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opSmallStruct_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opFixedStruct_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opVarStruct_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opOneOptional_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opOneOptionalProxy_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opByteSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opBoolSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opShortSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opIntSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opLongSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opFloatSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opDoubleSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opStringSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opSmallStructSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opSmallStructList_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opFixedStructSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opFixedStructList_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opVarStructSeq_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opSerializable_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opIntIntDict_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opStringIntDict_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opIntOneOptionalDict_async(self, cb, p1, current=None):
        cb.ice_response(p1, p1)

    def opClassAndUnknownOptional_async(self, cb, p, current=None):
        cb.ice_response()

    def sendOptionalClass_async(self, cb, req, o, current=None):
        cb.ice_response()

    def returnOptionalClass_async(self, cb, req, current=None):
        cb.ice_response(Test.OneOptional(53))

    def opG_async(self, cb, g, current=None):
        cb.ice_response(g)

    def opVoid_async(self, cb, current=None):
        cb.ice_response()

    def opMStruct1_async(self, cb, current):
        cb.ice_response(Test.SmallStruct())

    def opMStruct2_async(self, cb, p1, current):
        cb.ice_response(p1, p1)

    def opMSeq1_async(self, cb, current):
        cb.ice_response([])

    def opMSeq2_async(self, cb, p1, current):
        cb.ice_response(p1, p1)

    def opMDict1_async(self, cb, current):
        cb.ice_response({})

    def opMDict2_async(self, cb, p1, current):
        cb.ice_response(p1, p1)

    def opMG1_async(self, cb, current):
        cb.ice_response(Test.G())

    def opMG2_async(self, cb, p1, current):
        cb.ice_response(p1, p1)

    def supportsRequiredParams_async(self, cb, current=None):
        cb.ice_response(False)

    def supportsJavaSerializable_async(self, cb, current=None):
        cb.ice_response(True)

    def supportsCsharpSerializable_async(self, cb, current=None):
        cb.ice_response(False)

    def supportsCppStringView_async(self, cb, current=None):
        cb.ice_response(False)

def run(args, communicator):
    communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp")
    adapter = communicator.createObjectAdapter("TestAdapter")
    initial = InitialI()
    adapter.add(initial, Ice.stringToIdentity("initial"))
    adapter.activate()

    communicator.waitForShutdown()
    return True

try:
    communicator = Ice.initialize(sys.argv)
    status = run(sys.argv, communicator)
except:
    traceback.print_exc()
    status = False

if communicator:
    try:
        communicator.destroy()
    except:
        traceback.print_exc()
        status = False

sys.exit(not status)