blob: 6e3dadcae30a015adc707601559a3b445a6f9a83 (
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
// **********************************************************************
//
// Copyright (c) 2003-present 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.
//
// **********************************************************************
(function(module, require, exports)
{
const Test = require("Test").Test;
const TestHelper = require("TestHelper").TestHelper;
const test = TestHelper.test;
class Client extends TestHelper
{
async allTests()
{
const communicator = this.communicator();
const out = this.getWriter();
out.write("testing stringToProxy... ");
const ref = "initial:" + this.getTestEndpoint();
const base = communicator.stringToProxy(ref);
test(base !== null);
out.writeLine("ok");
out.write("testing checked cast... ");
const initial = await Test.InitialPrx.checkedCast(base);
test(initial !== null);
test(initial.equals(base));
out.writeLine("ok");
out.write("getting proxies for class hierarchy... ");
const ca = await initial.caop();
const cb = await initial.cbop();
const cc = await initial.ccop();
const cd = await initial.cdop();
test(ca != cb);
test(ca != cc);
test(ca != cd);
test(cb != cc);
test(cb != cd);
test(cc != cd);
out.writeLine("ok");
out.write("getting proxies for interface hierarchy... ");
const ia = await initial.iaop();
const ib1 = await initial.ib1op();
const ib2 = await initial.ib2op();
const ic = await initial.icop();
test(ia != ib1);
test(ia != ib2);
test(ia != ic);
test(ib1 != ic);
test(ib2 != ic);
out.writeLine("ok");
out.write("invoking proxy operations on class hierarchy... ");
let cao = await ca.caop(ca);
test(cao.equals(ca));
cao = await ca.caop(cb);
test(cao.equals(cb));
cao = await ca.caop(cc);
test(cao.equals(cc));
cao = await cb.caop(ca);
test(cao.equals(ca));
cao = await cb.caop(cb);
test(cao.equals(cb));
cao = await cb.caop(cc);
test(cao.equals(cc));
cao = await cc.caop(ca);
test(cao.equals(ca));
cao = await cc.caop(cb);
test(cao.equals(cb));
cao = await cc.caop(cc);
test(cao.equals(cc));
cao = await cb.cbop(cb);
test(cao.equals(cb));
let cbo = await cb.cbop(cb);
test(cbo.equals(cb));
cao = await cb.cbop(cc);
test(cao.equals(cc));
cbo = await cb.cbop(cc);
test(cbo.equals(cc));
cao = await cc.cbop(cb);
test(cao.equals(cb));
cbo = await cc.cbop(cb);
test(cbo.equals(cb));
cao = await cc.cbop(cc);
test(cao.equals(cc));
cbo = await cc.cbop(cc);
test(cbo.equals(cc));
cao = await cc.ccop(cc);
test(cao.equals(cc));
cbo = await cc.ccop(cc);
test(cbo.equals(cc));
let cco = await cc.ccop(cc);
test(cco.equals(cc));
out.writeLine("ok");
out.write("ditto, but for interface hierarchy... ");
let iao;
let ib1o;
let ib2o;
iao = await ia.iaop(ia);
test(iao.equals(ia));
iao = await ia.iaop(ib1);
test(iao.equals(ib1));
iao = await ia.iaop(ib2);
test(iao.equals(ib2));
iao = await ia.iaop(ic);
test(iao.equals(ic));
iao = await ib1.iaop(ia);
test(iao.equals(ia));
iao = await ib1.iaop(ib1);
test(iao.equals(ib1));
iao = await ib1.iaop(ib2);
test(iao.equals(ib2));
iao = await ib1.iaop(ic);
test(iao.equals(ic));
iao = await ib2.iaop(ia);
test(iao.equals(ia));
iao = await ib2.iaop(ib1);
test(iao.equals(ib1));
iao = await ib2.iaop(ib2);
test(iao.equals(ib2));
iao = await ib2.iaop(ic);
test(iao.equals(ic));
iao = await ic.iaop(ia);
test(iao.equals(ia));
iao = await ic.iaop(ib1);
test(iao.equals(ib1));
iao = await ic.iaop(ib2);
test(iao.equals(ib2));
iao = await ic.iaop(ic);
test(iao.equals(ic));
iao = await ib1.ib1op(ib1);
test(iao.equals(ib1));
ib1o = await ib1.ib1op(ib1);
test(ib1o.equals(ib1));
iao = await ib1.ib1op(ic);
test(iao.equals(ic));
ib1o = await ib1.ib1op(ic);
test(ib1o.equals(ic));
iao = await ic.ib1op(ib1);
test(iao.equals(ib1));
ib1o = await ic.ib1op(ib1);
test(ib1o.equals(ib1));
iao = await ic.ib1op(ic);
test(iao.equals(ic));
ib1o = await ic.ib1op(ic);
test(ib1o.equals(ic));
iao = await ib2.ib2op(ib2);
test(iao.equals(ib2));
ib2o = await ib2.ib2op(ib2);
test(ib2o.equals(ib2));
iao = await ib2.ib2op(ic);
test(iao.equals(ic));
ib2o = await ib2.ib2op(ic);
test(ib2o.equals(ic));
iao = await ic.ib2op(ib2);
test(iao.equals(ib2));
ib2o = await ic.ib2op(ib2);
test(ib2o.equals(ib2));
iao = await ic.ib2op(ic);
test(iao.equals(ic));
ib2o = await ic.ib2op(ic);
test(ib2o.equals(ic));
iao = await ic.icop(ic);
test(iao.equals(ic));
ib1o = await ic.icop(ic);
test(ib1o.equals(ic));
ib2o = await ic.icop(ic);
test(ib2o.equals(ic));
const ico = await ic.icop(ic);
test(ico.equals(ic));
out.writeLine("ok");
out.write("ditto, but for class implementing interfaces... ");
cao = await cd.caop(cd);
test(cao.equals(cd));
cbo = await cd.cbop(cd);
test(cbo.equals(cd));
cco = await cd.ccop(cd);
test(cco.equals(cd));
iao = await cd.iaop(cd);
test(iao.equals(cd));
ib1o = await cd.ib1op(cd);
test(ib1o.equals(cd));
ib2o = await cd.ib2op(cd);
test(ib2o.equals(cd));
cao = await cd.cdop(cd);
test(cao.equals(cd));
cbo = await cd.cdop(cd);
test(cbo.equals(cd));
cco = await cd.cdop(cd);
test(cco.equals(cd));
iao = await cd.cdop(cd);
test(iao.equals(cd));
ib1o = await cd.cdop(cd);
test(ib1o.equals(cd));
ib2o = await cd.cdop(cd);
test(ib2o.equals(cd));
out.writeLine("ok");
await initial.shutdown();
}
async run(args)
{
let communicator;
try
{
[communicator] = this.initialize(args);
await this.allTests();
}
finally
{
if(communicator)
{
await communicator.destroy();
}
}
}
}
exports.Client = Client;
}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined,
typeof global !== "undefined" && typeof global.process !== "undefined" ? require :
(typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope) ? self.Ice._require : window.Ice._require,
typeof global !== "undefined" && typeof global.process !== "undefined" ? exports :
(typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope) ? self : window));
|