blob: 55ea45298468831a540e0e4ee3b1c157d0b7ce00 (
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
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
(function(module, require, exports)
{
const Ice = require("ice").Ice;
const Test = require("Test").Test;
const TestI = require("TestI").TestI;
const test = require("TestHelper").TestHelper.test;
class MyError
{
}
class CookieI
{
message()
{
return "blahblah";
}
}
class ServantLocatorI
{
constructor(category)
{
this._category = category;
this._deactivated = false;
this._requestId = -1;
}
locate(current, cookie)
{
test(!this._deactivated);
test(current.id.category == this._category || this._category.length == 0);
if(current.id.name == "unknown")
{
return null;
}
if(current.id.name == "invalidReturnValue" || current.id.name == "invalidReturnType")
{
return null;
}
test(current.id.name == "locate" || current.id.name == "finished");
if(current.id.name == "locate")
{
this.exception(current);
}
//
// Ensure locate() is only called once per request.
//
test(this._requestId == -1);
this._requestId = current.requestId;
cookie.value = new CookieI();
return new TestI();
}
finished(current, servant, cookie)
{
test(!this._deactivated);
//
// Ensure finished() is only called once per request.
//
test(this._requestId == current.requestId);
this._requestId = -1;
test(current.id.category == this._category || this._category.length == 0);
test(current.id.name == "locate" || current.id.name == "finished");
if(current.id.name == "finished")
{
this.exception(current);
}
test(cookie.message() == "blahblah");
}
deactivate(category)
{
test(!this._deactivated);
this._deactivated = true;
}
exception(current)
{
if(current.operation == "ice_ids")
{
throw new Test.TestIntfUserException();
}
else if(current.operation == "requestFailedException")
{
throw new Ice.ObjectNotExistException();
}
else if(current.operation == "unknownUserException")
{
throw new Ice.UnknownUserException("reason");
}
else if(current.operation == "unknownLocalException")
{
throw new Ice.UnknownLocalException("reason");
}
else if(current.operation == "unknownException")
{
throw new Ice.UnknownException("reason");
}
else if(current.operation == "userException")
{
throw new Test.TestIntfUserException();
}
else if(current.operation == "localException")
{
throw new Ice.SocketException(0);
}
else if(current.operation == "jsException")
{
throw new MyError();
}
else if(current.operation == "unknownExceptionWithServantException")
{
throw new Ice.UnknownException("reason");
}
else if(current.operation == "impossibleException")
{
throw new Test.TestIntfUserException(); // Yes, it really is meant to be TestIntfUserException.
}
else if(current.operation == "intfUserException")
{
throw new Test.TestImpossibleException(); // Yes, it really is meant to be TestImpossibleException.
}
else if(current.operation == "asyncResponse")
{
throw new Test.TestImpossibleException();
}
else if(current.operation == "asyncException")
{
throw new Test.TestImpossibleException();
}
}
}
exports.ServantLocatorI = ServantLocatorI;
}(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));
|