@lionweb/delta-protocol-test-cli 0.8.0-beta.1 → 0.8.0-beta.3
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/CHANGELOG.md +6 -0
- package/dist/cli-client.js +6 -13
- package/dist/cli-client.js.map +1 -1
- package/dist/tasks.d.ts +1 -2
- package/dist/tasks.d.ts.map +1 -1
- package/dist/tasks.js +34 -19
- package/dist/tasks.js.map +1 -1
- package/package.json +10 -10
- package/src/cli-client.ts +6 -17
- package/src/tasks.ts +80 -20
package/CHANGELOG.md
CHANGED
package/dist/cli-client.js
CHANGED
|
@@ -28,9 +28,7 @@ const { clientInfo, genericError } = ansi;
|
|
|
28
28
|
const testLanguageBase = TestLanguageBase.INSTANCE;
|
|
29
29
|
const languageBases = [testLanguageBase];
|
|
30
30
|
const boldRedIf = (apply, text) => apply ? genericError(text) : text;
|
|
31
|
-
|
|
32
|
-
.map((concept) => [concept.name, concept]));
|
|
33
|
-
// $ node dist/cli-client.js <port> <clientID> <partitionConcept> [tasks] [--${protocolLogOptionPrefix}=<path>]
|
|
31
|
+
// $ node dist/cli-client.js <port> <clientID> [tasks] [--${protocolLogOptionPrefix}=<path>]
|
|
34
32
|
const protocolLogOptionPrefix = "--protocol-log=";
|
|
35
33
|
const protocolLogPathIndex = argv.findIndex((argument) => argument.startsWith(protocolLogOptionPrefix));
|
|
36
34
|
// arguments without "node" (index=0), "dist/cli-client.js" (index=1), and `${protocolLogOptionPrefix}=<path>` (optional)
|
|
@@ -41,8 +39,7 @@ if (trueArguments.length < 3) {
|
|
|
41
39
|
Parameters (${genericError("bold red")} are missing):
|
|
42
40
|
- ${boldRedIf(trueArguments.length < 1, `<port>: the port of the WebSocket where the LionWeb delta protocol repository is running on localhost`)}
|
|
43
41
|
- ${boldRedIf(trueArguments.length < 2, `<clientID>: the ID that the client identifies itself with at the repository`)}
|
|
44
|
-
- ${boldRedIf(trueArguments.length < 3,
|
|
45
|
-
- ${boldRedIf(trueArguments.length < 4, `[tasks]: a comma-separated list of tasks — one of ${Object.keys(recognizedTasks).sort().join(", ")}`)}
|
|
42
|
+
- ${boldRedIf(trueArguments.length < 3, `[tasks]: a comma-separated list of tasks — one of ${Object.keys(recognizedTasks).sort().join(", ")}`)}
|
|
46
43
|
- ${boldRedIf(protocolLogPathIndex === -1, `${protocolLogOptionPrefix}=<path>: option to configure that the client logs all messages exchanged with the repository to a file with the given path`)}
|
|
47
44
|
|
|
48
45
|
ASSUMPTION: the initial (states of the models) on client(s) and repository are identical!
|
|
@@ -51,12 +48,7 @@ Parameters (${genericError("bold red")} are missing):
|
|
|
51
48
|
}
|
|
52
49
|
const port = tryParseInteger(argv[2]);
|
|
53
50
|
const clientId = argv[3];
|
|
54
|
-
const
|
|
55
|
-
if (!(partitionConcept in partitionConcepts)) {
|
|
56
|
-
console.error(genericError(`unknown partition concept specified: ${partitionConcept} — must be one of: ${Object.keys(partitionConcepts).join(", ")}`));
|
|
57
|
-
exit(2);
|
|
58
|
-
}
|
|
59
|
-
const tasks = argv[5]?.split(",") ?? [];
|
|
51
|
+
const tasks = argv[4]?.split(",") ?? [];
|
|
60
52
|
console.log(clientInfo(`tasks provided: ${tasks.length === 0 ? "none" : tasks.join(", ")}`));
|
|
61
53
|
const infoUnrecognizedTasks = tasks
|
|
62
54
|
.map((task, index) => task in recognizedTasks ? undefined : [task, index])
|
|
@@ -81,8 +73,9 @@ await runAsApp(async () => {
|
|
|
81
73
|
logItems.push(logItem);
|
|
82
74
|
})
|
|
83
75
|
});
|
|
84
|
-
console.log(clientInfo(`LionWeb delta protocol client
|
|
85
|
-
|
|
76
|
+
console.log(clientInfo(`LionWeb delta protocol client connected to repository on ${url} - press Ctrl+C to terminate`));
|
|
77
|
+
console.log(clientInfo(`\tCLI call: <magic incantation> ${port} ${clientId} ${tasks.join(",")}`));
|
|
78
|
+
const executeTask = taskExecutor(lionWebClient, semanticLogItems);
|
|
86
79
|
let querySequenceNumber = 0;
|
|
87
80
|
const queryId = () => `query-${++querySequenceNumber}`;
|
|
88
81
|
for (const task of tasks) {
|
package/dist/cli-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-client.js","sourceRoot":"","sources":["../src/cli-client.ts"],"names":[],"mappings":";AAEA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"cli-client.js","sourceRoot":"","sources":["../src/cli-client.ts"],"names":[],"mappings":";AAEA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAyB,MAAM,gCAAgC,CAAA;AACrF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACvD,O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EAAE,CAAA;IACrC,CAAC,CAAA;AACL,CAAC,CAAC,CAAA"}
|
package/dist/tasks.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Concept } from "@lionweb/core";
|
|
2
1
|
import { LionWebClient } from "@lionweb/delta-protocol-client";
|
|
3
2
|
import { ISemanticLogItem } from "@lionweb/delta-protocol-common";
|
|
4
3
|
/**
|
|
@@ -9,5 +8,5 @@ import { ISemanticLogItem } from "@lionweb/delta-protocol-common";
|
|
|
9
8
|
* inside the build package to generate the contents of the following object.
|
|
10
9
|
*/
|
|
11
10
|
export declare const recognizedTasks: Record<string, boolean>;
|
|
12
|
-
export declare const taskExecutor: (lionWebClient: LionWebClient,
|
|
11
|
+
export declare const taskExecutor: (lionWebClient: LionWebClient, semanticLogItems: ISemanticLogItem[]) => (task: keyof typeof recognizedTasks, queryId: string) => Promise<void>;
|
|
13
12
|
//# sourceMappingURL=tasks.d.ts.map
|
package/dist/tasks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAA+B,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAe9F;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAoCnD,CAAA;AAMD,eAAO,MAAM,YAAY,GAAI,eAAe,aAAa,EAAE,kBAAkB,gBAAgB,EAAE,MAmC7E,MAAM,MAAM,OAAO,eAAe,EAAE,SAAS,MAAM,kBA6KpE,CAAA"}
|
package/dist/tasks.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
17
|
import { ansi, ClientReceivedMessage } from "@lionweb/delta-protocol-common";
|
|
18
18
|
import { lastOfArray } from "@lionweb/ts-utils";
|
|
19
|
-
import { TestLanguageBase } from "@lionweb/class-core-test-language";
|
|
19
|
+
import { TestLanguageBase, TestPartition } from "@lionweb/class-core-test-language";
|
|
20
20
|
import { waitUntil } from "./async.js";
|
|
21
21
|
const { clientInfo, genericWarning } = ansi;
|
|
22
22
|
/**
|
|
@@ -64,7 +64,7 @@ export const recognizedTasks = {
|
|
|
64
64
|
"SubscribeToChangingPartitions": true
|
|
65
65
|
};
|
|
66
66
|
const testLanguageBase = TestLanguageBase.INSTANCE;
|
|
67
|
-
export const taskExecutor = (lionWebClient,
|
|
67
|
+
export const taskExecutor = (lionWebClient, semanticLogItems) => {
|
|
68
68
|
const numberOfReceivedMessages = () => semanticLogItems.filter((item) => item instanceof ClientReceivedMessage).length;
|
|
69
69
|
const waitForReceivedMessages = async (numberOfMessagesToReceive) => {
|
|
70
70
|
const expectedNumber = numberOfReceivedMessages() + numberOfMessagesToReceive; // (precompute here)
|
|
@@ -74,10 +74,18 @@ export const taskExecutor = (lionWebClient, partitionConcept, semanticLogItems)
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
const annotation = (id) => lionWebClient.forest.createNode(testLanguageBase.TestAnnotation, id);
|
|
77
|
-
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
+
const as = (obj, classConstructor, customErrorMessage) => {
|
|
79
|
+
if (obj instanceof classConstructor) {
|
|
80
|
+
return obj;
|
|
81
|
+
}
|
|
82
|
+
throw new Error(customErrorMessage ?? `object is not of class ${classConstructor.name}`);
|
|
83
|
+
};
|
|
84
|
+
const thePartition = () => as(lionWebClient.forest.partitions[0], TestPartition, `partition at index 0 in forest is not a ${testLanguageBase.TestPartition.name}`);
|
|
78
85
|
const linkTestConcept = (id) => id === undefined
|
|
79
|
-
? thePartition()
|
|
86
|
+
? thePartition().links[0] // ~ partition.Links[0] in C#
|
|
80
87
|
: lionWebClient.forest.createNode(testLanguageBase.LinkTestConcept, id);
|
|
88
|
+
const dataTypeTestConcept = () => thePartition().data; // ~ partition.Data in C#
|
|
81
89
|
return async (task, queryId) => {
|
|
82
90
|
console.log(clientInfo(`client "${lionWebClient.clientId}" is executing task "${task}"`));
|
|
83
91
|
switch (task) {
|
|
@@ -91,39 +99,49 @@ export const taskExecutor = (lionWebClient, partitionConcept, semanticLogItems)
|
|
|
91
99
|
});
|
|
92
100
|
case "SignOff":
|
|
93
101
|
return await lionWebClient.signOff(queryId);
|
|
94
|
-
case "Wait":
|
|
102
|
+
case "Wait":
|
|
103
|
+
return waitForReceivedMessages(1);
|
|
104
|
+
case "AddPartition": {
|
|
105
|
+
const partition = lionWebClient.forest.createNode(testLanguageBase.TestPartition, "partition");
|
|
106
|
+
partition.data = lionWebClient.forest.createNode(testLanguageBase.DataTypeTestConcept, "data");
|
|
107
|
+
partition.addLinks(lionWebClient.forest.createNode(testLanguageBase.LinkTestConcept, "link"));
|
|
108
|
+
lionWebClient.addPartition(partition);
|
|
95
109
|
return waitForReceivedMessages(1);
|
|
96
110
|
}
|
|
97
111
|
case "AddStringValue_0_1":
|
|
98
|
-
|
|
112
|
+
dataTypeTestConcept().stringValue_0_1 = "new property";
|
|
99
113
|
return waitForReceivedMessages(1);
|
|
100
114
|
case "SetStringValue_0_1":
|
|
101
|
-
|
|
115
|
+
dataTypeTestConcept().stringValue_0_1 = "changed property";
|
|
102
116
|
return waitForReceivedMessages(1);
|
|
103
117
|
case "DeleteStringValue_0_1":
|
|
104
|
-
|
|
118
|
+
dataTypeTestConcept().stringValue_0_1 = undefined;
|
|
105
119
|
return waitForReceivedMessages(1);
|
|
106
120
|
case "AddName_Containment_0_1":
|
|
107
121
|
linkTestConcept().containment_0_1.name = "my name";
|
|
108
122
|
return waitForReceivedMessages(1);
|
|
109
123
|
case "AddAnnotation":
|
|
110
|
-
|
|
124
|
+
thePartition().addAnnotation(annotation("annotation"));
|
|
111
125
|
return waitForReceivedMessages(1);
|
|
112
126
|
case "AddAnnotations":
|
|
113
|
-
|
|
114
|
-
|
|
127
|
+
thePartition().addAnnotation(annotation("annotation0")); // (keep ;!)
|
|
128
|
+
thePartition().addAnnotation(annotation("annotation1"));
|
|
115
129
|
return waitForReceivedMessages(2);
|
|
116
130
|
case "AddAnnotation_to_Containment_0_1":
|
|
117
131
|
linkTestConcept().containment_0_1.addAnnotation(annotation("annotation"));
|
|
118
132
|
return waitForReceivedMessages(1);
|
|
119
|
-
case "DeleteAnnotation":
|
|
120
|
-
|
|
121
|
-
|
|
133
|
+
case "DeleteAnnotation": {
|
|
134
|
+
const nAnnotations = thePartition().annotations.length;
|
|
135
|
+
thePartition().annotations.forEach((annotation) => {
|
|
136
|
+
thePartition().removeAnnotation(annotation);
|
|
137
|
+
});
|
|
138
|
+
return waitForReceivedMessages(nAnnotations);
|
|
139
|
+
}
|
|
122
140
|
case "MoveAnnotationInSameParent":
|
|
123
|
-
|
|
141
|
+
thePartition().insertAnnotationAtIndex(lastOfArray(thePartition().annotations), 0);
|
|
124
142
|
return waitForReceivedMessages(1);
|
|
125
143
|
case "MoveAnnotationFromOtherParent":
|
|
126
|
-
|
|
144
|
+
thePartition().addAnnotation(linkTestConcept().containment_0_1.annotations[0]);
|
|
127
145
|
return waitForReceivedMessages(1);
|
|
128
146
|
case "AddReference_0_1_to_Containment_0_1":
|
|
129
147
|
linkTestConcept().reference_0_1 = linkTestConcept().containment_0_1;
|
|
@@ -194,9 +212,6 @@ export const taskExecutor = (lionWebClient, partitionConcept, semanticLogItems)
|
|
|
194
212
|
case "MoveChildFromOtherContainmentInSameParent_Multiple":
|
|
195
213
|
linkTestConcept().addContainment_1_nAtIndex(lastOfArray(linkTestConcept().containment_0_n), 1);
|
|
196
214
|
return waitForReceivedMessages(1);
|
|
197
|
-
case "AddPartition":
|
|
198
|
-
lionWebClient.addPartition(lionWebClient.forest.createNode(partitionConcept, "partition"));
|
|
199
|
-
return waitForReceivedMessages(1);
|
|
200
215
|
default: {
|
|
201
216
|
// (shouldn't happen because of upfront validation of tasks)
|
|
202
217
|
console.log(genericWarning(`task "${task}" is unknown => ignored`));
|
package/dist/tasks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,sEAAsE;AACtE,sCAAsC;AAGtC,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAoB,MAAM,gCAAgC,CAAA;AAE9F,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAIH,gBAAgB,EAChB,aAAa,EAChB,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;AAG3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAA4B;IACpD,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,IAAI;IACZ,oBAAoB,EAAE,IAAI;IAC1B,oBAAoB,EAAE,IAAI;IAC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C,eAAe,CAAC,EAAE,CAAC,CAAC,CAAA;gBAC9F,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAA;YAErC,OAAO,CAAC,CAAC,CAAC;gBACN,4DAA4D;gBAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,IAAI,yBAAyB,CAAC,CAAC,CAAA;gBACnE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;YAC5B,CAAC;QAEL,CAAC;IACL,CAAC,CAAA;AACL,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/delta-protocol-test-cli",
|
|
3
|
-
"version": "0.8.0-beta.
|
|
3
|
+
"version": "0.8.0-beta.3",
|
|
4
4
|
"description": "CLI programs for testing the delta protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"release": "npm publish"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lionweb/class-core": "0.8.0-beta.
|
|
34
|
-
"@lionweb/class-core-test-language": "0.8.0-beta.
|
|
35
|
-
"@lionweb/core": "0.8.0-beta.
|
|
36
|
-
"@lionweb/delta-protocol-client": "0.8.0-beta.
|
|
37
|
-
"@lionweb/delta-protocol-common": "0.8.0-beta.
|
|
38
|
-
"@lionweb/delta-protocol-low-level-client-ws": "0.8.0-beta.
|
|
39
|
-
"@lionweb/delta-protocol-repository-ws": "0.8.0-beta.
|
|
40
|
-
"@lionweb/json": "0.8.0-beta.
|
|
41
|
-
"@lionweb/utilities": "0.8.0-beta.
|
|
33
|
+
"@lionweb/class-core": "0.8.0-beta.3",
|
|
34
|
+
"@lionweb/class-core-test-language": "0.8.0-beta.3",
|
|
35
|
+
"@lionweb/core": "0.8.0-beta.3",
|
|
36
|
+
"@lionweb/delta-protocol-client": "0.8.0-beta.3",
|
|
37
|
+
"@lionweb/delta-protocol-common": "0.8.0-beta.3",
|
|
38
|
+
"@lionweb/delta-protocol-low-level-client-ws": "0.8.0-beta.3",
|
|
39
|
+
"@lionweb/delta-protocol-repository-ws": "0.8.0-beta.3",
|
|
40
|
+
"@lionweb/json": "0.8.0-beta.3",
|
|
41
|
+
"@lionweb/utilities": "0.8.0-beta.3"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/cli-client.ts
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
// SPDX-License-Identifier: Apache-2.0
|
|
19
19
|
|
|
20
20
|
import { TestLanguageBase } from "@lionweb/class-core-test-language"
|
|
21
|
-
import { Concept } from "@lionweb/core"
|
|
22
21
|
import { LionWebClient, LowLevelClientLogItem } from "@lionweb/delta-protocol-client"
|
|
23
22
|
import { ansi, combine, semanticConsoleLogger, semanticLogItemStorer } from "@lionweb/delta-protocol-common"
|
|
24
23
|
import { createWSLowLevelClient } from "@lionweb/delta-protocol-low-level-client-ws"
|
|
@@ -38,12 +37,7 @@ const languageBases = [testLanguageBase]
|
|
|
38
37
|
const boldRedIf = (apply: boolean, text: string) =>
|
|
39
38
|
apply ? genericError(text) : text
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
[testLanguageBase.DataTypeTestConcept, testLanguageBase.LinkTestConcept]
|
|
43
|
-
.map((concept) => [concept.name, concept])
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
// $ node dist/cli-client.js <port> <clientID> <partitionConcept> [tasks] [--${protocolLogOptionPrefix}=<path>]
|
|
40
|
+
// $ node dist/cli-client.js <port> <clientID> [tasks] [--${protocolLogOptionPrefix}=<path>]
|
|
47
41
|
|
|
48
42
|
const protocolLogOptionPrefix = "--protocol-log="
|
|
49
43
|
const protocolLogPathIndex = argv.findIndex((argument) => argument.startsWith(protocolLogOptionPrefix))
|
|
@@ -57,8 +51,7 @@ if (trueArguments.length < 3) {
|
|
|
57
51
|
Parameters (${genericError("bold red")} are missing):
|
|
58
52
|
- ${boldRedIf(trueArguments.length < 1, `<port>: the port of the WebSocket where the LionWeb delta protocol repository is running on localhost`)}
|
|
59
53
|
- ${boldRedIf(trueArguments.length < 2, `<clientID>: the ID that the client identifies itself with at the repository`)}
|
|
60
|
-
- ${boldRedIf(trueArguments.length < 3,
|
|
61
|
-
- ${boldRedIf(trueArguments.length < 4, `[tasks]: a comma-separated list of tasks — one of ${Object.keys(recognizedTasks).sort().join(", ")}`)}
|
|
54
|
+
- ${boldRedIf(trueArguments.length < 3, `[tasks]: a comma-separated list of tasks — one of ${Object.keys(recognizedTasks).sort().join(", ")}`)}
|
|
62
55
|
- ${boldRedIf(protocolLogPathIndex === -1, `${protocolLogOptionPrefix}=<path>: option to configure that the client logs all messages exchanged with the repository to a file with the given path`)}
|
|
63
56
|
|
|
64
57
|
ASSUMPTION: the initial (states of the models) on client(s) and repository are identical!
|
|
@@ -68,12 +61,7 @@ Parameters (${genericError("bold red")} are missing):
|
|
|
68
61
|
|
|
69
62
|
const port = tryParseInteger(argv[2])
|
|
70
63
|
const clientId = argv[3]
|
|
71
|
-
const
|
|
72
|
-
if (!(partitionConcept in partitionConcepts)) {
|
|
73
|
-
console.error(genericError(`unknown partition concept specified: ${partitionConcept} — must be one of: ${Object.keys(partitionConcepts).join(", ")}`))
|
|
74
|
-
exit(2)
|
|
75
|
-
}
|
|
76
|
-
const tasks = argv[5]?.split(",") ?? []
|
|
64
|
+
const tasks = argv[4]?.split(",") ?? []
|
|
77
65
|
console.log(clientInfo(`tasks provided: ${tasks.length === 0 ? "none" : tasks.join(", ")}`))
|
|
78
66
|
const infoUnrecognizedTasks = tasks
|
|
79
67
|
.map((task, index) => task in recognizedTasks ? undefined : [task, index] as [string, number])
|
|
@@ -106,9 +94,10 @@ await runAsApp(async () => {
|
|
|
106
94
|
)
|
|
107
95
|
})
|
|
108
96
|
|
|
109
|
-
console.log(clientInfo(`LionWeb delta protocol client
|
|
97
|
+
console.log(clientInfo(`LionWeb delta protocol client connected to repository on ${url} - press Ctrl+C to terminate`))
|
|
98
|
+
console.log(clientInfo(`\tCLI call: <magic incantation> ${port} ${clientId} ${tasks.join(",")}`))
|
|
110
99
|
|
|
111
|
-
const executeTask = taskExecutor(lionWebClient,
|
|
100
|
+
const executeTask = taskExecutor(lionWebClient, semanticLogItems)
|
|
112
101
|
|
|
113
102
|
let querySequenceNumber = 0
|
|
114
103
|
const queryId = () => `query-${++querySequenceNumber}`
|
package/src/tasks.ts
CHANGED
|
@@ -15,12 +15,17 @@
|
|
|
15
15
|
// SPDX-FileCopyrightText: 2025 TRUMPF Laser SE and other contributors
|
|
16
16
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
17
|
|
|
18
|
-
import { Concept } from "@lionweb/core"
|
|
19
18
|
import { LionWebClient } from "@lionweb/delta-protocol-client"
|
|
20
19
|
import { ansi, ClientReceivedMessage, ISemanticLogItem } from "@lionweb/delta-protocol-common"
|
|
21
20
|
import { LionWebId } from "@lionweb/json"
|
|
22
21
|
import { lastOfArray } from "@lionweb/ts-utils"
|
|
23
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
DataTypeTestConcept,
|
|
24
|
+
LinkTestConcept,
|
|
25
|
+
TestAnnotation,
|
|
26
|
+
TestLanguageBase,
|
|
27
|
+
TestPartition
|
|
28
|
+
} from "@lionweb/class-core-test-language"
|
|
24
29
|
|
|
25
30
|
import { waitUntil } from "./async.js"
|
|
26
31
|
const { clientInfo, genericWarning } = ansi
|
|
@@ -75,7 +80,7 @@ export const recognizedTasks: Record<string, boolean> = {
|
|
|
75
80
|
const testLanguageBase = TestLanguageBase.INSTANCE
|
|
76
81
|
|
|
77
82
|
|
|
78
|
-
export const taskExecutor = (lionWebClient: LionWebClient,
|
|
83
|
+
export const taskExecutor = (lionWebClient: LionWebClient, semanticLogItems: ISemanticLogItem[]) => {
|
|
79
84
|
|
|
80
85
|
const numberOfReceivedMessages = () =>
|
|
81
86
|
semanticLogItems.filter((item) => item instanceof ClientReceivedMessage).length
|
|
@@ -91,107 +96,159 @@ export const taskExecutor = (lionWebClient: LionWebClient, partitionConcept: Con
|
|
|
91
96
|
const annotation = (id: LionWebId) =>
|
|
92
97
|
lionWebClient.forest.createNode(testLanguageBase.TestAnnotation, id) as TestAnnotation
|
|
93
98
|
|
|
94
|
-
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
const as = <T>(obj: object, classConstructor: new (...args: any[]) => T, customErrorMessage?: string) => {
|
|
101
|
+
if (obj instanceof classConstructor) {
|
|
102
|
+
return obj as T
|
|
103
|
+
}
|
|
104
|
+
throw new Error(customErrorMessage ?? `object is not of class ${classConstructor.name}`)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const thePartition = () =>
|
|
108
|
+
as(lionWebClient.forest.partitions[0], TestPartition, `partition at index 0 in forest is not a ${testLanguageBase.TestPartition.name}`)
|
|
95
109
|
|
|
96
110
|
const linkTestConcept = (id?: LionWebId) =>
|
|
97
111
|
id === undefined
|
|
98
|
-
? thePartition()
|
|
112
|
+
? thePartition().links[0] // ~ partition.Links[0] in C#
|
|
99
113
|
: lionWebClient.forest.createNode(testLanguageBase.LinkTestConcept, id) as LinkTestConcept
|
|
100
114
|
|
|
115
|
+
const dataTypeTestConcept = () =>
|
|
116
|
+
thePartition().data! // ~ partition.Data in C#
|
|
117
|
+
|
|
101
118
|
return async (task: keyof typeof recognizedTasks, queryId: string) => {
|
|
102
119
|
console.log(clientInfo(`client "${lionWebClient.clientId}" is executing task "${task}"`))
|
|
103
120
|
switch (task) {
|
|
121
|
+
|
|
104
122
|
case "SignOn":
|
|
105
123
|
return await lionWebClient.signOn(queryId, "myRepo")
|
|
124
|
+
|
|
106
125
|
case "SubscribeToChangingPartitions":
|
|
107
126
|
return await lionWebClient.subscribeToChangingPartitions(queryId, {
|
|
108
127
|
creation: true,
|
|
109
128
|
deletion: true,
|
|
110
129
|
partitions: true
|
|
111
130
|
})
|
|
131
|
+
|
|
112
132
|
case "SignOff":
|
|
113
133
|
return await lionWebClient.signOff(queryId)
|
|
114
|
-
|
|
134
|
+
|
|
135
|
+
case "Wait":
|
|
136
|
+
return waitForReceivedMessages(1)
|
|
137
|
+
|
|
138
|
+
case "AddPartition": {
|
|
139
|
+
const partition = lionWebClient.forest.createNode(testLanguageBase.TestPartition, "partition") as TestPartition
|
|
140
|
+
partition.data = lionWebClient.forest.createNode(testLanguageBase.DataTypeTestConcept, "data") as DataTypeTestConcept
|
|
141
|
+
partition.addLinks(lionWebClient.forest.createNode(testLanguageBase.LinkTestConcept, "link") as LinkTestConcept)
|
|
142
|
+
lionWebClient.addPartition(partition)
|
|
115
143
|
return waitForReceivedMessages(1)
|
|
116
144
|
}
|
|
145
|
+
|
|
117
146
|
case "AddStringValue_0_1":
|
|
118
|
-
(
|
|
147
|
+
dataTypeTestConcept().stringValue_0_1 = "new property"
|
|
119
148
|
return waitForReceivedMessages(1)
|
|
149
|
+
|
|
120
150
|
case "SetStringValue_0_1":
|
|
121
|
-
(
|
|
151
|
+
dataTypeTestConcept().stringValue_0_1 = "changed property"
|
|
122
152
|
return waitForReceivedMessages(1)
|
|
153
|
+
|
|
123
154
|
case "DeleteStringValue_0_1":
|
|
124
|
-
(
|
|
155
|
+
dataTypeTestConcept().stringValue_0_1 = undefined
|
|
125
156
|
return waitForReceivedMessages(1)
|
|
157
|
+
|
|
126
158
|
case "AddName_Containment_0_1":
|
|
127
159
|
linkTestConcept().containment_0_1!.name = "my name"
|
|
128
160
|
return waitForReceivedMessages(1)
|
|
161
|
+
|
|
129
162
|
case "AddAnnotation":
|
|
130
|
-
|
|
163
|
+
thePartition().addAnnotation(annotation("annotation"))
|
|
131
164
|
return waitForReceivedMessages(1)
|
|
165
|
+
|
|
132
166
|
case "AddAnnotations":
|
|
133
|
-
|
|
134
|
-
|
|
167
|
+
thePartition().addAnnotation(annotation("annotation0")); // (keep ;!)
|
|
168
|
+
thePartition().addAnnotation(annotation("annotation1"))
|
|
135
169
|
return waitForReceivedMessages(2)
|
|
170
|
+
|
|
136
171
|
case "AddAnnotation_to_Containment_0_1":
|
|
137
172
|
linkTestConcept().containment_0_1!.addAnnotation(annotation("annotation"))
|
|
138
173
|
return waitForReceivedMessages(1)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
174
|
+
|
|
175
|
+
case "DeleteAnnotation": {
|
|
176
|
+
const nAnnotations = thePartition().annotations.length
|
|
177
|
+
thePartition().annotations.forEach((annotation) => {
|
|
178
|
+
thePartition().removeAnnotation(annotation)
|
|
179
|
+
})
|
|
180
|
+
return waitForReceivedMessages(nAnnotations)
|
|
181
|
+
}
|
|
182
|
+
|
|
142
183
|
case "MoveAnnotationInSameParent":
|
|
143
|
-
|
|
184
|
+
thePartition().insertAnnotationAtIndex(lastOfArray(thePartition().annotations), 0)
|
|
144
185
|
return waitForReceivedMessages(1)
|
|
186
|
+
|
|
145
187
|
case "MoveAnnotationFromOtherParent":
|
|
146
|
-
|
|
188
|
+
thePartition().addAnnotation(linkTestConcept().containment_0_1!.annotations[0])
|
|
147
189
|
return waitForReceivedMessages(1)
|
|
190
|
+
|
|
148
191
|
case "AddReference_0_1_to_Containment_0_1":
|
|
149
192
|
linkTestConcept().reference_0_1 = linkTestConcept().containment_0_1
|
|
150
193
|
return waitForReceivedMessages(1)
|
|
194
|
+
|
|
151
195
|
case "AddReference_0_1_to_Containment_1":
|
|
152
196
|
linkTestConcept().reference_0_1 = linkTestConcept().containment_1
|
|
153
197
|
return waitForReceivedMessages(1)
|
|
198
|
+
|
|
154
199
|
case "DeleteReference_0_1":
|
|
155
200
|
linkTestConcept().reference_0_1 = undefined
|
|
156
201
|
return waitForReceivedMessages(1)
|
|
202
|
+
|
|
157
203
|
case "AddContainment_0_1":
|
|
158
204
|
linkTestConcept().containment_0_1 = linkTestConcept("containment_0_1")
|
|
159
205
|
return waitForReceivedMessages(1)
|
|
206
|
+
|
|
160
207
|
case "AddContainment_1":
|
|
161
208
|
linkTestConcept().containment_1 = linkTestConcept("containment_1")
|
|
162
209
|
return waitForReceivedMessages(1)
|
|
210
|
+
|
|
163
211
|
case "ReplaceContainment_0_1":
|
|
164
212
|
linkTestConcept().replaceContainment_0_1With(linkTestConcept("substitute"))
|
|
165
213
|
return waitForReceivedMessages(1)
|
|
214
|
+
|
|
166
215
|
case "DeleteContainment_0_1":
|
|
167
216
|
linkTestConcept().containment_0_1 = undefined
|
|
168
217
|
return waitForReceivedMessages(1)
|
|
218
|
+
|
|
169
219
|
case "AddContainment_0_1_Containment_0_1":
|
|
170
220
|
linkTestConcept().containment_0_1!.containment_0_1 = linkTestConcept("containment_0_1_containment_0_1")
|
|
171
221
|
return waitForReceivedMessages(1)
|
|
222
|
+
|
|
172
223
|
case "AddContainment_1_Containment_0_1":
|
|
173
224
|
linkTestConcept().containment_1.containment_0_1 = linkTestConcept("containment_1_containment_0_1")
|
|
174
225
|
return waitForReceivedMessages(1)
|
|
226
|
+
|
|
175
227
|
case "AddContainment_0_n":
|
|
176
228
|
linkTestConcept().addContainment_0_n(linkTestConcept("containment_0_n_child0")); // (keep ;!)
|
|
177
229
|
linkTestConcept().addContainment_0_n(linkTestConcept("containment_0_n_child1"))
|
|
178
230
|
return waitForReceivedMessages(2)
|
|
231
|
+
|
|
179
232
|
case "AddContainment_0_n_Containment_0_n": {
|
|
180
233
|
const outerChild = linkTestConcept("containment_0_n_child0")
|
|
181
234
|
outerChild.addContainment_0_n(linkTestConcept("containment_0_n_containment_0_n_child0"))
|
|
182
235
|
linkTestConcept().addContainment_0_n(outerChild)
|
|
183
236
|
return waitForReceivedMessages(1)
|
|
184
237
|
}
|
|
238
|
+
|
|
185
239
|
case "AddContainment_1_n":
|
|
186
240
|
linkTestConcept().addContainment_1_n(linkTestConcept("containment_1_n_child0")); // (keep ;!)
|
|
187
241
|
linkTestConcept().addContainment_1_n(linkTestConcept("containment_1_n_child1"))
|
|
188
242
|
return waitForReceivedMessages(2)
|
|
243
|
+
|
|
189
244
|
case "MoveAndReplaceChildFromOtherContainment_Single":
|
|
190
245
|
linkTestConcept().containment_1.replaceContainment_0_1With(linkTestConcept().containment_0_1!.containment_0_1!)
|
|
191
246
|
return waitForReceivedMessages(1)
|
|
247
|
+
|
|
192
248
|
case "MoveAndReplaceChildFromOtherContainmentInSameParent_Single":
|
|
193
249
|
linkTestConcept().replaceContainment_1With(linkTestConcept().containment_0_1!)
|
|
194
250
|
return waitForReceivedMessages(1)
|
|
251
|
+
|
|
195
252
|
case "MoveAndReplaceChildFromOtherContainment_Multiple":
|
|
196
253
|
if (linkTestConcept().containment_1_n.length === 0) {
|
|
197
254
|
throw new Error(`can't replace an item of an array with no items`)
|
|
@@ -201,31 +258,34 @@ export const taskExecutor = (lionWebClient: LionWebClient, partitionConcept: Con
|
|
|
201
258
|
linkTestConcept().containment_1_n.length - 1
|
|
202
259
|
)
|
|
203
260
|
return waitForReceivedMessages(1)
|
|
261
|
+
|
|
204
262
|
case "MoveChildInSameContainment":
|
|
205
263
|
linkTestConcept().addContainment_0_nAtIndex(lastOfArray(linkTestConcept().containment_0_n), 0)
|
|
206
264
|
// Note: this is effectively a move rather than an insert — hence the name of the task.
|
|
207
265
|
return waitForReceivedMessages(1)
|
|
266
|
+
|
|
208
267
|
case "MoveChildFromOtherContainment_Single":
|
|
209
268
|
linkTestConcept().containment_1 = linkTestConcept().containment_0_1!.containment_0_1!
|
|
210
269
|
return waitForReceivedMessages(1)
|
|
270
|
+
|
|
211
271
|
case "MoveChildFromOtherContainment_Multiple":
|
|
212
272
|
linkTestConcept().addContainment_1_nAtIndex(lastOfArray(linkTestConcept().containment_0_n).containment_0_n[0], 1)
|
|
213
273
|
return waitForReceivedMessages(1)
|
|
274
|
+
|
|
214
275
|
case "MoveChildFromOtherContainmentInSameParent_Single":
|
|
215
276
|
linkTestConcept().containment_1 = linkTestConcept().containment_0_1!
|
|
216
277
|
return waitForReceivedMessages(1)
|
|
278
|
+
|
|
217
279
|
case "MoveChildFromOtherContainmentInSameParent_Multiple":
|
|
218
280
|
linkTestConcept().addContainment_1_nAtIndex(lastOfArray(linkTestConcept().containment_0_n), 1)
|
|
219
281
|
return waitForReceivedMessages(1)
|
|
220
|
-
case "AddPartition":
|
|
221
|
-
lionWebClient.addPartition(lionWebClient.forest.createNode(partitionConcept, "partition"))
|
|
222
|
-
return waitForReceivedMessages(1)
|
|
223
282
|
|
|
224
283
|
default: {
|
|
225
284
|
// (shouldn't happen because of upfront validation of tasks)
|
|
226
285
|
console.log(genericWarning(`task "${task}" is unknown => ignored`))
|
|
227
286
|
return Promise.resolve()
|
|
228
287
|
}
|
|
288
|
+
|
|
229
289
|
}
|
|
230
290
|
}
|
|
231
291
|
}
|