@aj-shadow/z-abs-funclayer-engine-server 0.0.0-aj-beta.221

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.
Files changed (204) hide show
  1. package/.gitattributes +26 -0
  2. package/LICENSE.txt +96 -0
  3. package/README.md +5 -0
  4. package/npm-shrinkwrap.json +13 -0
  5. package/package.json +10 -0
  6. package/project/server/_build/Server-FuncLayer-Engine-server.bld +12 -0
  7. package/project/server/_build/z-abs-funclayer-engine-server.prj +12 -0
  8. package/project/server/address/address-calculator.js +377 -0
  9. package/project/server/address/address-data.js +364 -0
  10. package/project/server/address/address-manager.js +251 -0
  11. package/project/server/address/address.js +176 -0
  12. package/project/server/address/addresses.js +122 -0
  13. package/project/server/address/dns-url-cache.js +130 -0
  14. package/project/server/address/interfaces.js +100 -0
  15. package/project/server/address/local-dns.js +35 -0
  16. package/project/server/address/login-report.js +56 -0
  17. package/project/server/address/networks.js +598 -0
  18. package/project/server/address/real-networks.js +102 -0
  19. package/project/server/address/subnet.js +60 -0
  20. package/project/server/communication/messages/messages-s-to-c/message-execution-started.js +17 -0
  21. package/project/server/communication/messages/messages-s-to-c/message-execution-stopped.js +14 -0
  22. package/project/server/communication/messages/messages-s-to-c/message-test-case-debug-paused.js +18 -0
  23. package/project/server/communication/messages/messages-s-to-c/message-test-case-log.js +25 -0
  24. package/project/server/communication/messages/messages-s-to-c/message-test-case-started.js +21 -0
  25. package/project/server/communication/messages/messages-s-to-c/message-test-case-state.js +18 -0
  26. package/project/server/communication/messages/messages-s-to-c/message-test-case-stopped.js +22 -0
  27. package/project/server/communication/messages/messages-s-to-c/message-test-stage-started.js +19 -0
  28. package/project/server/communication/messages/messages-s-to-c/message-test-stage-stopped.js +19 -0
  29. package/project/server/communication/messages/messages-s-to-c/message-test-suite-started.js +16 -0
  30. package/project/server/communication/messages/messages-s-to-c/message-test-suite-stopped.js +19 -0
  31. package/project/server/communication/messages/messages-s-to-w/message-test-case-debug-actor-index-ok.js +15 -0
  32. package/project/server/communication/messages/messages-w-to-s/message-test-case-debug-actor-index.js +15 -0
  33. package/project/server/debug/debug-step-over.js +54 -0
  34. package/project/server/debug/debugger.js +102 -0
  35. package/project/server/debug-dashboard/debug-dashboard.js +14 -0
  36. package/project/server/debug-dashboard/gauge-manager.js +44 -0
  37. package/project/server/debug-dashboard/gauge.js +37 -0
  38. package/project/server/engine/actor/actor-condition.js +335 -0
  39. package/project/server/engine/actor/actor-intercepting.js +32 -0
  40. package/project/server/engine/actor/actor-local.js +24 -0
  41. package/project/server/engine/actor/actor-mixins/asynch-mixin.js +103 -0
  42. package/project/server/engine/actor/actor-mixins/content-mixin.js +22 -0
  43. package/project/server/engine/actor/actor-mixins/logger-mixin.js +603 -0
  44. package/project/server/engine/actor/actor-mixins/process-mixin.js +35 -0
  45. package/project/server/engine/actor/actor-mixins/shared-data-mixin.js +109 -0
  46. package/project/server/engine/actor/actor-mixins/shared-execution-data-mixin.js +57 -0
  47. package/project/server/engine/actor/actor-mixins/stack-mixin-client.js +157 -0
  48. package/project/server/engine/actor/actor-mixins/stack-mixin-server.js +123 -0
  49. package/project/server/engine/actor/actor-mixins/stack-mixin.js +128 -0
  50. package/project/server/engine/actor/actor-mixins/test-data-mixin.js +402 -0
  51. package/project/server/engine/actor/actor-mixins/timer-mixin.js +44 -0
  52. package/project/server/engine/actor/actor-mixins/verify-mixin-base.js +668 -0
  53. package/project/server/engine/actor/actor-mixins/verify-mixin-mandatory.js +46 -0
  54. package/project/server/engine/actor/actor-mixins/verify-mixin-optional.js +44 -0
  55. package/project/server/engine/actor/actor-mixins/verify-mixin-value.js +71 -0
  56. package/project/server/engine/actor/actor-originating.js +32 -0
  57. package/project/server/engine/actor/actor-part-mixins/part-asynch-mixin.js +24 -0
  58. package/project/server/engine/actor/actor-part-mixins/part-logger-mixin.js +39 -0
  59. package/project/server/engine/actor/actor-part-mixins/part-shared-runtime-data-mixin.js +33 -0
  60. package/project/server/engine/actor/actor-part-mixins/part-timer-mixin.js +12 -0
  61. package/project/server/engine/actor/actor-part-mixins/part-verify-mixin-mandatory.js +15 -0
  62. package/project/server/engine/actor/actor-part-mixins/part-verify-mixin-optional.js +15 -0
  63. package/project/server/engine/actor/actor-part-mixins/part-verify-mixin-value.js +15 -0
  64. package/project/server/engine/actor/actor-part-post.js +37 -0
  65. package/project/server/engine/actor/actor-part-pre.js +37 -0
  66. package/project/server/engine/actor/actor-pending.js +79 -0
  67. package/project/server/engine/actor/actor-proxy.js +38 -0
  68. package/project/server/engine/actor/actor-results.js +36 -0
  69. package/project/server/engine/actor/actor-state-timeout.js +35 -0
  70. package/project/server/engine/actor/actor-sut.js +38 -0
  71. package/project/server/engine/actor/actor-terminating.js +32 -0
  72. package/project/server/engine/actor/actor.js +553 -0
  73. package/project/server/engine/actor-phase.js +26 -0
  74. package/project/server/engine/actor-state-machine-base.js +298 -0
  75. package/project/server/engine/actor-state-machine-data.js +383 -0
  76. package/project/server/engine/actor-state-machine-exec.js +137 -0
  77. package/project/server/engine/actor-state-machine-post.js +177 -0
  78. package/project/server/engine/actor-state-machine-pre.js +142 -0
  79. package/project/server/engine/actor-state-machine-process.js +88 -0
  80. package/project/server/engine/actor-state-machine-state.js +52 -0
  81. package/project/server/engine/actor-state-machine.js +185 -0
  82. package/project/server/engine/actor-state.js +35 -0
  83. package/project/server/engine/actor-worker.js +68 -0
  84. package/project/server/engine/actors-phase.js +49 -0
  85. package/project/server/engine/actors.js +317 -0
  86. package/project/server/engine/data/content-audio.js +18 -0
  87. package/project/server/engine/data/content-base.js +91 -0
  88. package/project/server/engine/data/content-binary.js +15 -0
  89. package/project/server/engine/data/content-cache.js +67 -0
  90. package/project/server/engine/data/content-data.js +254 -0
  91. package/project/server/engine/data/content-documents.js +18 -0
  92. package/project/server/engine/data/content-image.js +20 -0
  93. package/project/server/engine/data/content-other.js +19 -0
  94. package/project/server/engine/data/content-text.js +19 -0
  95. package/project/server/engine/data/content-undefined.js +14 -0
  96. package/project/server/engine/data/content-video.js +20 -0
  97. package/project/server/engine/data/content.js +60 -0
  98. package/project/server/engine/data/runtime-data-shared.js +75 -0
  99. package/project/server/engine/data/test-data.js +239 -0
  100. package/project/server/engine/execution-context-test-case.js +48 -0
  101. package/project/server/engine/execution-context-test-suite.js +66 -0
  102. package/project/server/engine/execution-context.js +93 -0
  103. package/project/server/engine/stage-setter.js +132 -0
  104. package/project/server/engine/stage.js +83 -0
  105. package/project/server/engine/test-case-load.js +25 -0
  106. package/project/server/engine/test-case-loader.js +125 -0
  107. package/project/server/engine/test-case-not-found.js +29 -0
  108. package/project/server/engine/test-case-result-type.js +42 -0
  109. package/project/server/engine/test-case.js +417 -0
  110. package/project/server/engine/test-output.js +116 -0
  111. package/project/server/engine/test-statistics-test-case.js +59 -0
  112. package/project/server/engine/test-statistics-test-suite.js +63 -0
  113. package/project/server/engine/test-suite.js +276 -0
  114. package/project/server/stack/api/base-64.js +16 -0
  115. package/project/server/stack/api/const-commands-decoder.js +15 -0
  116. package/project/server/stack/api/const-commands-encoder.js +15 -0
  117. package/project/server/stack/api/hmacSha1.js +14 -0
  118. package/project/server/stack/api/json-web-token.js +38 -0
  119. package/project/server/stack/api/sdp/sdp-decoder.js +70 -0
  120. package/project/server/stack/api/sdp/sdp-encoder.js +40 -0
  121. package/project/server/stack/api/sdp/sdp-media-attribute.js +13 -0
  122. package/project/server/stack/api/sdp/sdp-media-session.js +16 -0
  123. package/project/server/stack/api/sdp/sdp-message.js +17 -0
  124. package/project/server/stack/api/sdp/sdp-origin.js +17 -0
  125. package/project/server/stack/api/sdp/sdp-session-attribute.js +13 -0
  126. package/project/server/stack/api/sdp/sdp-timing.js +15 -0
  127. package/project/server/stack/api/text-protocol-header.js +35 -0
  128. package/project/server/stack/factory/stack-components-helpers.js +22 -0
  129. package/project/server/stack/factory/stack-components-template-base-actors.js +124 -0
  130. package/project/server/stack/factory/stack-components-template-base-test-cases.js +22 -0
  131. package/project/server/stack/factory/stack-components-templates-actors.js +15 -0
  132. package/project/server/stack/factory/stack-components-templates-test-cases.js +20 -0
  133. package/project/server/stack/managers/client-manager/client-manager.js +193 -0
  134. package/project/server/stack/managers/connection-manager/connection-data.js +82 -0
  135. package/project/server/stack/managers/connection-manager/connection-manager.js +177 -0
  136. package/project/server/stack/managers/connection-manager/connection-object.js +148 -0
  137. package/project/server/stack/managers/connection-manager/shared-data.js +14 -0
  138. package/project/server/stack/managers/manager.js +95 -0
  139. package/project/server/stack/managers/server-manager/server-manager.js +76 -0
  140. package/project/server/stack/managers/server-manager/server.js +384 -0
  141. package/project/server/stack/managers/shared-manager.js +117 -0
  142. package/project/server/stack/network/buffer-manager.js +190 -0
  143. package/project/server/stack/network/mc/mc-connection-client-shared.js +51 -0
  144. package/project/server/stack/network/mc/mc-connection-client.js +117 -0
  145. package/project/server/stack/network/mc/mc-connection-server-shared.js +51 -0
  146. package/project/server/stack/network/mc/mc-connection-server.js +58 -0
  147. package/project/server/stack/network/mc/mc-connection-shared.js +26 -0
  148. package/project/server/stack/network/mc/mc-connection.js +33 -0
  149. package/project/server/stack/network/mc/mc-server.js +90 -0
  150. package/project/server/stack/network/network-connection-shared.js +177 -0
  151. package/project/server/stack/network/network-connection.js +134 -0
  152. package/project/server/stack/network/network-helper.js +12 -0
  153. package/project/server/stack/network/network-server.js +36 -0
  154. package/project/server/stack/network/network-type.js +46 -0
  155. package/project/server/stack/network/tcp/tcp-connection-client-shared.js +18 -0
  156. package/project/server/stack/network/tcp/tcp-connection-client.js +71 -0
  157. package/project/server/stack/network/tcp/tcp-connection-server-shared.js +14 -0
  158. package/project/server/stack/network/tcp/tcp-connection-server.js +16 -0
  159. package/project/server/stack/network/tcp/tcp-connection-shared.js +55 -0
  160. package/project/server/stack/network/tcp/tcp-connection.js +167 -0
  161. package/project/server/stack/network/tcp/tcp-server.js +35 -0
  162. package/project/server/stack/network/tls/tls-connection-client-shared.js +18 -0
  163. package/project/server/stack/network/tls/tls-connection-client.js +76 -0
  164. package/project/server/stack/network/tls/tls-connection-server-shared.js +14 -0
  165. package/project/server/stack/network/tls/tls-connection-server.js +16 -0
  166. package/project/server/stack/network/tls/tls-connection-shared.js +63 -0
  167. package/project/server/stack/network/tls/tls-connection.js +176 -0
  168. package/project/server/stack/network/tls/tls-server.js +45 -0
  169. package/project/server/stack/network/transport.js +19 -0
  170. package/project/server/stack/network/udp/udp-connection-client-shared.js +47 -0
  171. package/project/server/stack/network/udp/udp-connection-client.js +93 -0
  172. package/project/server/stack/network/udp/udp-connection-server-shared.js +51 -0
  173. package/project/server/stack/network/udp/udp-connection-server.js +58 -0
  174. package/project/server/stack/network/udp/udp-connection-shared.js +26 -0
  175. package/project/server/stack/network/udp/udp-connection.js +33 -0
  176. package/project/server/stack/network/udp/udp-server.js +74 -0
  177. package/project/server/stack/pending/pending-const.js +22 -0
  178. package/project/server/stack/pending/pending-context-receive.js +18 -0
  179. package/project/server/stack/pending/pending-context-send.js +18 -0
  180. package/project/server/stack/pending/pending-context.js +18 -0
  181. package/project/server/stack/pending/pending-inner.js +107 -0
  182. package/project/server/stack/pending/pending-switch.js +146 -0
  183. package/project/server/stack/stacks/ascii-dictionary.js +289 -0
  184. package/project/server/stack/stacks/binary-log.js +88 -0
  185. package/project/server/stack/stacks/bit-byte.js +51 -0
  186. package/project/server/stack/stacks/browser-data.js +25 -0
  187. package/project/server/stack/stacks/cancel-object.js +16 -0
  188. package/project/server/stack/stacks/connection-client.js +228 -0
  189. package/project/server/stack/stacks/connection-instance.js +69 -0
  190. package/project/server/stack/stacks/connection-ip.js +374 -0
  191. package/project/server/stack/stacks/connection-server.js +169 -0
  192. package/project/server/stack/stacks/connection-web.js +113 -0
  193. package/project/server/stack/stacks/connection-worker-client.js +29 -0
  194. package/project/server/stack/stacks/connection-worker-connection.js +41 -0
  195. package/project/server/stack/stacks/connection-worker-server.js +29 -0
  196. package/project/server/stack/stacks/connection-worker.js +99 -0
  197. package/project/server/stack/stacks/connection.js +132 -0
  198. package/project/server/stack/stacks/decoder.js +83 -0
  199. package/project/server/stack/stacks/encoder.js +82 -0
  200. package/project/server/stack/stacks/ip-log.js +24 -0
  201. package/project/server/stack/stacks/message-selector.js +22 -0
  202. package/project/server/stack/stacks/msg-ip.js +18 -0
  203. package/project/server/stack/stacks/stack-content-cache.js +27 -0
  204. package/project/z-abs-funclayer-engine-server.tree +230 -0
