@eclipse-glsp/server 1.1.0-RC08 → 1.1.0-RC09
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/lib/common/actions/action-dispatcher.spec.d.ts +0 -2
- package/lib/common/actions/action-dispatcher.spec.d.ts.map +0 -1
- package/lib/common/actions/action-dispatcher.spec.js +0 -264
- package/lib/common/actions/action-dispatcher.spec.js.map +0 -1
- package/lib/common/actions/action-handler-registry.spec.d.ts +0 -2
- package/lib/common/actions/action-handler-registry.spec.d.ts.map +0 -1
- package/lib/common/actions/action-handler-registry.spec.js +0 -50
- package/lib/common/actions/action-handler-registry.spec.js.map +0 -1
- package/lib/common/actions/global-action-provider.spec.d.ts +0 -2
- package/lib/common/actions/global-action-provider.spec.d.ts.map +0 -1
- package/lib/common/actions/global-action-provider.spec.js +0 -70
- package/lib/common/actions/global-action-provider.spec.js.map +0 -1
- package/lib/common/command/command-stack.spec.d.ts +0 -2
- package/lib/common/command/command-stack.spec.d.ts.map +0 -1
- package/lib/common/command/command-stack.spec.js +0 -207
- package/lib/common/command/command-stack.spec.js.map +0 -1
- package/lib/common/command/command.spec.d.ts +0 -2
- package/lib/common/command/command.spec.d.ts.map +0 -1
- package/lib/common/command/command.spec.js +0 -86
- package/lib/common/command/command.spec.js.map +0 -1
- package/lib/common/command/recording-command.spec.d.ts +0 -17
- package/lib/common/command/recording-command.spec.d.ts.map +0 -1
- package/lib/common/command/recording-command.spec.js +0 -62
- package/lib/common/command/recording-command.spec.js.map +0 -1
- package/lib/common/di/binding-target.spec.d.ts +0 -2
- package/lib/common/di/binding-target.spec.d.ts.map +0 -1
- package/lib/common/di/binding-target.spec.js +0 -121
- package/lib/common/di/binding-target.spec.js.map +0 -1
- package/lib/common/di/multi-bindings.spec.d.ts +0 -2
- package/lib/common/di/multi-bindings.spec.d.ts.map +0 -1
- package/lib/common/di/multi-bindings.spec.js +0 -137
- package/lib/common/di/multi-bindings.spec.js.map +0 -1
- package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts +0 -2
- package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts.map +0 -1
- package/lib/common/diagram/request-type-hints-action-handler.spec.js +0 -57
- package/lib/common/diagram/request-type-hints-action-handler.spec.js.map +0 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts +0 -2
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.js +0 -34
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.js.map +0 -1
- package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts +0 -2
- package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/request-context-actions-handler.spec.js +0 -63
- package/lib/common/features/contextactions/request-context-actions-handler.spec.js.map +0 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts +0 -2
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.js +0 -48
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.js.map +0 -1
- package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts +0 -2
- package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts.map +0 -1
- package/lib/common/features/directediting/context-edit-validator-registry.spec.js +0 -44
- package/lib/common/features/directediting/context-edit-validator-registry.spec.js.map +0 -1
- package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts +0 -2
- package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts.map +0 -1
- package/lib/common/features/directediting/request-edit-validation-handler.spec.js +0 -97
- package/lib/common/features/directediting/request-edit-validation-handler.spec.js.map +0 -1
- package/lib/common/features/model/gmodel-serializer.spec.d.ts +0 -2
- package/lib/common/features/model/gmodel-serializer.spec.d.ts.map +0 -1
- package/lib/common/features/model/gmodel-serializer.spec.js +0 -124
- package/lib/common/features/model/gmodel-serializer.spec.js.map +0 -1
- package/lib/common/operations/operation-handler-registry.spec.d.ts +0 -2
- package/lib/common/operations/operation-handler-registry.spec.d.ts.map +0 -1
- package/lib/common/operations/operation-handler-registry.spec.js +0 -50
- package/lib/common/operations/operation-handler-registry.spec.js.map +0 -1
- package/lib/common/protocol/glsp-server.spec.d.ts +0 -2
- package/lib/common/protocol/glsp-server.spec.d.ts.map +0 -1
- package/lib/common/protocol/glsp-server.spec.js +0 -132
- package/lib/common/protocol/glsp-server.spec.js.map +0 -1
- package/lib/common/session/client-session-factory.spec.d.ts +0 -2
- package/lib/common/session/client-session-factory.spec.d.ts.map +0 -1
- package/lib/common/session/client-session-factory.spec.js +0 -56
- package/lib/common/session/client-session-factory.spec.js.map +0 -1
- package/lib/common/session/client-session-manager.spec.d.ts +0 -2
- package/lib/common/session/client-session-manager.spec.d.ts.map +0 -1
- package/lib/common/session/client-session-manager.spec.js +0 -74
- package/lib/common/session/client-session-manager.spec.js.map +0 -1
- package/lib/common/test/mock-util.d.ts +0 -120
- package/lib/common/test/mock-util.d.ts.map +0 -1
- package/lib/common/test/mock-util.js +0 -216
- package/lib/common/test/mock-util.js.map +0 -1
- package/lib/common/utils/promise-queue.spec.d.ts +0 -2
- package/lib/common/utils/promise-queue.spec.d.ts.map +0 -1
- package/lib/common/utils/promise-queue.spec.js +0 -117
- package/lib/common/utils/promise-queue.spec.js.map +0 -1
- package/lib/common/utils/registry.spec.d.ts +0 -2
- package/lib/common/utils/registry.spec.d.ts.map +0 -1
- package/lib/common/utils/registry.spec.js +0 -199
- package/lib/common/utils/registry.spec.js.map +0 -1
- package/lib/node/launch/cli-parser.spec.d.ts +0 -2
- package/lib/node/launch/cli-parser.spec.d.ts.map +0 -1
- package/lib/node/launch/cli-parser.spec.js +0 -56
- package/lib/node/launch/cli-parser.spec.js.map +0 -1
- package/lib/node/launch/socket-cli-parser.spec.d.ts +0 -2
- package/lib/node/launch/socket-cli-parser.spec.d.ts.map +0 -1
- package/lib/node/launch/socket-cli-parser.spec.js +0 -66
- package/lib/node/launch/socket-cli-parser.spec.js.map +0 -1
- package/lib/node/launch/socket-server-launcher.spec.d.ts +0 -17
- package/lib/node/launch/socket-server-launcher.spec.d.ts.map +0 -1
- package/lib/node/launch/socket-server-launcher.spec.js +0 -75
- package/lib/node/launch/socket-server-launcher.spec.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/server",
|
|
3
|
-
"version": "1.1.0-
|
|
3
|
+
"version": "1.1.0-RC09",
|
|
4
4
|
"description": "A js server framework for Eclipse GLSP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"watch": "tsc -w"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@eclipse-glsp/graph": "1.1.0-
|
|
63
|
-
"@eclipse-glsp/protocol": "1.1.0-
|
|
62
|
+
"@eclipse-glsp/graph": "1.1.0-RC09",
|
|
63
|
+
"@eclipse-glsp/protocol": "1.1.0-RC09",
|
|
64
64
|
"@types/uuid": "8.3.1",
|
|
65
65
|
"commander": "^8.3.0",
|
|
66
66
|
"fast-json-patch": "^3.1.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "edffbe7d7a2b9e117d7f235b8d629dfde0c1ffe7"
|
|
79
79
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-dispatcher.spec.d.ts","sourceRoot":"","sources":["../../../src/common/actions/action-dispatcher.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/********************************************************************************
|
|
4
|
-
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
5
|
-
*
|
|
6
|
-
* This program and the accompanying materials are made available under the
|
|
7
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
8
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
9
|
-
*
|
|
10
|
-
* This Source Code may also be made available under the following Secondary
|
|
11
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
12
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
13
|
-
* with the GNU Classpath Exception which is available at
|
|
14
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
15
|
-
*
|
|
16
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
17
|
-
********************************************************************************/
|
|
18
|
-
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
19
|
-
const chai_1 = require("chai");
|
|
20
|
-
const inversify_1 = require("inversify");
|
|
21
|
-
const sinon = require("sinon");
|
|
22
|
-
const service_identifiers_1 = require("../di/service-identifiers");
|
|
23
|
-
const client_session_manager_1 = require("../session/client-session-manager");
|
|
24
|
-
const mock = require("../test/mock-util");
|
|
25
|
-
const logger_1 = require("../utils/logger");
|
|
26
|
-
const action_dispatcher_1 = require("./action-dispatcher");
|
|
27
|
-
const action_handler_registry_1 = require("./action-handler-registry");
|
|
28
|
-
const assert = require("assert");
|
|
29
|
-
function waitSync(timeInMillis) {
|
|
30
|
-
const start = Date.now();
|
|
31
|
-
let now = start;
|
|
32
|
-
while (now - start < timeInMillis) {
|
|
33
|
-
now = Date.now();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
describe('test DefaultActionDispatcher', () => {
|
|
37
|
-
const container = new inversify_1.Container();
|
|
38
|
-
const clientId = 'myClientId';
|
|
39
|
-
const actionHandlerRegistry = new action_handler_registry_1.ActionHandlerRegistry();
|
|
40
|
-
let registry_get_stub;
|
|
41
|
-
const sandbox = sinon.createSandbox();
|
|
42
|
-
container.load(new inversify_1.ContainerModule(bind => {
|
|
43
|
-
bind(logger_1.Logger).toConstantValue(new mock.StubLogger());
|
|
44
|
-
bind(client_session_manager_1.ClientSessionManager).toConstantValue(new mock.StubClientSessionManager());
|
|
45
|
-
bind(service_identifiers_1.ClientId).toConstantValue(clientId);
|
|
46
|
-
bind(action_handler_registry_1.ActionHandlerRegistry).toConstantValue(actionHandlerRegistry);
|
|
47
|
-
bind(service_identifiers_1.ClientActionKinds).toConstantValue(['response', 'response1', 'response2']);
|
|
48
|
-
}));
|
|
49
|
-
const actionDispatcher = container.resolve(action_dispatcher_1.DefaultActionDispatcher);
|
|
50
|
-
beforeEach(() => {
|
|
51
|
-
registry_get_stub = sandbox.stub(actionHandlerRegistry, 'get');
|
|
52
|
-
});
|
|
53
|
-
afterEach(() => {
|
|
54
|
-
sandbox.restore();
|
|
55
|
-
});
|
|
56
|
-
describe('test with one-way actions (no response actions)', () => {
|
|
57
|
-
it('dispatch- unhandled action', async () => {
|
|
58
|
-
assert.rejects(actionDispatcher.dispatch({ kind: 'unhandled' }));
|
|
59
|
-
});
|
|
60
|
-
it('dispatch - one action', async () => {
|
|
61
|
-
// Mock setup
|
|
62
|
-
const action = 'action';
|
|
63
|
-
const handler = new mock.StubActionHandler([action]);
|
|
64
|
-
const getHandler = (kind) => (kind === action ? [handler] : []);
|
|
65
|
-
registry_get_stub.callsFake(getHandler);
|
|
66
|
-
const spy_handler_execute = sinon.spy(handler, 'execute');
|
|
67
|
-
// Test execution
|
|
68
|
-
await actionDispatcher.dispatch({ kind: action });
|
|
69
|
-
(0, chai_1.expect)(spy_handler_execute.calledOnce).true;
|
|
70
|
-
});
|
|
71
|
-
describe('test multi dispatch with single-handled actions', () => {
|
|
72
|
-
// Mock Setup
|
|
73
|
-
const action1 = 'a1';
|
|
74
|
-
const action2 = 'a2';
|
|
75
|
-
const action3 = 'a3';
|
|
76
|
-
const handler1 = new mock.StubActionHandler([action1]);
|
|
77
|
-
const handler2 = new mock.StubActionHandler([action2]);
|
|
78
|
-
const handler3 = new mock.StubActionHandler([action3]);
|
|
79
|
-
const spy_handler1_execute = sinon.stub(handler1, 'execute').returns([]);
|
|
80
|
-
const spy_handler2_execute = sinon.stub(handler2, 'execute').returns([]);
|
|
81
|
-
const spy_handler3_execute = sinon.stub(handler3, 'execute').returns([]);
|
|
82
|
-
const handlerMockImpl = (kind) => {
|
|
83
|
-
switch (kind) {
|
|
84
|
-
case action1:
|
|
85
|
-
return [handler1];
|
|
86
|
-
case action2:
|
|
87
|
-
return [handler2];
|
|
88
|
-
case action3:
|
|
89
|
-
return [handler3];
|
|
90
|
-
default:
|
|
91
|
-
return [];
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
it('dispatch - multiple actions', async () => {
|
|
95
|
-
// Mock setup
|
|
96
|
-
registry_get_stub.callsFake(handlerMockImpl);
|
|
97
|
-
// Test execution
|
|
98
|
-
actionDispatcher.dispatch({ kind: action1 });
|
|
99
|
-
actionDispatcher.dispatch({ kind: action2 });
|
|
100
|
-
await actionDispatcher.dispatch({ kind: action3 });
|
|
101
|
-
// Check if all handlers have been called
|
|
102
|
-
(0, chai_1.expect)(spy_handler1_execute.called).true;
|
|
103
|
-
(0, chai_1.expect)(spy_handler2_execute.called).true;
|
|
104
|
-
(0, chai_1.expect)(spy_handler3_execute.called).true;
|
|
105
|
-
// Check if all handlers have been called in the right order
|
|
106
|
-
sinon.assert.callOrder(spy_handler1_execute, spy_handler2_execute, spy_handler3_execute);
|
|
107
|
-
});
|
|
108
|
-
it('dispatchAll- multiple actions', async () => {
|
|
109
|
-
// Mock setup
|
|
110
|
-
registry_get_stub.callsFake(handlerMockImpl);
|
|
111
|
-
// Test execution
|
|
112
|
-
await actionDispatcher.dispatchAll([{ kind: action1 }, { kind: action2 }, { kind: action3 }]);
|
|
113
|
-
// Check if all handlers have been called
|
|
114
|
-
(0, chai_1.expect)(spy_handler1_execute.calledOnce);
|
|
115
|
-
(0, chai_1.expect)(spy_handler2_execute.calledOnce);
|
|
116
|
-
(0, chai_1.expect)(spy_handler3_execute.calledOnce);
|
|
117
|
-
// Check if all handlers have been called in the right order
|
|
118
|
-
sinon.assert.callOrder(spy_handler1_execute, spy_handler2_execute, spy_handler3_execute);
|
|
119
|
-
});
|
|
120
|
-
it('dispatch - multiple actions (racing execution times)', async () => {
|
|
121
|
-
// Mock setup
|
|
122
|
-
registry_get_stub.callsFake(handlerMockImpl);
|
|
123
|
-
spy_handler1_execute.callsFake((_action) => {
|
|
124
|
-
waitSync(500);
|
|
125
|
-
return [];
|
|
126
|
-
});
|
|
127
|
-
spy_handler2_execute.callsFake((_action) => {
|
|
128
|
-
waitSync(200);
|
|
129
|
-
return [];
|
|
130
|
-
});
|
|
131
|
-
spy_handler3_execute.callsFake((_action) => {
|
|
132
|
-
waitSync(100);
|
|
133
|
-
return [];
|
|
134
|
-
});
|
|
135
|
-
// Test execution
|
|
136
|
-
actionDispatcher.dispatch({ kind: action1 });
|
|
137
|
-
actionDispatcher.dispatch({ kind: action2 });
|
|
138
|
-
await actionDispatcher.dispatch({ kind: action3 });
|
|
139
|
-
// Check if all handlers have been called
|
|
140
|
-
(0, chai_1.expect)(spy_handler1_execute.calledOnce);
|
|
141
|
-
(0, chai_1.expect)(spy_handler2_execute.calledOnce);
|
|
142
|
-
(0, chai_1.expect)(spy_handler3_execute.calledOnce);
|
|
143
|
-
// Check if all handlers have been called in the right order
|
|
144
|
-
sinon.assert.callOrder(spy_handler1_execute, spy_handler2_execute, spy_handler3_execute);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
it('dispatch- one action & multiple handlers', async () => {
|
|
148
|
-
// Mock setup
|
|
149
|
-
const action1 = 'a1';
|
|
150
|
-
const handler1 = new mock.StubActionHandler([action1]);
|
|
151
|
-
const handler2 = new mock.StubActionHandler([action1]);
|
|
152
|
-
registry_get_stub.callsFake((kind) => (kind === action1 ? [handler1, handler2] : []));
|
|
153
|
-
const spy_handler1_execute = sinon.spy(handler1, 'execute');
|
|
154
|
-
const spy_handler2_execute = sinon.spy(handler2, 'execute');
|
|
155
|
-
// Test execution
|
|
156
|
-
await actionDispatcher.dispatch({ kind: action1 });
|
|
157
|
-
(0, chai_1.expect)(spy_handler1_execute.calledOnce);
|
|
158
|
-
(0, chai_1.expect)(spy_handler2_execute.calledOnce);
|
|
159
|
-
sinon.assert.callOrder(spy_handler1_execute, spy_handler2_execute);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
describe('test with handler response actions ', () => {
|
|
163
|
-
it('dispatch - one action & one handler response action', async () => {
|
|
164
|
-
// Mock setup
|
|
165
|
-
const request = 'request';
|
|
166
|
-
const response = 'response';
|
|
167
|
-
const requestHandler = new mock.StubActionHandler([request]);
|
|
168
|
-
const responseHandler = new mock.StubActionHandler([response]);
|
|
169
|
-
const spy_requestHandler_execute = sinon.stub(requestHandler, 'execute').returns([{ kind: response }]);
|
|
170
|
-
const spy_responseHandler_execute = sinon.spy(responseHandler, 'execute');
|
|
171
|
-
registry_get_stub.callsFake((kind) => {
|
|
172
|
-
switch (kind) {
|
|
173
|
-
case request:
|
|
174
|
-
return [requestHandler];
|
|
175
|
-
case response:
|
|
176
|
-
return [responseHandler];
|
|
177
|
-
default:
|
|
178
|
-
return [];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
// Test execution
|
|
182
|
-
await actionDispatcher.dispatch({ kind: request });
|
|
183
|
-
// Add a delay so that the action dispatcher has time to dispatch the handler response
|
|
184
|
-
await mock.delay(200);
|
|
185
|
-
// Check if all handlers have been called
|
|
186
|
-
(0, chai_1.expect)(spy_requestHandler_execute.calledOnce);
|
|
187
|
-
(0, chai_1.expect)(spy_responseHandler_execute.calledOnce);
|
|
188
|
-
});
|
|
189
|
-
it('dispatch - multiple actions & multiple response', async () => {
|
|
190
|
-
// Mock setup
|
|
191
|
-
const request1 = 'request1';
|
|
192
|
-
const request2 = 'request2';
|
|
193
|
-
const response1 = 'response1';
|
|
194
|
-
const response2 = 'response2';
|
|
195
|
-
const responseHandler1 = new mock.StubActionHandler([response1]);
|
|
196
|
-
const responseHandler2 = new mock.StubActionHandler([response2]);
|
|
197
|
-
const requestHandler1 = new mock.StubActionHandler([request1]);
|
|
198
|
-
const requestHandler2 = new mock.StubActionHandler([request2]);
|
|
199
|
-
const spy_requestHandler1_execute = sinon.stub(requestHandler1, 'execute').returns([{ kind: response1 }, { kind: response2 }]);
|
|
200
|
-
const spy_requestHandler2_execute = sinon.stub(requestHandler2, 'execute').returns([{ kind: response2 }]);
|
|
201
|
-
const spy_responseHandler1_execute = sinon.spy(responseHandler1, 'execute');
|
|
202
|
-
const spy_responseHandler2_execute = sinon.spy(responseHandler2, 'execute');
|
|
203
|
-
registry_get_stub.callsFake((kind) => {
|
|
204
|
-
switch (kind) {
|
|
205
|
-
case request1:
|
|
206
|
-
return [requestHandler1];
|
|
207
|
-
case request2:
|
|
208
|
-
return [requestHandler2];
|
|
209
|
-
case response1:
|
|
210
|
-
return [responseHandler1, responseHandler2];
|
|
211
|
-
case response2:
|
|
212
|
-
return [responseHandler2];
|
|
213
|
-
default:
|
|
214
|
-
return [];
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
// Test execution
|
|
218
|
-
actionDispatcher.dispatch({ kind: request1 });
|
|
219
|
-
await actionDispatcher.dispatch({ kind: request2 });
|
|
220
|
-
// Add a delay so that the action dispatcher has time to dispatch the handler response
|
|
221
|
-
await mock.delay(100);
|
|
222
|
-
// Check if all handlers have been called correctly
|
|
223
|
-
(0, chai_1.expect)(spy_requestHandler1_execute.calledOnce);
|
|
224
|
-
(0, chai_1.expect)(spy_requestHandler2_execute.calledOnce);
|
|
225
|
-
(0, chai_1.expect)(spy_responseHandler1_execute.calledOnce);
|
|
226
|
-
(0, chai_1.expect)(spy_responseHandler2_execute.calledThrice);
|
|
227
|
-
// Check if all handlers have been called in the right order
|
|
228
|
-
sinon.assert.callOrder(spy_requestHandler1_execute, spy_requestHandler2_execute);
|
|
229
|
-
sinon.assert.callOrder(spy_responseHandler1_execute, spy_responseHandler2_execute);
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
describe('test dispatch after next update', () => {
|
|
233
|
-
it('dispatchAfterNextUpdate', async () => {
|
|
234
|
-
// Mock setup
|
|
235
|
-
const updateModelAction = protocol_1.UpdateModelAction.create({ id: 'newRoot', type: 'myType' });
|
|
236
|
-
const intermediateAction = 'intermediate';
|
|
237
|
-
const postUpdateAction = 'postUpdate';
|
|
238
|
-
const handler = new mock.StubActionHandler([updateModelAction.kind, intermediateAction]);
|
|
239
|
-
const postUpdateHandler = new mock.StubActionHandler([postUpdateAction]);
|
|
240
|
-
const getHandler = (kind) => {
|
|
241
|
-
if (kind === updateModelAction.kind || kind === intermediateAction) {
|
|
242
|
-
return [handler];
|
|
243
|
-
}
|
|
244
|
-
else if (kind === postUpdateAction) {
|
|
245
|
-
return [postUpdateHandler];
|
|
246
|
-
}
|
|
247
|
-
return [];
|
|
248
|
-
};
|
|
249
|
-
registry_get_stub.callsFake(getHandler);
|
|
250
|
-
const spy_postUpdateHandler_execute = sinon.spy(postUpdateHandler, 'execute');
|
|
251
|
-
// Test execution
|
|
252
|
-
actionDispatcher.dispatchAfterNextUpdate({ kind: postUpdateAction });
|
|
253
|
-
(0, chai_1.expect)(spy_postUpdateHandler_execute.called).to.be.false;
|
|
254
|
-
await actionDispatcher.dispatch({ kind: intermediateAction });
|
|
255
|
-
(0, chai_1.expect)(spy_postUpdateHandler_execute.called).to.be.false;
|
|
256
|
-
await actionDispatcher.dispatch(updateModelAction);
|
|
257
|
-
(0, chai_1.expect)(spy_postUpdateHandler_execute.calledOnce);
|
|
258
|
-
// Check that action does not get dispatched again
|
|
259
|
-
await actionDispatcher.dispatch(updateModelAction);
|
|
260
|
-
(0, chai_1.expect)(spy_postUpdateHandler_execute.calledOnce);
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
//# sourceMappingURL=action-dispatcher.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
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,iBAAiB,CAAC,CAAC;iBAC9B;gBAED,OAAO,EAAE,CAAC;YACd,CAAC,CAAC;YACF,iBAAiB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YACxC,MAAM,6BAA6B,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;YAE9E,iBAAiB;YACjB,gBAAgB,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;YACrE,IAAA,aAAM,EAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;YACzD,MAAM,gBAAgB,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;YAC9D,IAAA,aAAM,EAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;YACzD,MAAM,gBAAgB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;YACnD,IAAA,aAAM,EAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;YACjD,kDAAkD;YAClD,MAAM,gBAAgB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;YACnD,IAAA,aAAM,EAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-handler-registry.spec.d.ts","sourceRoot":"","sources":["../../../src/common/actions/action-handler-registry.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/********************************************************************************
|
|
4
|
-
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
5
|
-
*
|
|
6
|
-
* This program and the accompanying materials are made available under the
|
|
7
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
8
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
9
|
-
*
|
|
10
|
-
* This Source Code may also be made available under the following Secondary
|
|
11
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
12
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
13
|
-
* with the GNU Classpath Exception which is available at
|
|
14
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
15
|
-
*
|
|
16
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
17
|
-
********************************************************************************/
|
|
18
|
-
const mock = require("../test/mock-util");
|
|
19
|
-
const action_handler_registry_1 = require("./action-handler-registry");
|
|
20
|
-
const chai_1 = require("chai");
|
|
21
|
-
describe('Test ActionHandlerRegistry (only functionality that is not covered by "registry.spec.ts"', () => {
|
|
22
|
-
const singleAction = 'singleHandledAction';
|
|
23
|
-
const multiAction = 'multiHandledAction';
|
|
24
|
-
const h1 = new mock.StubActionHandler([singleAction]);
|
|
25
|
-
const h2 = new mock.StubActionHandler([multiAction]);
|
|
26
|
-
const h3 = new mock.StubActionHandler([multiAction]);
|
|
27
|
-
const h4 = new mock.StubActionHandler([multiAction]);
|
|
28
|
-
const registry = new action_handler_registry_1.ActionHandlerRegistry();
|
|
29
|
-
it('registerHandler - should register given handlers', () => {
|
|
30
|
-
// setup
|
|
31
|
-
registry.registerHandler(h1);
|
|
32
|
-
registry.registerHandler(h2);
|
|
33
|
-
registry.registerHandler(h3);
|
|
34
|
-
registry.registerHandler(h4);
|
|
35
|
-
const result = registry.getAll();
|
|
36
|
-
(0, chai_1.expect)(result).to.have.length(4);
|
|
37
|
-
(0, chai_1.expect)(result.includes(h1)).true;
|
|
38
|
-
(0, chai_1.expect)(result.includes(h2)).true;
|
|
39
|
-
(0, chai_1.expect)(result.includes(h3)).true;
|
|
40
|
-
(0, chai_1.expect)(result.includes(h4)).true;
|
|
41
|
-
});
|
|
42
|
-
it('get - should return three handlers sorted by priority', () => {
|
|
43
|
-
const result = registry.get(multiAction);
|
|
44
|
-
(0, chai_1.expect)(result.length).to.be.equal(3);
|
|
45
|
-
(0, chai_1.expect)(result[0]).to.be.deep.equal(h4);
|
|
46
|
-
(0, chai_1.expect)(result[1]).to.be.deep.equal(h2);
|
|
47
|
-
(0, chai_1.expect)(result[2]).to.be.deep.equal(h3);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=action-handler-registry.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-handler-registry.spec.js","sourceRoot":"","sources":["../../../src/common/actions/action-handler-registry.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,0CAA0C;AAC1C,uEAAkE;AAClE,+BAA8B;AAE9B,QAAQ,CAAC,0FAA0F,EAAE,GAAG,EAAE;IACtG,MAAM,YAAY,GAAG,qBAAqB,CAAC;IAC3C,MAAM,WAAW,GAAG,oBAAoB,CAAC;IAEzC,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IACtD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,MAAM,QAAQ,GAA0B,IAAI,+CAAqB,EAAE,CAAC;IAEpE,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QACxD,QAAQ;QACR,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7B,QAAQ,CAAC,eAAe,CA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,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-action-provider.spec.d.ts","sourceRoot":"","sources":["../../../src/common/actions/global-action-provider.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/********************************************************************************
|
|
4
|
-
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
5
|
-
*
|
|
6
|
-
* This program and the accompanying materials are made available under the
|
|
7
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
8
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
9
|
-
*
|
|
10
|
-
* This Source Code may also be made available under the following Secondary
|
|
11
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
12
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
13
|
-
* with the GNU Classpath Exception which is available at
|
|
14
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
15
|
-
*
|
|
16
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
17
|
-
********************************************************************************/
|
|
18
|
-
const inversify_1 = require("inversify");
|
|
19
|
-
const service_identifiers_1 = require("../di/service-identifiers");
|
|
20
|
-
const client_session_initializer_1 = require("../session/client-session-initializer");
|
|
21
|
-
const mock = require("../test/mock-util");
|
|
22
|
-
const logger_1 = require("../utils/logger");
|
|
23
|
-
const action_handler_1 = require("./action-handler");
|
|
24
|
-
const action_handler_registry_1 = require("./action-handler-registry");
|
|
25
|
-
const global_action_provider_1 = require("./global-action-provider");
|
|
26
|
-
const sinon = require("sinon");
|
|
27
|
-
const chai_1 = require("chai");
|
|
28
|
-
describe('test DefaultGlobalActionProvider', () => {
|
|
29
|
-
const container = new inversify_1.Container();
|
|
30
|
-
const serverActions = ['A1', 'A2', 'A3'];
|
|
31
|
-
const clientActions = ['C1', 'C2'];
|
|
32
|
-
const diagramType = 'myDiagramType';
|
|
33
|
-
const handler1Actions = ['A1', 'A2'];
|
|
34
|
-
const handler2Actions = ['A2', 'A3'];
|
|
35
|
-
const h1 = new mock.StubActionHandler(handler1Actions);
|
|
36
|
-
const h2 = new mock.StubActionHandler(handler2Actions);
|
|
37
|
-
const handlerRegistry = new action_handler_registry_1.ActionHandlerRegistry();
|
|
38
|
-
sinon.stub(handlerRegistry, 'getAll').returns([h1, h2]);
|
|
39
|
-
const diagramModule1 = new inversify_1.ContainerModule(bind => {
|
|
40
|
-
bind(client_session_initializer_1.ClientSessionInitializer).toConstantValue(new mock.StubClientSessionInitializer());
|
|
41
|
-
bind(action_handler_1.ActionHandler).toConstantValue(new mock.StubActionHandler(handler1Actions));
|
|
42
|
-
bind(action_handler_1.ActionHandler).toConstantValue(new mock.StubActionHandler(handler2Actions));
|
|
43
|
-
bind(action_handler_registry_1.ActionHandlerRegistry).toConstantValue(handlerRegistry);
|
|
44
|
-
bind(service_identifiers_1.ClientActionKinds).toConstantValue(clientActions[0]);
|
|
45
|
-
bind(service_identifiers_1.ClientActionKinds).toConstantValue(clientActions[1]);
|
|
46
|
-
});
|
|
47
|
-
const diagramModules = new Map();
|
|
48
|
-
diagramModules.set(diagramType, [diagramModule1]);
|
|
49
|
-
container.load(new inversify_1.ContainerModule(bind => {
|
|
50
|
-
bind(logger_1.Logger).toConstantValue(new mock.StubLogger());
|
|
51
|
-
bind(service_identifiers_1.InjectionContainer).toConstantValue(container);
|
|
52
|
-
bind(service_identifiers_1.DiagramModules).toConstantValue(diagramModules);
|
|
53
|
-
}));
|
|
54
|
-
const actionProvider = container.resolve(global_action_provider_1.DefaultGlobalActionProvider);
|
|
55
|
-
it('serverActionsKinds', () => {
|
|
56
|
-
const result = actionProvider.serverActionKinds;
|
|
57
|
-
(0, chai_1.expect)(result.size).to.be.equal(1);
|
|
58
|
-
const resultServerActions = result.get(diagramType);
|
|
59
|
-
(0, chai_1.expect)(resultServerActions).to.not.be.undefined;
|
|
60
|
-
(0, chai_1.expect)(serverActions.every(action => resultServerActions.includes(action))).true;
|
|
61
|
-
});
|
|
62
|
-
it('clientActionKinds', () => {
|
|
63
|
-
const result = actionProvider.clientActionKinds;
|
|
64
|
-
(0, chai_1.expect)(result.size).to.be.equal(1);
|
|
65
|
-
const resultClientActions = result.get(diagramType);
|
|
66
|
-
(0, chai_1.expect)(resultClientActions).to.not.be.undefined;
|
|
67
|
-
(0, chai_1.expect)(clientActions.every(action => resultClientActions.includes(action))).true;
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
//# sourceMappingURL=global-action-provider.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-action-provider.spec.js","sourceRoot":"","sources":["../../../src/common/actions/global-action-provider.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAuD;AACvD,mEAAkG;AAClG,sFAAiF;AACjF,0CAA0C;AAC1C,4CAAyC;AACzC,qDAAiD;AACjD,uEAAkE;AAClE,qEAAuE;AACvE,+BAA+B;AAC/B,+BAA8B;AAE9B,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAC9C,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;IAClC,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzC,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,eAAe,CAAC;IAEpC,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACrC,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAErC,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAEvD,MAAM,eAAe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