@eclipse-glsp/server 1.1.0-next.d47240f.50 → 1.1.0-next.de91dcd.60
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/lib/browser/launch/worker-server-launcher.js +2 -3
- package/lib/browser/launch/worker-server-launcher.js.map +1 -1
- package/lib/common/actions/action-dispatcher.js +2 -3
- package/lib/common/actions/action-dispatcher.js.map +1 -1
- package/lib/common/actions/action-handler-registry.js +4 -6
- package/lib/common/actions/action-handler-registry.js.map +1 -1
- package/lib/common/actions/client-action-handler.js +2 -3
- package/lib/common/actions/client-action-handler.js.map +1 -1
- package/lib/common/actions/global-action-provider.js +2 -3
- package/lib/common/actions/global-action-provider.js.map +1 -1
- package/lib/common/command/command-stack.js +2 -3
- package/lib/common/command/command-stack.js.map +1 -1
- package/lib/common/command/command.js +1 -1
- package/lib/common/command/command.js.map +1 -1
- package/lib/common/command/undo-redo-action-handler.js +2 -3
- package/lib/common/command/undo-redo-action-handler.js.map +1 -1
- package/lib/common/di/binding-target.d.ts.map +1 -1
- package/lib/common/di/binding-target.js +3 -2
- package/lib/common/di/binding-target.js.map +1 -1
- package/lib/common/di/diagram-module.d.ts +3 -0
- package/lib/common/di/diagram-module.d.ts.map +1 -1
- package/lib/common/di/diagram-module.js +14 -5
- package/lib/common/di/diagram-module.js.map +1 -1
- package/lib/common/di/glsp-module.js +2 -3
- package/lib/common/di/glsp-module.js.map +1 -1
- package/lib/common/di/server-module.js.map +1 -1
- package/lib/common/diagram/diagram-configuration.js +1 -1
- package/lib/common/diagram/diagram-configuration.js.map +1 -1
- package/lib/common/diagram/request-type-hints-action-handler.js +2 -3
- package/lib/common/diagram/request-type-hints-action-handler.js.map +1 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js +2 -3
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js.map +1 -1
- package/lib/common/features/contextactions/command-palette-action-provider.js +2 -3
- package/lib/common/features/contextactions/command-palette-action-provider.js.map +1 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.js +2 -3
- package/lib/common/features/contextactions/context-actions-provider-registry.js.map +1 -1
- package/lib/common/features/contextactions/context-menu-item-provider.js +2 -3
- package/lib/common/features/contextactions/context-menu-item-provider.js.map +1 -1
- package/lib/common/features/contextactions/request-context-actions-handler.js +2 -3
- package/lib/common/features/contextactions/request-context-actions-handler.js.map +1 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.js +4 -6
- package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
- package/lib/common/features/directediting/context-edit-validator-registry.js +2 -3
- package/lib/common/features/directediting/context-edit-validator-registry.js.map +1 -1
- package/lib/common/features/directediting/label-edit-validator.js +2 -3
- package/lib/common/features/directediting/label-edit-validator.js.map +1 -1
- package/lib/common/features/directediting/request-edit-validation-handler.js +2 -3
- package/lib/common/features/directediting/request-edit-validation-handler.js.map +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js +2 -3
- package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
- package/lib/common/features/layout/layout-operation-handler.js +2 -3
- package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
- package/lib/common/features/model/gmodel-factory.js +2 -3
- package/lib/common/features/model/gmodel-factory.js.map +1 -1
- package/lib/common/features/model/gmodel-index.js +2 -3
- package/lib/common/features/model/gmodel-index.js.map +1 -1
- package/lib/common/features/model/gmodel-serializer.js +2 -3
- package/lib/common/features/model/gmodel-serializer.js.map +1 -1
- package/lib/common/features/model/model-state.js +2 -3
- package/lib/common/features/model/model-state.js.map +1 -1
- package/lib/common/features/model/model-submission-handler.d.ts +2 -0
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +12 -3
- package/lib/common/features/model/model-submission-handler.js.map +1 -1
- package/lib/common/features/model/request-model-action-handler.d.ts +4 -6
- package/lib/common/features/model/request-model-action-handler.d.ts.map +1 -1
- package/lib/common/features/model/request-model-action-handler.js +16 -14
- package/lib/common/features/model/request-model-action-handler.js.map +1 -1
- package/lib/common/features/model/save-model-action-handler.js +2 -3
- package/lib/common/features/model/save-model-action-handler.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-provider-registry.js +2 -3
- package/lib/common/features/navigation/navigation-target-provider-registry.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-resolver.js +2 -3
- package/lib/common/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/common/features/navigation/request-navigation-targets-action-handler.js +2 -3
- package/lib/common/features/navigation/request-navigation-targets-action-handler.js.map +1 -1
- package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js +2 -3
- package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js.map +1 -1
- package/lib/common/features/popup/request-popup-model-action-handler.js +2 -3
- package/lib/common/features/popup/request-popup-model-action-handler.js.map +1 -1
- package/lib/common/features/progress/progress-service.d.ts +44 -0
- package/lib/common/features/progress/progress-service.d.ts.map +1 -0
- package/lib/common/features/progress/progress-service.js +50 -0
- package/lib/common/features/progress/progress-service.js.map +1 -0
- package/lib/common/features/validation/model-validator.d.ts +47 -2
- package/lib/common/features/validation/model-validator.d.ts.map +1 -1
- package/lib/common/features/validation/model-validator.js +79 -1
- package/lib/common/features/validation/model-validator.js.map +1 -1
- package/lib/common/features/validation/request-markers-handler.d.ts +15 -0
- package/lib/common/features/validation/request-markers-handler.d.ts.map +1 -1
- package/lib/common/features/validation/request-markers-handler.js +5 -12
- package/lib/common/features/validation/request-markers-handler.js.map +1 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.js +2 -3
- package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-bounds-operation-handler.js +2 -3
- package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.js +2 -3
- package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
- package/lib/common/gmodel/cut-operation-handler.js +2 -3
- package/lib/common/gmodel/cut-operation-handler.js.map +1 -1
- package/lib/common/gmodel/delete-operation-handler.js +2 -3
- package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +2 -3
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js +2 -3
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-diagram-module.js +2 -3
- package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
- package/lib/common/gmodel/gmodel-operation-handler.js +1 -1
- package/lib/common/gmodel/gmodel-operation-handler.js.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.js +2 -3
- package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.js +2 -3
- package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
- package/lib/common/launch/glsp-server-launcher.js +2 -3
- package/lib/common/launch/glsp-server-launcher.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.js +2 -3
- package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -1
- package/lib/common/operations/compound-operation-handler.js +6 -12
- package/lib/common/operations/compound-operation-handler.js.map +1 -1
- package/lib/common/operations/create-operation-handler.js +1 -1
- package/lib/common/operations/create-operation-handler.js.map +1 -1
- package/lib/common/operations/operation-action-handler.js +2 -3
- package/lib/common/operations/operation-action-handler.js.map +1 -1
- package/lib/common/operations/operation-handler-registry.js +4 -6
- package/lib/common/operations/operation-handler-registry.js.map +1 -1
- package/lib/common/operations/operation-handler.js +2 -3
- package/lib/common/operations/operation-handler.js.map +1 -1
- package/lib/common/protocol/glsp-server.js +2 -3
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/session/client-session-factory.js +2 -3
- package/lib/common/session/client-session-factory.js.map +1 -1
- package/lib/common/session/client-session-manager.js +2 -3
- package/lib/common/session/client-session-manager.js.map +1 -1
- package/lib/common/utils/args-util.js +2 -2
- package/lib/common/utils/args-util.js.map +1 -1
- package/lib/common/utils/console-logger.js +2 -3
- package/lib/common/utils/console-logger.js.map +1 -1
- package/lib/common/utils/logger.d.ts.map +1 -1
- package/lib/common/utils/logger.js +5 -5
- package/lib/common/utils/logger.js.map +1 -1
- package/lib/common/utils/registry.js +4 -6
- package/lib/common/utils/registry.js.map +1 -1
- package/lib/node/abstract-json-model-storage.js +2 -3
- package/lib/node/abstract-json-model-storage.js.map +1 -1
- package/lib/node/gmodel/gmodel-storage.js +2 -3
- package/lib/node/gmodel/gmodel-storage.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +2 -3
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.js +2 -3
- package/lib/node/launch/websocket-server-launcher.js.map +1 -1
- package/package.json +6 -4
- package/src/common/di/binding-target.ts +1 -0
- package/src/common/di/diagram-module.ts +20 -7
- package/src/common/features/model/model-submission-handler.ts +12 -0
- package/src/common/features/model/request-model-action-handler.ts +16 -15
- package/src/common/features/progress/progress-service.ts +74 -0
- package/src/common/features/validation/model-validator.ts +75 -3
- package/src/common/features/validation/request-markers-handler.ts +4 -10
- package/src/common/utils/args-util.ts +1 -1
- package/src/common/utils/logger.ts +2 -1
- 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gmodel-serializer.spec.d.ts","sourceRoot":"","sources":["../../../../src/common/features/model/gmodel-serializer.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,124 +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 graph_1 = require("@eclipse-glsp/graph");
|
|
19
|
-
const chai_1 = require("chai");
|
|
20
|
-
const inversify_1 = require("inversify");
|
|
21
|
-
const diagram_configuration_1 = require("../../diagram/diagram-configuration");
|
|
22
|
-
const mock = require("../../test/mock-util");
|
|
23
|
-
const glsp_server_error_1 = require("../../utils/glsp-server-error");
|
|
24
|
-
const logger_1 = require("../../utils/logger");
|
|
25
|
-
const gmodel_serializer_1 = require("./gmodel-serializer");
|
|
26
|
-
class TestNode extends graph_1.GNode {
|
|
27
|
-
foo() {
|
|
28
|
-
// should not be serialized to schema
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
let testRootSchema;
|
|
32
|
-
let testNodeSchema;
|
|
33
|
-
let testNodeSchemaWithParent;
|
|
34
|
-
describe('test DefaultGModelSerializer', () => {
|
|
35
|
-
const container = new inversify_1.Container();
|
|
36
|
-
const diagramConfiguration = new mock.StubDiagramConfiguration();
|
|
37
|
-
diagramConfiguration['typeMapping'] = (0, graph_1.getDefaultMapping)();
|
|
38
|
-
diagramConfiguration.typeMapping.set('node', TestNode);
|
|
39
|
-
container.load(new inversify_1.ContainerModule(bind => {
|
|
40
|
-
bind(logger_1.Logger).toConstantValue(new mock.StubLogger());
|
|
41
|
-
bind(diagram_configuration_1.DiagramConfiguration).toConstantValue(diagramConfiguration);
|
|
42
|
-
}));
|
|
43
|
-
const serializer = container.resolve(gmodel_serializer_1.DefaultGModelSerializer);
|
|
44
|
-
beforeEach(() => {
|
|
45
|
-
testRootSchema = {
|
|
46
|
-
id: 'graph',
|
|
47
|
-
type: 'graph',
|
|
48
|
-
children: [
|
|
49
|
-
{ id: 'node1', type: 'node', position: { x: 5, y: 10 } },
|
|
50
|
-
{ id: 'node2', type: 'node', position: { x: 15, y: 5 } },
|
|
51
|
-
{ id: 'edge1', type: 'edge', sourceId: 'node1', targetId: 'node2' }
|
|
52
|
-
]
|
|
53
|
-
};
|
|
54
|
-
testNodeSchema = { id: 'node1', type: 'node', position: { x: 5, y: 10 }, children: [], cssClasses: [] };
|
|
55
|
-
testNodeSchemaWithParent = {
|
|
56
|
-
id: 'node1',
|
|
57
|
-
type: 'node',
|
|
58
|
-
position: { x: 5, y: 10 },
|
|
59
|
-
children: [],
|
|
60
|
-
cssClasses: [],
|
|
61
|
-
parent: new graph_1.GNode()
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
it('createElement - unregistered type', () => {
|
|
65
|
-
testNodeSchema['type'] = 'notRegistered';
|
|
66
|
-
(0, chai_1.expect)(() => serializer.createElement(testNodeSchema)).to.throw(glsp_server_error_1.GLSPServerError);
|
|
67
|
-
});
|
|
68
|
-
it('createElement - with root schema', () => {
|
|
69
|
-
(0, chai_1.expect)(() => serializer.createElement(testRootSchema)).to.throw(glsp_server_error_1.GLSPServerError);
|
|
70
|
-
});
|
|
71
|
-
it('createElement - with node schema', () => {
|
|
72
|
-
const node = serializer.createElement(testNodeSchema);
|
|
73
|
-
(0, chai_1.expect)(node).to.be.an.instanceOf(TestNode);
|
|
74
|
-
(0, chai_1.expect)(node).to.be.deep.include(testNodeSchema);
|
|
75
|
-
(0, chai_1.expect)(node.foo).to.not.be.undefined;
|
|
76
|
-
});
|
|
77
|
-
it('createElement- with sub type of registered schema', () => {
|
|
78
|
-
testNodeSchema.type = 'node:rectangular';
|
|
79
|
-
const node = serializer.createElement(testNodeSchema);
|
|
80
|
-
(0, chai_1.expect)(node).to.be.an.instanceOf(TestNode);
|
|
81
|
-
(0, chai_1.expect)(node).to.be.deep.include(testNodeSchema);
|
|
82
|
-
(0, chai_1.expect)(node.foo).to.not.be.undefined;
|
|
83
|
-
});
|
|
84
|
-
it('createElement - with parent', () => {
|
|
85
|
-
const parent = new graph_1.GNode();
|
|
86
|
-
const child = serializer.createElement(testNodeSchema, parent);
|
|
87
|
-
(0, chai_1.expect)(child).to.be.an.instanceOf(TestNode);
|
|
88
|
-
(0, chai_1.expect)(child).to.be.deep.include(testNodeSchemaWithParent);
|
|
89
|
-
(0, chai_1.expect)(child.parent).to.be.equal(parent);
|
|
90
|
-
});
|
|
91
|
-
it('createRoot - unregistered type', () => {
|
|
92
|
-
testRootSchema['type'] = 'notRegistered';
|
|
93
|
-
(0, chai_1.expect)(() => serializer.createRoot(testNodeSchema)).to.throw(glsp_server_error_1.GLSPServerError);
|
|
94
|
-
});
|
|
95
|
-
it('createRoot - with child schema ', () => {
|
|
96
|
-
(0, chai_1.expect)(() => serializer.createRoot(testNodeSchema)).to.throw(glsp_server_error_1.GLSPServerError);
|
|
97
|
-
});
|
|
98
|
-
it('createRoot - with registered root schema', () => {
|
|
99
|
-
const root = serializer.createRoot(testRootSchema);
|
|
100
|
-
(0, chai_1.expect)(root).to.be.an.instanceOf(graph_1.GGraph);
|
|
101
|
-
(0, chai_1.expect)(root.children.length).to.be.equal(3);
|
|
102
|
-
const node1 = root.children[0];
|
|
103
|
-
(0, chai_1.expect)(node1).to.be.an.instanceOf(TestNode);
|
|
104
|
-
const node2 = root.children[1];
|
|
105
|
-
(0, chai_1.expect)(node2).to.be.an.instanceOf(TestNode);
|
|
106
|
-
(0, chai_1.expect)(root.children[2]).to.be.an.instanceOf(graph_1.GEdge);
|
|
107
|
-
const edge = root.children[2];
|
|
108
|
-
(0, chai_1.expect)(edge.sourceId).to.be.equal(node1.id);
|
|
109
|
-
(0, chai_1.expect)(edge.targetId).to.be.equal(node2.id);
|
|
110
|
-
});
|
|
111
|
-
it('createSchema- unregistered type', () => {
|
|
112
|
-
(0, chai_1.expect)(() => serializer.createRoot({ id: 'id', type: 'unregistered' })).to.throw(glsp_server_error_1.GLSPServerError);
|
|
113
|
-
});
|
|
114
|
-
it('createSchema- with node', () => {
|
|
115
|
-
const testNode = new TestNode();
|
|
116
|
-
testNode.position = { x: 5, y: 10 };
|
|
117
|
-
testNode.size = { width: 10, height: 100 };
|
|
118
|
-
testNode.layoutOptions = { ['my']: 'Options' };
|
|
119
|
-
const schema = serializer.createSchema(testNode);
|
|
120
|
-
delete testNode.foo;
|
|
121
|
-
(0, chai_1.expect)(schema).to.be.deep.include(testNode);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
//# sourceMappingURL=gmodel-serializer.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gmodel-serializer.spec.js","sourceRoot":"","sources":["../../../../src/common/features/model/gmodel-serializer.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,+CAA8E;AAC9E,+BAA8B;AAC9B,yCAAuD;AACvD,+EAA2E;AAC3E,6CAA6C;AAC7C,qEAAgE;AAChE,+CAA4C;AAC5C,2DAA8D;AAE9D,MAAM,QAAS,SAAQ,aAAK;IACxB,GAAG;QACC,qCAAqC;IACzC,CAAC;CACJ;AAED,IAAI,cAAmB,CAAC;AAExB,IAAI,cAAmB,CAAC;AAExB,IAAI,wBAA6B,CAAC;AAElC,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC1C,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;IAClC,MAAM,oBAAoB,GAAG,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;IACjE,oBAAoB,CAAC,aAAa,CAAC,GAAG,IAAA,yBAAiB,GAAE,CAAC;IAC1D,oBAAoB,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,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IAAA,aAAM,EAAC,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mCAAe,CAAC,CAAC;IACtG,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QAC/B,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAChC,QAAQ,CAAC,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;QACpC,QAAQ,CAAC,IAAI,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;QAC3C,QAAQ,CAAC,aAAa,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAQ,QAA8B,CAAC,GAAG,CAAC;QAC3C,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-handler-registry.spec.d.ts","sourceRoot":"","sources":["../../../src/common/operations/operation-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 protocol_1 = require("@eclipse-glsp/protocol");
|
|
19
|
-
const chai_1 = require("chai");
|
|
20
|
-
const mock = require("../test/mock-util");
|
|
21
|
-
const compound_operation_handler_1 = require("./compound-operation-handler");
|
|
22
|
-
const operation_handler_registry_1 = require("./operation-handler-registry");
|
|
23
|
-
describe('Test OperationHandlerRegistry', () => {
|
|
24
|
-
const stubANode = new mock.StubCreateNodeOperationHandler('ANode');
|
|
25
|
-
const stubBNode = new mock.StubCreateNodeOperationHandler('BNode');
|
|
26
|
-
const stubAEdge = new mock.StubCreateEdgeOperationHandler('AEdge');
|
|
27
|
-
const stubBEdge = new mock.StubCreateEdgeOperationHandler('BEdge');
|
|
28
|
-
const operationHandlerRegistry = new operation_handler_registry_1.OperationHandlerRegistry();
|
|
29
|
-
it('register OperationActionHandler', () => {
|
|
30
|
-
operationHandlerRegistry.registerHandler(new compound_operation_handler_1.CompoundOperationHandler());
|
|
31
|
-
(0, chai_1.expect)(operationHandlerRegistry.keys()).to.have.length(1);
|
|
32
|
-
(0, chai_1.expect)(operationHandlerRegistry.keys()).to.contain(protocol_1.CompoundOperation.KIND);
|
|
33
|
-
(0, chai_1.expect)(operationHandlerRegistry.get(protocol_1.CompoundOperation.KIND)).to.be.an.instanceOf(compound_operation_handler_1.CompoundOperationHandler);
|
|
34
|
-
});
|
|
35
|
-
it('register CreateOperationActionHandlers', () => {
|
|
36
|
-
operationHandlerRegistry.registerHandler(stubANode);
|
|
37
|
-
operationHandlerRegistry.registerHandler(stubBNode);
|
|
38
|
-
operationHandlerRegistry.registerHandler(stubAEdge);
|
|
39
|
-
operationHandlerRegistry.registerHandler(stubBEdge);
|
|
40
|
-
(0, chai_1.expect)(operationHandlerRegistry.keys()).to.contain(`${protocol_1.CreateNodeOperation.KIND}_ANode`);
|
|
41
|
-
(0, chai_1.expect)(operationHandlerRegistry.get(`${protocol_1.CreateNodeOperation.KIND}_ANode`)).to.be.equal(stubANode);
|
|
42
|
-
(0, chai_1.expect)(operationHandlerRegistry.keys()).to.contain(`${protocol_1.CreateNodeOperation.KIND}_BNode`);
|
|
43
|
-
(0, chai_1.expect)(operationHandlerRegistry.get(`${protocol_1.CreateNodeOperation.KIND}_BNode`)).to.be.equal(stubBNode);
|
|
44
|
-
(0, chai_1.expect)(operationHandlerRegistry.keys()).to.contain(`${protocol_1.CreateEdgeOperation.KIND}_AEdge`);
|
|
45
|
-
(0, chai_1.expect)(operationHandlerRegistry.get(`${protocol_1.CreateEdgeOperation.KIND}_AEdge`)).to.be.equal(stubAEdge);
|
|
46
|
-
(0, chai_1.expect)(operationHandlerRegistry.keys()).to.contain(`${protocol_1.CreateEdgeOperation.KIND}_BEdge`);
|
|
47
|
-
(0, chai_1.expect)(operationHandlerRegistry.get(`${protocol_1.CreateEdgeOperation.KIND}_BEdge`)).to.be.equal(stubBEdge);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=operation-handler-registry.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-handler-registry.spec.js","sourceRoot":"","sources":["../../../src/common/operations/operation-handler-registry.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAqG;AACrG,+BAA8B;AAC9B,0CAA0C;AAC1C,6EAAwE;AACxE,6EAAwE;AAExE,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC3C,MAAM,SAAS,GAAG,IAAI,IAA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
"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 global_action_provider_1 = require("../actions/global-action-provider");
|
|
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 glsp_server_1 = require("./glsp-server");
|
|
27
|
-
const assert = require("assert");
|
|
28
|
-
describe('test DefaultGLSPServer', () => {
|
|
29
|
-
const container = new inversify_1.Container();
|
|
30
|
-
const clientSessionId = 'myClientSession';
|
|
31
|
-
const diagramType = 'myDiagram';
|
|
32
|
-
const applicationId = 'Test';
|
|
33
|
-
const protocolVersion = '1.0.0';
|
|
34
|
-
const serverActionKinds = new Map();
|
|
35
|
-
serverActionKinds.set(diagramType, ['A1', 'A2']);
|
|
36
|
-
const sessionManager = new mock.StubClientSessionManager();
|
|
37
|
-
const spy_sessionManager_getOrCreate = sinon.spy(sessionManager, 'getOrCreateClientSession');
|
|
38
|
-
const spy_sessionManager_dispose = sinon.spy(sessionManager, 'disposeClientSession');
|
|
39
|
-
const listener1 = new mock.StubGLSPServerListener();
|
|
40
|
-
const spy_listener1_initialize = sinon.spy(listener1, 'serverInitialized');
|
|
41
|
-
const spy_listener1_shutdown = sinon.spy(listener1, 'serverShutDown');
|
|
42
|
-
const listener2 = new mock.StubGLSPServerListener();
|
|
43
|
-
const spy_listener2_initialize = sinon.spy(listener2, 'serverInitialized');
|
|
44
|
-
const spy_listener2_shutdown = sinon.spy(listener2, 'serverShutDown');
|
|
45
|
-
container.load(new inversify_1.ContainerModule(bind => {
|
|
46
|
-
bind(logger_1.Logger).toConstantValue(new mock.StubLogger());
|
|
47
|
-
bind(protocol_1.GLSPClientProxy).toConstantValue(new mock.StubGLSPClientProxy());
|
|
48
|
-
bind(client_session_manager_1.ClientSessionManager).toConstantValue(sessionManager);
|
|
49
|
-
bind(global_action_provider_1.GlobalActionProvider).toConstantValue({ clientActionKinds: new Map(), serverActionKinds });
|
|
50
|
-
bind(protocol_1.GLSPServerListener).toConstantValue(listener1);
|
|
51
|
-
}));
|
|
52
|
-
const glspServer = container.resolve(glsp_server_1.DefaultGLSPServer);
|
|
53
|
-
beforeEach(() => {
|
|
54
|
-
spy_sessionManager_getOrCreate.restore();
|
|
55
|
-
spy_sessionManager_dispose.restore();
|
|
56
|
-
spy_listener1_initialize.restore();
|
|
57
|
-
spy_listener1_shutdown.restore();
|
|
58
|
-
spy_listener2_initialize.restore();
|
|
59
|
-
spy_listener2_shutdown.restore();
|
|
60
|
-
});
|
|
61
|
-
it('Test calls before server initialization (should throw errors)', async () => {
|
|
62
|
-
assert.rejects(() => glspServer.initializeClientSession({ clientSessionId: 'id', diagramType: 'type' }));
|
|
63
|
-
assert.rejects(() => glspServer.disposeClientSession({ clientSessionId: 'id' }));
|
|
64
|
-
assert.throws(() => glspServer.process({ clientId: 'id', action: { kind: 'action' } }));
|
|
65
|
-
});
|
|
66
|
-
it('addListener - add existing listener', () => {
|
|
67
|
-
const originalSize = glspServer['serverListeners'].length;
|
|
68
|
-
glspServer.addListener(listener1);
|
|
69
|
-
(0, chai_1.expect)(glspServer['serverListeners'].length).to.be.equal(originalSize);
|
|
70
|
-
});
|
|
71
|
-
it('addListener - add new listener', () => {
|
|
72
|
-
const originalSize = glspServer['serverListeners'].length;
|
|
73
|
-
glspServer.addListener(listener2);
|
|
74
|
-
(0, chai_1.expect)(glspServer['serverListeners']).to.include(listener2);
|
|
75
|
-
(0, chai_1.expect)(glspServer['serverListeners'].length).to.be.equal(originalSize + 1);
|
|
76
|
-
});
|
|
77
|
-
it('removeListener - remove non-existing listener', () => {
|
|
78
|
-
const originalSize = glspServer['serverListeners'].length;
|
|
79
|
-
glspServer.removeListener({});
|
|
80
|
-
(0, chai_1.expect)(glspServer['serverListeners'].length).to.be.equal(originalSize);
|
|
81
|
-
});
|
|
82
|
-
it('removeListener - remove existing listener', () => {
|
|
83
|
-
const originalSize = glspServer['serverListeners'].length;
|
|
84
|
-
glspServer.removeListener(listener2);
|
|
85
|
-
(0, chai_1.expect)(glspServer['serverListeners'].length).to.be.equal(originalSize - 1);
|
|
86
|
-
});
|
|
87
|
-
it('initialize - with wrong protocol version', async () => {
|
|
88
|
-
const initializeParameters = { applicationId, protocolVersion: 'abc' };
|
|
89
|
-
assert.rejects(glspServer.initialize(initializeParameters));
|
|
90
|
-
});
|
|
91
|
-
it('initialize - with correct parameters', async () => {
|
|
92
|
-
const initializeParameters = { applicationId, protocolVersion };
|
|
93
|
-
const result = await glspServer.initialize(initializeParameters);
|
|
94
|
-
(0, chai_1.expect)(result.protocolVersion).to.be.equal(protocolVersion);
|
|
95
|
-
(0, chai_1.expect)(result.serverActions[diagramType]).to.be.equal(serverActionKinds.get(diagramType));
|
|
96
|
-
(0, chai_1.expect)(result.serverActions[diagramType]).to.be.equal(serverActionKinds.get(diagramType));
|
|
97
|
-
(0, chai_1.expect)(spy_listener1_initialize.calledWith(glspServer));
|
|
98
|
-
(0, chai_1.expect)(spy_listener2_initialize.notCalled);
|
|
99
|
-
});
|
|
100
|
-
it('initialize - subsequent call with same parameters', async () => {
|
|
101
|
-
const initializeParameters = { applicationId, protocolVersion };
|
|
102
|
-
const result = await glspServer.initialize(initializeParameters);
|
|
103
|
-
(0, chai_1.expect)(result.protocolVersion).to.be.equal(protocolVersion);
|
|
104
|
-
(0, chai_1.expect)(result.serverActions[diagramType]).to.be.equal(serverActionKinds.get(diagramType));
|
|
105
|
-
(0, chai_1.expect)(result.serverActions[diagramType]).to.be.equal(serverActionKinds.get(diagramType));
|
|
106
|
-
});
|
|
107
|
-
it('initialize - subsequent call with other parameters', async () => {
|
|
108
|
-
const initializeParameters = { applicationId: 'someOtherApp', protocolVersion: 'AnotherProtocolVersion' };
|
|
109
|
-
await assert.rejects(() => glspServer.initialize(initializeParameters));
|
|
110
|
-
});
|
|
111
|
-
it('initialize client session', async () => {
|
|
112
|
-
const initializeClientSessionParameters = {
|
|
113
|
-
clientSessionId,
|
|
114
|
-
diagramType
|
|
115
|
-
};
|
|
116
|
-
await glspServer.initializeClientSession(initializeClientSessionParameters);
|
|
117
|
-
(0, chai_1.expect)(spy_sessionManager_getOrCreate.calledWith(initializeClientSessionParameters));
|
|
118
|
-
});
|
|
119
|
-
it('dispose client session', async () => {
|
|
120
|
-
const disposeClientSessionParameters = {
|
|
121
|
-
clientSessionId
|
|
122
|
-
};
|
|
123
|
-
await glspServer.disposeClientSession(disposeClientSessionParameters);
|
|
124
|
-
(0, chai_1.expect)(spy_sessionManager_dispose.calledWith(clientSessionId));
|
|
125
|
-
});
|
|
126
|
-
it('shutdown server', async () => {
|
|
127
|
-
glspServer.shutdown();
|
|
128
|
-
(0, chai_1.expect)(spy_listener1_shutdown.calledWith(glspServer));
|
|
129
|
-
(0, chai_1.expect)(spy_listener2_shutdown.notCalled);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
//# sourceMappingURL=glsp-server.spec.js.map
|
|
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iCAAiC,GAAsC;YACzE,eAAe;YACf,WAAW;SACd,CAAC;QACF,MAAM,UAAU,CAAC,uBAAuB,CAAC,iCAAiC,CAAC,CAAC;QAC5E,IAAA,aAAM,EAAC,8BAA8B,CAAC,UAAU,CAAC,iCAAiC,CAAC,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,8BAA8B,GAAmC;YACnE,eAAe;SAClB,CAAC;QACF,MAAM,UAAU,CAAC,oBAAoB,CAAC,8BAA8B,CAAC,CAAC;QACtE,IAAA,aAAM,EAAC,0BAA0B,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;QAC7B,UAAU,CAAC,QAAQ,EAAE,CAAC;QACtB,IAAA,aAAM,EAAC,sBAAsB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;QACtD,IAAA,aAAM,EAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-session-factory.spec.d.ts","sourceRoot":"","sources":["../../../src/common/session/client-session-factory.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,56 +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 action_dispatcher_1 = require("../actions/action-dispatcher");
|
|
22
|
-
const service_identifiers_1 = require("../di/service-identifiers");
|
|
23
|
-
const mock = require("../test/mock-util");
|
|
24
|
-
const glsp_server_error_1 = require("../utils/glsp-server-error");
|
|
25
|
-
const logger_1 = require("../utils/logger");
|
|
26
|
-
const client_session_factory_1 = require("./client-session-factory");
|
|
27
|
-
const client_session_initializer_1 = require("./client-session-initializer");
|
|
28
|
-
describe('test DefaultClientSessionFactory', () => {
|
|
29
|
-
const clientSessionId = 'myClientId';
|
|
30
|
-
const diagramType = 'myDiagramType';
|
|
31
|
-
const container = new inversify_1.Container();
|
|
32
|
-
const diagramModule = new inversify_1.ContainerModule(bind => {
|
|
33
|
-
bind(action_dispatcher_1.ActionDispatcher).toConstantValue(new mock.StubActionDispatcher());
|
|
34
|
-
bind(client_session_initializer_1.ClientSessionInitializer).toConstantValue(new mock.StubClientSessionInitializer());
|
|
35
|
-
});
|
|
36
|
-
const diagramModules = new Map();
|
|
37
|
-
diagramModules.set(diagramType, [diagramModule]);
|
|
38
|
-
container.load(new inversify_1.ContainerModule(bind => {
|
|
39
|
-
bind(logger_1.Logger).toConstantValue(new mock.StubLogger());
|
|
40
|
-
bind(service_identifiers_1.InjectionContainer).toConstantValue(container);
|
|
41
|
-
bind(service_identifiers_1.DiagramModules).toConstantValue(diagramModules);
|
|
42
|
-
bind(protocol_1.GLSPClientProxy).toConstantValue(new mock.StubGLSPClientProxy());
|
|
43
|
-
}));
|
|
44
|
-
const factory = container.resolve(client_session_factory_1.DefaultClientSessionFactory);
|
|
45
|
-
it('create - new client session', () => {
|
|
46
|
-
const session = factory.create({ clientSessionId, diagramType });
|
|
47
|
-
(0, chai_1.expect)(session.id).to.be.equal(clientSessionId);
|
|
48
|
-
(0, chai_1.expect)(session.diagramType).to.be.equal(diagramType);
|
|
49
|
-
(0, chai_1.expect)(session.container.parent).to.be.equal(container);
|
|
50
|
-
(0, chai_1.expect)(session.actionDispatcher).to.be.an.instanceOf(mock.StubActionDispatcher);
|
|
51
|
-
});
|
|
52
|
-
it('create - unknown diagram type', () => {
|
|
53
|
-
(0, chai_1.expect)(() => factory.create({ clientSessionId, diagramType: 'unknown-type' })).to.throw(glsp_server_error_1.GLSPServerError);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=client-session-factory.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-session-factory.spec.js","sourceRoot":"","sources":["../../../src/common/session/client-session-factory.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAyD;AACzD,+BAA8B;AAC9B,yCAAuD;AACvD,oEAAgE;AAChE,mEAA+E;AAC/E,0CAA0C;AAC1C,kEAA6D;AAC7D,4CAAyC;AACzC,qEAAuE;AACvE,6EAAwE;AAExE,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAC9C,MAAM,eAAe,GAAG,YAAY,CAAC;IACrC,MAAM,WAAW,GAAG,eAAe,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;IAClC,MAAM,aAAa,GAAG,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;QAC7C,IAAI,CAAC,oCAAgB,CAAC,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,qDAAwB,CAAC,CAAC,eAAe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CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACrC,IAAA,aAAM,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mCAAe,CAAC,CAAC;IAC7G,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-session-manager.spec.d.ts","sourceRoot":"","sources":["../../../src/common/session/client-session-manager.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,74 +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 mock = require("../test/mock-util");
|
|
20
|
-
const logger_1 = require("../utils/logger");
|
|
21
|
-
const client_session_factory_1 = require("./client-session-factory");
|
|
22
|
-
const client_session_manager_1 = require("./client-session-manager");
|
|
23
|
-
const chai_1 = require("chai");
|
|
24
|
-
const sinon = require("sinon");
|
|
25
|
-
describe('test DefaultClientSessionManager', () => {
|
|
26
|
-
const testSession = mock.createClientSession('myId', 'myDiagram');
|
|
27
|
-
const testSessionListener = new mock.StubClientSessionListener();
|
|
28
|
-
const sessionFactory = new mock.StubClientSessionFactory();
|
|
29
|
-
sinon.stub(sessionFactory, 'create').returns(testSession);
|
|
30
|
-
const container = new inversify_1.Container();
|
|
31
|
-
container.load(new inversify_1.ContainerModule(bind => {
|
|
32
|
-
bind(logger_1.Logger).toConstantValue(new mock.StubLogger());
|
|
33
|
-
bind(client_session_factory_1.ClientSessionFactory).toConstantValue(sessionFactory);
|
|
34
|
-
}));
|
|
35
|
-
const sessionManager = container.resolve(client_session_manager_1.DefaultClientSessionManager);
|
|
36
|
-
it('add listener', () => {
|
|
37
|
-
(0, chai_1.expect)(sessionManager.addListener(testSessionListener, testSession.id)).true;
|
|
38
|
-
});
|
|
39
|
-
it('add create client session', () => {
|
|
40
|
-
// Mock setup
|
|
41
|
-
const listener_create = sinon.spy(testSessionListener, 'sessionCreated');
|
|
42
|
-
// Test execution
|
|
43
|
-
const createdSession = sessionManager.getOrCreateClientSession({
|
|
44
|
-
clientSessionId: testSession.id,
|
|
45
|
-
diagramType: testSession.diagramType
|
|
46
|
-
});
|
|
47
|
-
(0, chai_1.expect)(createdSession).to.not.be.undefined;
|
|
48
|
-
(0, chai_1.expect)(createdSession.id).to.be.equal(testSession.id);
|
|
49
|
-
(0, chai_1.expect)(createdSession.diagramType).to.be.equal(testSession.diagramType);
|
|
50
|
-
const retrievedSession = sessionManager.getSession(testSession.id);
|
|
51
|
-
(0, chai_1.expect)(retrievedSession).to.not.be.undefined;
|
|
52
|
-
(0, chai_1.expect)(retrievedSession).to.be.equal(createdSession);
|
|
53
|
-
(0, chai_1.expect)(listener_create.calledWith(testSession));
|
|
54
|
-
});
|
|
55
|
-
it('get sessions by type', () => {
|
|
56
|
-
const clientSessions = sessionManager.getSessionsByType(testSession.diagramType);
|
|
57
|
-
(0, chai_1.expect)(clientSessions.length).to.be.equal(1);
|
|
58
|
-
(0, chai_1.expect)(clientSessions[0]).to.be.equal(testSession);
|
|
59
|
-
});
|
|
60
|
-
it('get sessions by type that does no exist', async () => {
|
|
61
|
-
const clientSessions = sessionManager.getSessionsByType('wrongType');
|
|
62
|
-
(0, chai_1.expect)(clientSessions.length).to.be.equal(0);
|
|
63
|
-
});
|
|
64
|
-
it('dispose client session', () => {
|
|
65
|
-
// Mock setup
|
|
66
|
-
const listener_dispose = sinon.spy(testSessionListener, 'sessionDisposed');
|
|
67
|
-
// Test execution
|
|
68
|
-
(0, chai_1.expect)(sessionManager.disposeClientSession(testSession.id)).to.be.equal(true);
|
|
69
|
-
const session = sessionManager.getSession(testSession.id);
|
|
70
|
-
(0, chai_1.expect)(session).to.be.undefined;
|
|
71
|
-
(0, chai_1.expect)(listener_dispose.calledWith(testSession));
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=client-session-manager.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-session-manager.spec.js","sourceRoot":"","sources":["../../../src/common/session/client-session-manager.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAuD;AACvD,0CAA0C;AAC1C,4CAAyC;AACzC,qEAAgE;AAChE,qEAAuE;AACvE,+BAA8B;AAC9B,+BAA+B;AAE/B,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAC9C,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAClE,MAAM,mBAAmB,GAAG,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;IAEjE,MAAM,cAAc,GAAG,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAC3D,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CA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