Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 1x 1x 1x 4x 4x 4x 4x 1x 36x 36x 36x 3x 3x 36x 36x 36x 16x 16x 20x 20x 20x 20x 20x 20x 36x 1x 20x 20x 20x 20x 20x 20x 20x 20x 20x 17x 17x 5x 20x 1x 4x 4x 4x 1x 33x 2x 2x 31x 2x 2x 29x 2x 2x 27x 2x 2x 25x 2x 2x 23x 2x 2x 21x 2x 2x 19x 2x 2x 17x 2x 2x 15x 4x 4x 11x 4x 4x 7x 1x 1x 6x 1x 1x 33x 1x | // Copyright (c) ZeroC, Inc.
import { Ice } from "@zeroc/ice";
import { Test } from "./Test.js";
import { test } from "../../Common/TestHelper.js";
import { TestI } from "./TestI.js";
class MyError {
}
class Cookie {
message() {
return "blahblah";
}
}
export class ServantLocatorI {
constructor(category) {
this._category = category;
this._deactivated = false;
this._requestId = -1;
}
locate(current) {
test(!this._deactivated);
test(current.id.category == this._category || this._category.length == 0);
if (current.id.name == "unknown") {
return [null, null];
}
if (current.id.name == "invalidReturnValue" || current.id.name == "invalidReturnType") {
return [null, 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;
return [new TestI(), new Cookie()];
}
finished(current, _, 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(_) {
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();
}
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();
}
}
}
|