@@ -0,0 +1,40 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class SdpEncoder {
6
+ static encode(sdpMessage) {
7
+ const lines = [];
8
+ // --- Session-level mandatory lines ---
9
+ lines.push(`v=${sdpMessage.version}`);
10
+ lines.push(`o=${sdpMessage.origin.username} ${sdpMessage.origin.sessionId} ${sdpMessage.origin.sessionVersion} ` + `${sdpMessage.origin.netType} ${sdpMessage.origin.addrType} ${sdpMessage.origin.unicastAddress}`);
11
+ lines.push(`s=${sdpMessage.sessionName}`);
12
+ lines.push(`t=${sdpMessage.timing.start} ${sdpMessage.timing.stop}`);
13
+ // --- Session-level attributes ---
14
+ for(const attr of sdpMessage.sessionAttributes) {
15
+ if(null === attr.value) {
16
+ lines.push(`a=${attr.name}`);
17
+ }
18
+ else {
19
+ lines.push(`a=${attr.name}:${attr.value}`);
20
+ }
21
+ }
22
+ // --- Media sections ---
23
+ for(const m of sdpMessage.media) {
24
+ const payloadList = m.payloadTypes.join(" ");
25
+ lines.push(`m=${m.kind} ${m.port} ${m.protocol} ${payloadList}`);
26
+ for(const attr of m.attributes) {
27
+ if(null === attr.value) {
28
+ lines.push(`a=${attr.name}`);
29
+ }
30
+ else {
31
+ lines.push(`a=${attr.name}:${attr.value}`);
32
+ }
33
+ }
34
+ }
35
+ return lines.join("\r\n") + "\r\n";
36
+ }
37
+ }
38
+
39
+
40
+ module.exports = SdpEncoder;
@@ -0,0 +1,13 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class SdpMediaAttribute {
6
+ constructor(name, value = null) {
7
+ this.name = name; // e.g., "rtpmap"
8
+ this.value = value;
9
+ }
10
+ }
11
+
12
+
13
+ module.exports = SdpMediaAttribute;
@@ -0,0 +1,16 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class SdpMediaSession {
6
+ constructor() {
7
+ this.kind = ""; // audio | video | application
8
+ this.port = 0;
9
+ this.protocol = ""; // RTP/SAVPF, UDP/TLS/RTP/SAVPF, etc.
10
+ this.payloadTypes = []; // e.g., [96, 97, 98]
11
+ this.attributes = []; // a= lines inside m= section
12
+ }
13
+ }
14
+
15
+
16
+ module.exports = SdpMediaSession;
@@ -0,0 +1,17 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class SdpMessage {
6
+ constructor() {
7
+ this.version = 0;
8
+ this.origin = new Origin(); // o=
9
+ this.sessionName = ""; // s=
10
+ this.timing = new Timing(); // t=
11
+ this.media = []; // m= sections
12
+ this.sessionAttributes = []; // a= at session level
13
+ }
14
+ }
15
+
16
+
17
+ module.exports = SdpMessage;
@@ -0,0 +1,17 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class SdpOrigin {
6
+ constructor() {
7
+ this.username = "-";
8
+ this.sessionId = "";
9
+ this.sessionVersion = "";
10
+ this.netType = "IN";
11
+ this.addrType = "IP4";
12
+ this.unicastAddress = "";
13
+ }
14
+ }
15
+
16
+
17
+ module.exports = SdpOrigin;
@@ -0,0 +1,13 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class SdpSessionAttribute {
6
+ constructor(name, value = null) {
7
+ this.name = name; // e.g., "ice-ufrag"
8
+ this.value = value;
9
+ }
10
+ }
11
+
12
+
13
+ module.exports = SdpSessionAttribute;
@@ -0,0 +1,15 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class SdpTiming {
6
+ this.username = "-";
7
+ this.sessionId = "";
8
+ this.sessionVersion = "";
9
+ this.netType = "IN";
10
+ this.addrType = "IP4";
11
+ this.unicastAddress = "";
12
+ }
13
+
14
+
15
+ module.exports = SdpTiming;
@@ -0,0 +1,35 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class TextProtocolHeader {
6
+ static parseValue(value) {
7
+ if(typeof value === 'string') {
8
+ return value;
9
+ }
10
+ else if(typeof value === 'number') {
11
+ return '' + value;
12
+ }
13
+ else if(typeof value === 'boolean') {
14
+ return value ? 'true' : 'false';
15
+ }
16
+ else {
17
+ return null;
18
+ }
19
+ }
20
+
21
+ static addHeader(headers, name, value) {
22
+ if(undefined !== value) {
23
+ const convertedValue = TextProtocolHeader.parseValue(value);
24
+ if(convertedValue) {
25
+ if(!headers.has(name)) {
26
+ headers.set(name, []);
27
+ }
28
+ headers.get(name).push(convertedValue);
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+
35
+ module.exports = TextProtocolHeader;
@@ -0,0 +1,22 @@
1
+
2
+ 'use strict';
3
+
4
+ const Os = require('os');
5
+
6
+
7
+ class StackComponentsHelpers {
8
+ static _template(strings, ...keys) {
9
+ return ((...values) => {
10
+ const dict = values[values.length - 1] || {};
11
+ const result = [strings[0].replace(new RegExp('\n', 'g'), Os.EOL)];
12
+ keys.forEach((key, i) => {
13
+ const value = Number.isInteger(key) ? values[key] : dict[key];
14
+ result.push(value, strings[i + 1].replace(new RegExp('\n', 'g'), Os.EOL));
15
+ });
16
+ return result.join('');
17
+ });
18
+ }
19
+ }
20
+
21
+
22
+ module.exports = StackComponentsHelpers;
@@ -0,0 +1,124 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorTypeConst = require('z-abs-funclayer-engine-cs/clientServer/execution/actor-type-const');
5
+
6
+
7
+ class StackComponentsTemplateBaseActors {
8
+ constructor(templates) {
9
+ this.templates = [
10
+ {
11
+ name: 'Local',
12
+ templateNames: [],
13
+ templates: [],
14
+ markupNodes: [],
15
+ markupStyles: [],
16
+ markups: []
17
+ },
18
+ {
19
+ name: 'Condition',
20
+ templateNames: [],
21
+ templates: [],
22
+ markupNodes: [],
23
+ markupStyles: [],
24
+ markups: []
25
+ },
26
+ {
27
+ name: 'Originating',
28
+ templateNames: [],
29
+ templates: [],
30
+ markupNodes: [],
31
+ markupStyles: [],
32
+ markups: []
33
+ },
34
+ {
35
+ name: 'RealSut',
36
+ templateNames: [],
37
+ templates: [],
38
+ markupNodes: [],
39
+ markupStyles: [],
40
+ markups: []
41
+ },
42
+ {
43
+ name: 'Sut',
44
+ templateNames: [],
45
+ templates: [],
46
+ markupNodes: [],
47
+ markupStyles: [],
48
+ markups: []
49
+ },
50
+ {
51
+ name: 'Proxy',
52
+ templateNames: [],
53
+ templates: [],
54
+ markupNodes: [],
55
+ markupStyles: [],
56
+ markups: []
57
+ },
58
+ {
59
+ name: 'Terminating',
60
+ templateNames: [],
61
+ templates: [],
62
+ markupNodes: [],
63
+ markupStyles: [],
64
+ markups: []
65
+ },
66
+ {
67
+ name: 'Intercepting',
68
+ templateNames: [],
69
+ templates: [],
70
+ markupNodes: [],
71
+ markupStyles: [],
72
+ markups: []
73
+ },
74
+ {
75
+ name: 'ActorPartPre',
76
+ templateNames: [],
77
+ templates: [],
78
+ markupNodes: [],
79
+ markupStyles: [],
80
+ markups: []
81
+ },
82
+ {
83
+ name: 'ActorPartPost',
84
+ templateNames: [],
85
+ templates: [],
86
+ markupNodes: [],
87
+ markupStyles: [],
88
+ markups: []
89
+ },
90
+ {
91
+ name: 'Msg',
92
+ templateNames: [],
93
+ templates: [],
94
+ markupNodes: [],
95
+ markupStyles: [],
96
+ markups: []
97
+ }
98
+ ];
99
+ templates.forEach((template) => {
100
+ let id = ActorTypeConst.getId(template.type);
101
+ if(!id) {
102
+ if('actorpartpre' === template.type) {
103
+ id = 8;
104
+ }
105
+ else if('actorpartpost' === template.type) {
106
+ id = 9;
107
+ }
108
+ else if('msg' === template.type) {
109
+ id = 10;
110
+ }
111
+ else {
112
+ return;
113
+ }
114
+ }
115
+ this.templates[id].templateNames.push(template.displayName);
116
+ this.templates[id].templates.push(template.template);
117
+ this.templates[id].markupNodes.push(template.markupNodes);
118
+ this.templates[id].markupStyles.push(template.markupStyle),
119
+ this.templates[id].markups.push(template.markup);
120
+ });
121
+ }
122
+ }
123
+
124
+ module.exports = StackComponentsTemplateBaseActors;
@@ -0,0 +1,22 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class StackComponentsTemplateBaseTestCases {
6
+ constructor(templates) {
7
+ this.templates = new Map();
8
+ templates.forEach((template) => {
9
+ this.templates.set(template.displayName, {
10
+ displayName: template.displayName,
11
+ regressionFriendly: template.regressionFriendly,
12
+ template: template.template,
13
+ testDataViews: template.testDataViews,
14
+ markupNodes: template.markupNodes,
15
+ markup: template.markup,
16
+ createTestCase: template.createTestCase
17
+ });
18
+ });
19
+ }
20
+ }
21
+
22
+ module.exports = StackComponentsTemplateBaseTestCases;
@@ -0,0 +1,15 @@
1
+
2
+ 'use strict';
3
+
4
+ const StackComponentsHelpers = require('./stack-components-helpers');
5
+
6
+
7
+ class StackComponentsTemplatesActors {
8
+
9
+ static _template(strings, ...keys) {
10
+ return StackComponentsHelpers._template(strings, ...keys);
11
+ }
12
+ }
13
+
14
+
15
+ module.exports = StackComponentsTemplatesActors;
@@ -0,0 +1,20 @@
1
+
2
+ 'use strict';
3
+
4
+ const StackComponentsHelpers = require('./stack-components-helpers');
5
+
6
+
7
+ class StackComponentsTemplatesTestCases {
8
+
9
+ static _template(strings, ...keys) {
10
+ return StackComponentsHelpers._template(strings, ...keys);
11
+ }
12
+ }
13
+
14
+
15
+ StackComponentsTemplatesTestCases.VALIDATE_NONE = 0;
16
+ StackComponentsTemplatesTestCases.VALIDATE_SUCCESS = 1;
17
+ StackComponentsTemplatesTestCases.VALIDATE_WARNING = 2;
18
+ StackComponentsTemplatesTestCases.VALIDATE_ERROR = 3;
19
+
20
+ module.exports = StackComponentsTemplatesTestCases;
@@ -0,0 +1,193 @@
1
+
2
+ 'use strict';
3
+
4
+ const Manager = require('../manager');
5
+ const BrowserData = require('../../stacks/browser-data');
6
+ const ConnectionInstance = require('../../stacks/connection-instance');
7
+ const ConnectionClient = require('../../stacks/connection-client');
8
+ const PendingConst = require('../../pending/pending-const');
9
+ const PendingContext = require('../../pending/pending-context');
10
+ const ConnectionWeb = require('../../stacks/connection-web');
11
+ const StackComponentsFactory = require('z-abs-funclayer-stack-server/server/factory/stack-components-factory');
12
+ const FactoryNew = require('z-abs-corelayer-cs/clientServer/factory/factory-new');
13
+ const LogDataStackType = require('z-abs-funclayer-engine-cs/clientServer/log/log-data-stack-type');
14
+
15
+
16
+ class ClientManager extends Manager {
17
+ constructor(executionContext) {
18
+ super('client', executionContext);
19
+ this.connections = new Map();
20
+ }
21
+
22
+ getConnection(stackName, connectionInstanceData, actor, reuse, srcAddress, dstAddress, options) {
23
+ let connection = null;
24
+ let browserData = null;
25
+ if(options.messageSelector) {
26
+ throw new Error('messageSelector is not implemented.');
27
+ }
28
+ const connectionInstanceParsed = ConnectionInstance.parse(connectionInstanceData);
29
+ if(reuse) {
30
+ connection = this.getToReuse(stackName, (type) => {
31
+ if('client' === type) {
32
+ return this._getConnectionClientKey(stackName, options, srcAddress, dstAddress);
33
+ }
34
+ else if('web' === type) {
35
+ browserData = this._createBrowserData(srcAddress, dstAddress);
36
+ return this._getConnectionWebKey(stackName, browserData);
37
+ }
38
+ });
39
+ if(connection) {
40
+ connectionInstanceParsed.connectionInstance.connection = connection;
41
+ connection.actor = actor;
42
+ connection.addPendingInner(PendingConst.ACTOR, actor);
43
+ if(connection.connectionWorker) {
44
+ connection.connectionWorker.setConnectionInstance(connectionInstanceParsed.connectionInstance);
45
+ connection.connectionWorker.setConnectionInstanceUpgrade(connectionInstanceParsed.connectionInstanceUpgrade);
46
+ }
47
+ connection.sharedManager = this.sharedManager;
48
+ connection.executionId = this.executionContext.executionData.id;
49
+ connection.logIpStack(() => `USE STACK: ${connection.name}`, LogDataStackType.USE, '74ee23f9-b5b1-4dcf-91d4-4de46aac4767');
50
+ if(connection.onReuse) {
51
+ const pendingContext = new PendingContext(PendingConst.ACTOR);
52
+ connection.pendingStartContext(pendingContext, 'reuse');
53
+ if(browserData) {
54
+ connection.setBrowserData(browserData);
55
+ }
56
+ connection.onReuse(browserData, (c, err) => {
57
+ if(!err) {
58
+ connection.pendingDoneContext(pendingContext, 'reuse', connection);
59
+ }
60
+ else {
61
+ connection.pendingErrorContext(pendingContext, 'reuse', err);
62
+ }
63
+ });
64
+ return
65
+ }
66
+ connection.pendingResultContext('reuse', connection);
67
+ }
68
+ }
69
+ if(!connection) {
70
+ const factory = StackComponentsFactory.createClient(stackName);
71
+ const connection = FactoryNew.create(factory, ++this.id, this.type, actor, options);
72
+ connectionInstanceParsed.connectionInstance.connection = connection;
73
+ if(connection.connectionWorker) {
74
+ connection.connectionWorker.setConnectionInstance(connectionInstanceParsed.connectionInstance);
75
+ connection.connectionWorker.setConnectionInstanceUpgrade(connectionInstanceParsed.connectionInstanceUpgrade);
76
+ }
77
+ connection.sharedManager = this.sharedManager;
78
+ connection.executionId = this.executionContext.executionData.id;
79
+ if(!reuse) {
80
+ this.connections.set(connection.id, connection);
81
+ }
82
+ else {
83
+ this.setUsing(connection);
84
+ }
85
+ if(connection instanceof ConnectionClient) {
86
+ connection.connect(connectionInstanceParsed.connectionInstanceUpgrade, dstAddress, srcAddress, this.dnsUrlCache, !reuse ? (connection, err) => {
87
+ this.connections.delete(connection.id);
88
+ connection.logIpStack(() => `DEL STACK: ${connection.name}`, LogDataStackType.DEL, 'a9185bb6-82c5-4495-9416-3c26269c8944');
89
+ } : (connection, err) => {
90
+ if(!err) {
91
+ connection.errorData = [];
92
+ this.storeForReuse(stackName, 'client', this._getConnectionClientKey(stackName, options, srcAddress, dstAddress), connection);
93
+ connection.logIpStack(() => `STORE STACK: ${connection.name}`, LogDataStackType.STORE, '54532ce8-8cd9-49ff-95c0-0254f56b2d49');
94
+ }
95
+ else {
96
+ this.executionContext.testCaseStatistics.addErrorData(connection);
97
+ this.removeUsing(connection);
98
+ connection.logIpStack(() => `DEL STACK: ${connection.name}`, LogDataStackType.DEL, 'c17524db-0da5-4a5d-b41e-9d7b7c8b80e0');
99
+ }
100
+ });
101
+ if(reuse) {
102
+ this.addConnectionType(stackName, 'client', connection);
103
+ }
104
+ }
105
+ else if(connection instanceof ConnectionWeb) {
106
+ !browserData && (browserData = this._createBrowserData(srcAddress, dstAddress));
107
+ connection.connect(browserData, this.dnsUrlCache, reuse, !reuse ? (connection, err) => {
108
+ this.connections.delete(connection.id);
109
+ connection.logIpStack(() => `DEL STACK: ${connection.name}`, LogDataStackType.DEL, 'ca515a42-bec3-489c-81b1-55854bbaa132');
110
+ } : (connection, err) => {
111
+ if(!err) {
112
+ connection.errorData = [];
113
+ this.storeForReuse(stackName, 'web', this._getConnectionWebKey(stackName, browserData), connection);
114
+ connection.logIpStack(() => `STORE STACK: ${connection.name}`, LogDataStackType.STORE, '20ab42ef-473a-4520-a06c-1a465b691121');
115
+ }
116
+ else {
117
+ this.executionContext.testCaseStatistics.addErrorData(connection);
118
+ this.removeUsing(connection);
119
+ connection.logIpStack(() => `DEL STACK: ${connection.name}`, LogDataStackType.DEL, 'ca515a42-bec3-489c-81b1-55854bbaa132');
120
+ }
121
+ });
122
+ if(reuse) {
123
+ this.addConnectionType(stackName, 'web', connection);
124
+ }
125
+ }
126
+ }
127
+ }
128
+
129
+ switchProtocol(stackName, currentConnectionInstance, upgradedConnectionInstance, actor) {
130
+ if(!upgradedConnectionInstance || !(upgradedConnectionInstance instanceof ConnectionInstance)) {
131
+ throw new Error('Connection must be created with create() method.');
132
+ }
133
+ const factory = StackComponentsFactory.createClient(stackName);
134
+ const connection = FactoryNew.create(factory, ++this.id, this.type, actor, currentConnectionInstance.connection.options);
135
+ upgradedConnectionInstance.connection = connection;
136
+ currentConnectionInstance.connection.detachTo(upgradedConnectionInstance);
137
+ this.connections.set(connection.id, connection);
138
+ return connection;
139
+ }
140
+
141
+ close(done) {
142
+ let connections = this.connections.size;
143
+ let usingReuseConnections = this.usingReuseConnections.size;
144
+ if(0 === connections && 0 === usingReuseConnections) {
145
+ done();
146
+ return;
147
+ }
148
+ this.connections.forEach((connection) => {
149
+ connection.closeForgottenConnections(() => {
150
+ connection.logIpStack(() => `DEL STACK: ${connection.name}`, LogDataStackType.DEL, 'b0ca9eeb-8d69-4692-8dc2-cf28c3c56982');
151
+ if(0 === --connections) {
152
+ this.connections.clear();
153
+ done();
154
+ }
155
+ });
156
+ });
157
+ this.usingReuseConnections.forEach((connection) => {
158
+ connection.closeForgottenConnections(() => {
159
+ connection.logIpStack(() => `DEL STACK: ${connection.name}`, LogDataStackType.DEL, 'd2f333e0-8aef-422e-8709-d3f26225ce47');
160
+ if(0 === --usingReuseConnections) {
161
+ this.usingReuseConnections.clear();
162
+ done();
163
+ }
164
+ });
165
+ });
166
+ }
167
+
168
+ _getConnectionClientKey(stackName, options, srcAddress, dstAddress) {
169
+ return `${stackName}_${options.transportLayer.transportType}_${srcAddress.host}:${srcAddress.port} => ${dstAddress.host}:${dstAddress.port}`;
170
+ }
171
+
172
+ _getConnectionWebKey(stackName, browserData) {
173
+ return `${stackName}_${browserData.srcAddress.addressName}:${browserData.srcAddress.page}:${browserData.srcAddress.incognitoBrowser}`;
174
+ }
175
+
176
+ _createBrowserData(srcAddress, dstAddress) {
177
+ if(!Array.isArray(dstAddress)) {
178
+ return new BrowserData(srcAddress, dstAddress);
179
+ }
180
+ else {
181
+ if(2 !== dstAddress.length) {
182
+ }
183
+ else {
184
+ const address = dstAddress[0].clone();
185
+ address.setProxy(dstAddress[1]);
186
+ return new BrowserData(srcAddress, address);
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+
193
+ module.exports = ClientManager;
@@ -0,0 +1,82 @@
1
+
2
+ 'use strict';
3
+
4
+ const NetworkType = require('../../network/network-type');
5
+
6
+
7
+ class ConnectionData {
8
+ static NOT_CONNECTED = 0;
9
+ static CONNECTED = 1;
10
+ static DISCONNECTED = 2;
11
+
12
+ constructor(ownerId, id, actorIndex, transportLayer, address, isShared) {
13
+ this.ownerId = ownerId;
14
+ this.id = id;
15
+ this.actorIndex = actorIndex;
16
+ this.actionId = 0;
17
+ this.host = address.host ? address.host : '*';
18
+ this.port = 0 !== address.port ? address.port : '*';
19
+ this.transportLayer = transportLayer;
20
+ this.addressName = address.addressName;
21
+ this.family = address.family;
22
+ this.type = address.type;
23
+ this.isShared = isShared;
24
+ this.secure = false;
25
+ this.dataId = -1;
26
+ this._log = `${this.host}:${this.port}:${this.addressName ? this.addressName : ''}${this._getProperties()}`;
27
+ }
28
+
29
+ static create(ownerId, id, actorIndex, transportLayer, addressName, type, host, port, family, isShared) {
30
+ return new ConnectionData(ownerId, id, actorIndex, transportLayer, {addressName, host, port, type, family}, isShared);
31
+ }
32
+
33
+ update(host, port, family) {
34
+ this.host = host;
35
+ this.port = port;
36
+ this.family = family;
37
+ this._log = `${host}:${port}:${this.addressName ? this.addressName : ''}${this._getProperties()}`;
38
+ }
39
+
40
+ getLog() {
41
+ return this._log;
42
+ }
43
+
44
+ _getProperties() {
45
+ if(this.transportLayer.transportProperties) {
46
+ const properties = [];
47
+ this.transportLayer.transportProperties.forEach((value, name) => {
48
+ if('string' === typeof value) {
49
+ properties.push(`${name}: ${value}`);
50
+ }
51
+ else {
52
+ properties.push(`${name}: "${value}"`);
53
+ }
54
+ });
55
+ return ` \uD83D\uDD27 [${properties.join(', ')}]`;
56
+ }
57
+ else {
58
+ return '';
59
+ }
60
+ }
61
+
62
+ toJSON() {
63
+ return {
64
+ ownerId: this.ownerId,
65
+ id: this.id,
66
+ actorIndex: this.actorIndex,
67
+ actionId: this.actionId,
68
+ host: this.host,
69
+ port: this.port,
70
+ transportLayer: this.transportLayer,
71
+ name: this.addressName, // RENAME: affects sequence diagram
72
+ family: this.family,
73
+ type: this.type,
74
+ isShared: this.isShared,
75
+ secure: this.secure,
76
+ dataId: this.dataId
77
+ };
78
+ }
79
+ }
80
+
81
+
82
+ module.exports = ConnectionData;