@aj-shadow/z-abs-complayer-markup-client 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 (208) 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/client/_build/Bundle-CompLayer-Markup-client.bld +40 -0
  7. package/project/client/_build/Client-CompLayer-Markup-client-jsx.bld +10 -0
  8. package/project/client/_build/Client-CompLayer-Markup-client.bld +10 -0
  9. package/project/client/_build/Client-css-CompLayer-Markup-bundle.bld +9 -0
  10. package/project/client/_build/z-abs-complayer-markup-client.prj +36 -0
  11. package/project/client/actions/action-style.js +17 -0
  12. package/project/client/actions/data-action-style.js +13 -0
  13. package/project/client/css/markup_addressing.css +30 -0
  14. package/project/client/css/markup_flowchart.css +53 -0
  15. package/project/client/css/markup_general.css +4 -0
  16. package/project/client/css/markup_image.css +10 -0
  17. package/project/client/css/markup_license.css +107 -0
  18. package/project/client/css/markup_login.css +201 -0
  19. package/project/client/css/markup_node_diagram.css +51 -0
  20. package/project/client/css/markup_sequence_diagram.css +6 -0
  21. package/project/client/css/markup_state.css +5 -0
  22. package/project/client/css/markup_table.css +57 -0
  23. package/project/client/css/markup_tc.css +32 -0
  24. package/project/client/css/markup_ts.css +36 -0
  25. package/project/client/data/addresses/data-addresses-client-address-global.js +20 -0
  26. package/project/client/data/addresses/data-addresses-client-address-local.js +20 -0
  27. package/project/client/data/addresses/data-addresses-client-interface-global.js +17 -0
  28. package/project/client/data/addresses/data-addresses-client-interface-local.js +17 -0
  29. package/project/client/data/addresses/data-addresses-dns-global.js +18 -0
  30. package/project/client/data/addresses/data-addresses-dns-local.js +19 -0
  31. package/project/client/data/addresses/data-addresses-dst-global.js +20 -0
  32. package/project/client/data/addresses/data-addresses-dst-local.js +20 -0
  33. package/project/client/data/addresses/data-addresses-network-interface-global.js +17 -0
  34. package/project/client/data/addresses/data-addresses-network-interface-local.js +17 -0
  35. package/project/client/data/addresses/data-addresses-ports-global.js +18 -0
  36. package/project/client/data/addresses/data-addresses-ports-local.js +18 -0
  37. package/project/client/data/addresses/data-addresses-server-address-global.js +20 -0
  38. package/project/client/data/addresses/data-addresses-server-address-local.js +20 -0
  39. package/project/client/data/addresses/data-addresses-server-interface-global.js +17 -0
  40. package/project/client/data/addresses/data-addresses-server-interface-local.js +17 -0
  41. package/project/client/data/addresses/data-addresses-src-global.js +21 -0
  42. package/project/client/data/addresses/data-addresses-src-local.js +21 -0
  43. package/project/client/data/addresses/data-addresses-srv-global.js +20 -0
  44. package/project/client/data/addresses/data-addresses-srv-local.js +20 -0
  45. package/project/client/data/addresses/data-addresses-sut-address-global.js +20 -0
  46. package/project/client/data/addresses/data-addresses-sut-address-local.js +20 -0
  47. package/project/client/data/addresses/data-addresses-sut-interface-global.js +19 -0
  48. package/project/client/data/addresses/data-addresses-sut-interface-local.js +19 -0
  49. package/project/client/data/data-chart/data-chart-axis.js +13 -0
  50. package/project/client/data/data-chart/data-chart-grid.js +14 -0
  51. package/project/client/data/data-chart/data-chart-line/data-chart-line-config.js +17 -0
  52. package/project/client/data/data-chart/data-chart-line/data-chart-line.js +41 -0
  53. package/project/client/data/data-config.js +14 -0
  54. package/project/client/data/data-constructor.js +18 -0
  55. package/project/client/data/data-content/data-content-audio-global.js +18 -0
  56. package/project/client/data/data-content/data-content-audio-local.js +18 -0
  57. package/project/client/data/data-content/data-content-documents-global.js +18 -0
  58. package/project/client/data/data-content/data-content-documents-local.js +18 -0
  59. package/project/client/data/data-content/data-content-image-global.js +21 -0
  60. package/project/client/data/data-content/data-content-image-local.js +21 -0
  61. package/project/client/data/data-content/data-content-other-global.js +20 -0
  62. package/project/client/data/data-content/data-content-other-local.js +20 -0
  63. package/project/client/data/data-content/data-content-text-global.js +20 -0
  64. package/project/client/data/data-content/data-content-text-local.js +20 -0
  65. package/project/client/data/data-content/data-content-video-global.js +20 -0
  66. package/project/client/data/data-content/data-content-video-local.js +20 -0
  67. package/project/client/data/data-data.js +28 -0
  68. package/project/client/data/data-dependencies/data-dependencies.js +17 -0
  69. package/project/client/data/data-documentation/data-documentation-navigation.js +15 -0
  70. package/project/client/data/data-documentation/data-documentation.js +20 -0
  71. package/project/client/data/data-flowchart/data-flowchart-block.js +33 -0
  72. package/project/client/data/data-flowchart/data-flowchart-connection.js +17 -0
  73. package/project/client/data/data-flowchart/data-flowchart.js +30 -0
  74. package/project/client/data/data-html/data-html-anchor.js +12 -0
  75. package/project/client/data/data-html/data-html-br.js +11 -0
  76. package/project/client/data/data-html/data-html-button.js +15 -0
  77. package/project/client/data/data-html/data-html-log-start.js +12 -0
  78. package/project/client/data/data-html/data-html-log-stop.js +13 -0
  79. package/project/client/data/data-html/data-html-log.js +16 -0
  80. package/project/client/data/data-html/data-html-toolbar.js +19 -0
  81. package/project/client/data/data-image/data-image.js +20 -0
  82. package/project/client/data/data-lab/data-lab-interface-client.js +19 -0
  83. package/project/client/data/data-lab/data-lab-interface-server.js +19 -0
  84. package/project/client/data/data-lab/data-lab-interface-sut.js +20 -0
  85. package/project/client/data/data-lab/data-lab-network.js +31 -0
  86. package/project/client/data/data-lab/data-lab.js +21 -0
  87. package/project/client/data/data-licenses/data-licenses.js +16 -0
  88. package/project/client/data/data-node-diagram/data-node-diagram-config.js +21 -0
  89. package/project/client/data/data-node-diagram/data-node-diagram-connection.js +18 -0
  90. package/project/client/data/data-node-diagram/data-node-diagram-group.js +16 -0
  91. package/project/client/data/data-node-diagram/data-node-diagram-node.js +22 -0
  92. package/project/client/data/data-node-diagram/data-node-diagram.js +47 -0
  93. package/project/client/data/data-repos/data-repos-content-local.js +15 -0
  94. package/project/client/data/data-repos/data-repos-data-local.js +15 -0
  95. package/project/client/data/data-sequence-diagram/data-sequence-diagram-config.js +22 -0
  96. package/project/client/data/data-sequence-diagram/data-sequence-diagram-message.js +17 -0
  97. package/project/client/data/data-sequence-diagram/data-sequence-diagram-node.js +11 -0
  98. package/project/client/data/data-sequence-diagram/data-sequence-diagram.js +32 -0
  99. package/project/client/data/data-state-machine/data-state-machine-config.js +17 -0
  100. package/project/client/data/data-state-machine/data-state-machine-state.js +29 -0
  101. package/project/client/data/data-state-machine/data-state-machine-transition.js +18 -0
  102. package/project/client/data/data-state-machine/data-state-machine.js +37 -0
  103. package/project/client/data/data-system-under-test/data-system-under-test-instances.js +15 -0
  104. package/project/client/data/data-system-under-test/data-system-under-test-nodes.js +18 -0
  105. package/project/client/data/data-table/data-table-config.js +21 -0
  106. package/project/client/data/data-table-key-value.js +56 -0
  107. package/project/client/data/data-test-case/data-actor.js +282 -0
  108. package/project/client/data/data-test-case/data-test-case-settings.js +49 -0
  109. package/project/client/data/data-test-case/data-test-case.js +19 -0
  110. package/project/client/data/data-test-case/data-test-data-iteration.js +54 -0
  111. package/project/client/data/data-test-case/data-test-data-test-case.js +16 -0
  112. package/project/client/data/data-test-case/data-verification-test-case.js +24 -0
  113. package/project/client/data/data-test-data/data-test-data-environment-global.js +18 -0
  114. package/project/client/data/data-test-data/data-test-data-environment-local.js +18 -0
  115. package/project/client/data/data-test-data/data-test-data-environment-static.js +16 -0
  116. package/project/client/data/data-test-data/data-test-data-general-global.js +18 -0
  117. package/project/client/data/data-test-data/data-test-data-general-local.js +18 -0
  118. package/project/client/data/data-test-data/data-test-data-output-global.js +18 -0
  119. package/project/client/data/data-test-data/data-test-data-output-local.js +18 -0
  120. package/project/client/data/data-test-data/data-test-data-system-global.js +18 -0
  121. package/project/client/data/data-test-data/data-test-data-system-local.js +18 -0
  122. package/project/client/data/data-test-suite/data-test-suite-abstraction.js +72 -0
  123. package/project/client/data/data-test-suite/data-test-suite.js +15 -0
  124. package/project/client/data/data-tree/data-tree-node.js +17 -0
  125. package/project/client/data/data-tree/data-tree.js +13 -0
  126. package/project/client/markup/markup-addresses/markup-addresses-client-address.js +31 -0
  127. package/project/client/markup/markup-addresses/markup-addresses-client-interface.js +31 -0
  128. package/project/client/markup/markup-addresses/markup-addresses-dns.js +32 -0
  129. package/project/client/markup/markup-addresses/markup-addresses-dst.js +31 -0
  130. package/project/client/markup/markup-addresses/markup-addresses-network-interface.js +31 -0
  131. package/project/client/markup/markup-addresses/markup-addresses-ports.js +31 -0
  132. package/project/client/markup/markup-addresses/markup-addresses-server-address.js +31 -0
  133. package/project/client/markup/markup-addresses/markup-addresses-server-interface.js +31 -0
  134. package/project/client/markup/markup-addresses/markup-addresses-src.js +31 -0
  135. package/project/client/markup/markup-addresses/markup-addresses-srv.js +31 -0
  136. package/project/client/markup/markup-addresses/markup-addresses-sut-address.js +31 -0
  137. package/project/client/markup/markup-addresses/markup-addresses-sut-interface.js +31 -0
  138. package/project/client/markup/markup-chart/markup-chart-line.js +92 -0
  139. package/project/client/markup/markup-content/markup-content-audio.js +31 -0
  140. package/project/client/markup/markup-content/markup-content-documents.js +31 -0
  141. package/project/client/markup/markup-content/markup-content-image.js +31 -0
  142. package/project/client/markup/markup-content/markup-content-other.js +31 -0
  143. package/project/client/markup/markup-content/markup-content-text.js +31 -0
  144. package/project/client/markup/markup-content/markup-content-video.js +31 -0
  145. package/project/client/markup/markup-dependencies/markup-dependencies.js +30 -0
  146. package/project/client/markup/markup-documentation/markup-documentation-anchor.js +37 -0
  147. package/project/client/markup/markup-documentation/markup-documentation-api-status.js +67 -0
  148. package/project/client/markup/markup-documentation/markup-documentation-code.js +20 -0
  149. package/project/client/markup/markup-documentation/markup-documentation-div.js +34 -0
  150. package/project/client/markup/markup-documentation/markup-documentation-documentation-status.js +67 -0
  151. package/project/client/markup/markup-documentation/markup-documentation-embed.js +23 -0
  152. package/project/client/markup/markup-documentation/markup-documentation-html.js +139 -0
  153. package/project/client/markup/markup-documentation/markup-documentation-ie.js +21 -0
  154. package/project/client/markup/markup-documentation/markup-documentation-image.js +46 -0
  155. package/project/client/markup/markup-documentation/markup-documentation-lab.js +19 -0
  156. package/project/client/markup/markup-documentation/markup-documentation-local-note.js +33 -0
  157. package/project/client/markup/markup-documentation/markup-documentation-navigation.js +109 -0
  158. package/project/client/markup/markup-documentation/markup-documentation-page.js +262 -0
  159. package/project/client/markup/markup-documentation/markup-documentation-ref.js +28 -0
  160. package/project/client/markup/markup-documentation/markup-documentation-result.js +21 -0
  161. package/project/client/markup/markup-documentation/markup-documentation-state-machine.js +194 -0
  162. package/project/client/markup/markup-documentation/markup-documentation.js +74 -0
  163. package/project/client/markup/markup-flowchart.js +264 -0
  164. package/project/client/markup/markup-lab.js +116 -0
  165. package/project/client/markup/markup-licenses/markup-licenses.js +29 -0
  166. package/project/client/markup/markup-node-diagram.js +435 -0
  167. package/project/client/markup/markup-parse-helper.js +26 -0
  168. package/project/client/markup/markup-pattern-config.js +53 -0
  169. package/project/client/markup/markup-pattern-data.js +50 -0
  170. package/project/client/markup/markup-pattern-function.js +47 -0
  171. package/project/client/markup/markup-repos/markup-repos.js +31 -0
  172. package/project/client/markup/markup-sequence-diagram.js +466 -0
  173. package/project/client/markup/markup-system-under-test/markup-system-under-test-instances.js +29 -0
  174. package/project/client/markup/markup-system-under-test/markup-system-under-test-nodes.js +30 -0
  175. package/project/client/markup/markup-table-key-value-parse.js +25 -0
  176. package/project/client/markup/markup-table-key-value-stringify.js +91 -0
  177. package/project/client/markup/markup-table-key-value.js +18 -0
  178. package/project/client/markup/markup-table-name-value.js +101 -0
  179. package/project/client/markup/markup-table.js +85 -0
  180. package/project/client/markup/markup-tables-parser.js +122 -0
  181. package/project/client/markup/markup-test-case/markup-test-case.js +67 -0
  182. package/project/client/markup/markup-test-data/markup-test-data-environment.js +31 -0
  183. package/project/client/markup/markup-test-data/markup-test-data-general.js +31 -0
  184. package/project/client/markup/markup-test-data/markup-test-data-output.js +31 -0
  185. package/project/client/markup/markup-test-data/markup-test-data-system.js +31 -0
  186. package/project/client/markup/markup-test-suite/markup-test-suite.js +40 -0
  187. package/project/client/react-components/helper/line-data.js +16 -0
  188. package/project/client/react-components/helper/line-object.js +22 -0
  189. package/project/client/react-components/helper/scroll-data.js +74 -0
  190. package/project/client/react-components/markup/component-chart/component-image-chart-line.jsx +203 -0
  191. package/project/client/react-components/markup/component-code.jsx +50 -0
  192. package/project/client/react-components/markup/component-document.jsx +105 -0
  193. package/project/client/react-components/markup/component-documentation-anchor.jsx +47 -0
  194. package/project/client/react-components/markup/component-embed.jsx +48 -0
  195. package/project/client/react-components/markup/component-image-flowchart.jsx +389 -0
  196. package/project/client/react-components/markup/component-image-image.jsx +32 -0
  197. package/project/client/react-components/markup/component-image-lab.jsx +696 -0
  198. package/project/client/react-components/markup/component-image-node-diagram.jsx +506 -0
  199. package/project/client/react-components/markup/component-image-result.jsx +22 -0
  200. package/project/client/react-components/markup/component-image-sequence-diagram.jsx +645 -0
  201. package/project/client/react-components/markup/component-image-state-machine.jsx +633 -0
  202. package/project/client/react-components/markup/component-image-table.jsx +96 -0
  203. package/project/client/react-components/markup/component-local-note.jsx +99 -0
  204. package/project/client/react-components/markup/component-markup-remarkable.jsx +79 -0
  205. package/project/client/react-components/markup/component-markup.jsx +1036 -0
  206. package/project/client/react-components/markup/component-table-data-table.jsx +146 -0
  207. package/project/client/stores/style-store.js +96 -0
  208. package/project/z-abs-complayer-markup-client.tree +239 -0
@@ -0,0 +1,466 @@
1
+
2
+ 'use strict';
3
+
4
+ const DataSequenceDiagram = require('../data/data-sequence-diagram/data-sequence-diagram');
5
+ const DataSequenceDiagramNode = require('../data/data-sequence-diagram/data-sequence-diagram-node');
6
+ const DataSequenceDiagramMessage = require('../data/data-sequence-diagram/data-sequence-diagram-message');
7
+ const DataSequenceDiagramConfig = require('../data/data-sequence-diagram/data-sequence-diagram-config');
8
+
9
+
10
+ class MarkupSequenceDiagram {
11
+ markupName() {
12
+ return 'seq';
13
+ }
14
+
15
+ stringify(sequenceDiagram) {
16
+ let stringified = '';
17
+ if('' !== sequenceDiagram.title) {
18
+ stringified += `${MarkupSequenceDiagram.TAG_TITLE} ${sequenceDiagram.title}\n`;
19
+ }
20
+ const dataSequenceDiagramConfig = sequenceDiagram.dataSequenceDiagramConfig;
21
+ const keys = Object.keys(dataSequenceDiagramConfig);
22
+ stringified += 'Config(';
23
+ if(1 <= keys.length) {
24
+ stringified += `${keys[0]}: ${dataSequenceDiagramConfig[keys[0]]}`;
25
+ for(let i = 1; i < keys.length; ++i) {
26
+ stringified += `, ${keys[i]}: ${dataSequenceDiagramConfig[keys[i]]}`;
27
+ }
28
+ }
29
+ stringified += ')\n\n';
30
+ if(1 <= sequenceDiagram.nodes.length) {
31
+ stringified += 'Nodes[';
32
+ stringified += sequenceDiagram.nodes[0].name;
33
+ for(let i = 1; i < sequenceDiagram.nodes.length; ++i) {
34
+ stringified += `, ${sequenceDiagram.nodes[i].name}`;
35
+ }
36
+ stringified += ']';
37
+ }
38
+ else {
39
+ stringified += 'Nodes[]\n';
40
+ }
41
+ for(let i = 0; i < sequenceDiagram.messages.length; ++i) {
42
+ const message = sequenceDiagram.messages[i];
43
+ if(2 === message.nodes) {
44
+ if(-1 !== message.fromIndex && -1 !== message.toIndex) {
45
+ stringified += `\n${sequenceDiagram.nodes[message.fromIndex].name} ${this._stringifyMessageType(message)} ${sequenceDiagram.nodes[message.toIndex].name}[${message.type}]: ${message.data}`;
46
+ }
47
+ }
48
+ else if(1 === message.nodes) {
49
+ if(-1 !== message.fromIndex) {
50
+ stringified += `\n${sequenceDiagram.nodes[message.fromIndex].name} ${this._stringifyMessageType(message)} [${message.type}]: ${message.data}`;
51
+ }
52
+ }
53
+ else {
54
+ stringified += `\n${message.data}`
55
+ }
56
+ }
57
+ return stringified;
58
+ }
59
+
60
+ parse(markup) {
61
+ const rows = this._getRows(markup);
62
+ const dataSequenceDiagram = new DataSequenceDiagram();
63
+ rows.forEach((row) => {
64
+ this._parseRow(dataSequenceDiagram, row);
65
+ });
66
+ return dataSequenceDiagram;
67
+ }
68
+
69
+ _parseRow(dataSequenceDiagram, row) {
70
+ const trimRow = row.trim();
71
+ if(trimRow.startsWith(MarkupSequenceDiagram.TAG_TITLE)) {
72
+ dataSequenceDiagram.setTitle(trimRow.substr(MarkupSequenceDiagram.TAG_TITLE_LENGTH));
73
+ }
74
+ else if(trimRow.startsWith('Nodes')) {
75
+ const nodeNames = trimRow.slice(trimRow.indexOf('[') + 1, trimRow.indexOf(']')).match(/([^\s,]+)/g);
76
+ if(null !== nodeNames) {
77
+ nodeNames.forEach((nodeName) => {
78
+ dataSequenceDiagram.addNode(new DataSequenceDiagramNode(nodeName));
79
+ });
80
+ }
81
+ }
82
+ else if(trimRow.startsWith('Config')) {
83
+ const start = trimRow.indexOf('(', 0);
84
+ if(-1 === start) {
85
+ return;
86
+ }
87
+ const stop = trimRow.indexOf(')', start + 1);
88
+ const configParameters = trimRow.substring(start + 1, -1 !== stop ? stop : undefined).split(',');
89
+ if(null !== configParameters) {
90
+ const config = {};
91
+ configParameters.forEach((configParameter) => {
92
+ const parameters = configParameter.split(':');
93
+ if(2 === parameters.length) {
94
+ const parameterName = parameters[0].trim();
95
+ const parameterValue = parameters[1].trim();
96
+ const numberValue = Number.parseInt(parameterValue);
97
+ if(!Number.isNaN(numberValue)) {
98
+ dataSequenceDiagram.addConfig(parameterName, numberValue);
99
+ }
100
+ else if('true' === parameterValue) {
101
+ dataSequenceDiagram.addConfig(parameterName, true);
102
+ }
103
+ else if('false' === parameterValue) {
104
+ dataSequenceDiagram.addConfig(parameterName, false);
105
+ }
106
+ else {
107
+ dataSequenceDiagram.addConfig(parameterName, parameterValue);
108
+ }
109
+ }
110
+ });
111
+ }
112
+ }
113
+ else {
114
+ let type = 'unknown';
115
+ let data = '';
116
+ const typeStartIndex = trimRow.indexOf('[');
117
+ const typeStopIndex = trimRow.indexOf(']');
118
+ if(-1 !== typeStartIndex && -1 !== typeStopIndex) {
119
+ let types = trimRow.slice(typeStartIndex + 1, typeStopIndex).match(/([^\s,]+)/g);
120
+ if(types && 1 === types.length) {
121
+ type = types[0];
122
+ }
123
+ }
124
+ let dataIndex = trimRow.indexOf(':');
125
+ if(-1 !== dataIndex) {
126
+ data = trimRow.substring(dataIndex + 1, trimRow.length).trim();
127
+ }
128
+ const messageTypeIndex = this._parseMessageTypeIndex(trimRow);
129
+ if(-1 !== messageTypeIndex) {
130
+ const messageType = this._parseMessageType(trimRow, messageTypeIndex);
131
+ if(2 === messageType.nodes) {
132
+ const from = trimRow.substring(0, messageTypeIndex).trim();
133
+ const to = trimRow.substring(messageTypeIndex + messageType.size, typeStartIndex).trim();
134
+ const fromIndex = this._getNodeIndex(dataSequenceDiagram, from);
135
+ const toIndex = this._getNodeIndex(dataSequenceDiagram, to);
136
+ if(-1 !== fromIndex && -1 !== toIndex) {
137
+ dataSequenceDiagram.addMessage(new DataSequenceDiagramMessage(data, type, messageType.nodes, messageType.type, messageType.height, fromIndex, toIndex));
138
+ }
139
+ }
140
+ else {
141
+ const from = trimRow.substring(0, messageTypeIndex).trim();
142
+ const fromIndex = this._getNodeIndex(dataSequenceDiagram, from);
143
+ if(-1 !== fromIndex) {
144
+ dataSequenceDiagram.addMessage(new DataSequenceDiagramMessage(data, type, messageType.nodes, messageType.type, messageType.height, fromIndex, -1));
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ _getRows(markup) {
152
+ let index = 0;
153
+ let nextIndex = 0;
154
+ const rows = [];
155
+ const length = markup.length;
156
+ while(index < length) {
157
+ nextIndex = markup.indexOf('\n', index);
158
+ if(-1 !== nextIndex) {
159
+ rows.push(markup.substring(index, nextIndex).trim());
160
+ index = nextIndex + 1;
161
+ }
162
+ else {
163
+ rows.push(markup.substring(index, length).trim());
164
+ index = length;
165
+ }
166
+ }
167
+ return rows;
168
+ }
169
+
170
+ _stringifyMessageType(message) {
171
+ if('normal' === message.messageType) {
172
+ return '=>';
173
+ }
174
+ else if('normal-bi-directional' === message.messageType) {
175
+ return '<=>';
176
+ }
177
+ else if('part' === message.messageType) {
178
+ return '->';
179
+ }
180
+ else if('part-bi-directional' === message.messageType) {
181
+ return '<->';
182
+ }
183
+ else if('connect' === message.messageType) {
184
+ return '-o';
185
+ }
186
+ else if('disconnect' === message.messageType) {
187
+ return '-x';
188
+ }
189
+ else if('start' === message.messageType) {
190
+ return '>';
191
+ }
192
+ else if('stop' === message.messageType) {
193
+ return '#';
194
+ }
195
+ else if('pause' === message.messageType) {
196
+ return '||';
197
+ }
198
+ else if('comment' === message.messageType) {
199
+ return '//';
200
+ }
201
+ else if('long-comment' === message.messageType) {
202
+ return '/**/';
203
+ }
204
+ else if('verify' === message.messageType) {
205
+ return '==';
206
+ }
207
+ else if('new' === message.messageType) {
208
+ return '=';
209
+ }
210
+ else if('delete' === message.messageType) {
211
+ return '!';
212
+ }
213
+ else if('browser' === message.messageType) {
214
+ return 'browser';
215
+ }
216
+ else if('page' === message.messageType) {
217
+ return 'page';
218
+ }
219
+ else if('click' === message.messageType) {
220
+ return 'click';
221
+ }
222
+ else if('type' === message.messageType) {
223
+ return 'type';
224
+ }
225
+ }
226
+
227
+ _parseMessageTypeIndex(row) {
228
+ let colonIndex = row.indexOf(':');
229
+ if(-1 !== colonIndex) {
230
+ row = row.substring(0, colonIndex);
231
+ }
232
+ let index = row.indexOf('<=>');
233
+ if(-1 !== index) {
234
+ return index;
235
+ }
236
+ index = row.indexOf('=>');
237
+ if(-1 !== index) {
238
+ return index;
239
+ }
240
+ index = row.indexOf('<->');
241
+ if(-1 !== index) {
242
+ return index;
243
+ }
244
+ index = row.indexOf('->');
245
+ if(-1 !== index) {
246
+ return index;
247
+ }
248
+ index = row.indexOf('-o');
249
+ if(-1 !== index) {
250
+ return index;
251
+ }
252
+ index = row.indexOf('-x');
253
+ if(-1 !== index) {
254
+ return index;
255
+ }
256
+ index = row.indexOf('>');
257
+ if(-1 !== index) {
258
+ return index;
259
+ }
260
+ index = row.indexOf('#');
261
+ if(-1 !== index) {
262
+ return index;
263
+ }
264
+ index = row.indexOf('||');
265
+ if(-1 !== index) {
266
+ return index;
267
+ }
268
+ index = row.indexOf('//');
269
+ if(-1 !== index) {
270
+ return index;
271
+ }
272
+ index = row.indexOf('/**/');
273
+ if(-1 !== index) {
274
+ return index;
275
+ }
276
+ index = row.indexOf('==');
277
+ if(-1 !== index) {
278
+ return index;
279
+ }
280
+ index = row.indexOf('=');
281
+ if(-1 !== index) {
282
+ return index;
283
+ }
284
+ index = row.indexOf('!');
285
+ if(-1 !== index) {
286
+ return index;
287
+ }
288
+ index = row.indexOf('browser');
289
+ if(-1 !== index) {
290
+ return index;
291
+ }
292
+ index = row.indexOf('page');
293
+ if(-1 !== index) {
294
+ return index;
295
+ }
296
+ index = row.indexOf('click');
297
+ if(-1 !== index) {
298
+ return index;
299
+ }
300
+ index = row.indexOf('type');
301
+ if(-1 !== index) {
302
+ return index;
303
+ }
304
+ return -1;
305
+ }
306
+
307
+ _parseMessageType(row, index) {
308
+ if('=>' === row.substr(index, 2)) {
309
+ return {
310
+ type: 'normal',
311
+ size: 2,
312
+ nodes: 2,
313
+ height: 'msg'
314
+ };
315
+ }
316
+ else if('<=>' === row.substr(index, 3)) {
317
+ return {
318
+ type: 'normal-bi-directional',
319
+ size: 3,
320
+ nodes: 2,
321
+ height: 'msg'
322
+ };
323
+ }
324
+ else if('->' === row.substr(index, 2)) {
325
+ return {
326
+ type: 'part',
327
+ size: 2,
328
+ nodes: 2,
329
+ height: 'msg'
330
+ };
331
+ }
332
+ else if('<->' === row.substr(index, 3)) {
333
+ return {
334
+ type: 'part-bi-directional',
335
+ size: 3,
336
+ nodes: 2,
337
+ height: 'msg'
338
+ };
339
+ }
340
+ else if('-o' === row.substr(index, 2)) {
341
+ return {
342
+ type: 'connect',
343
+ size: 2,
344
+ nodes: 2,
345
+ height: 'msg'
346
+ };
347
+ }
348
+ else if('-x' === row.substr(index, 2)) {
349
+ return {
350
+ type: 'disconnect',
351
+ size: 2,
352
+ nodes: 2,
353
+ height: 'msg'
354
+ };
355
+ }
356
+ else if('>' === row.substr(index, 1)) {
357
+ return {
358
+ type: 'start',
359
+ size: 1,
360
+ nodes: 1,
361
+ height: 'event'
362
+ };
363
+ }
364
+ else if('#' === row.substr(index, 1)) {
365
+ return {
366
+ type: 'stop',
367
+ size: 1,
368
+ nodes: 1,
369
+ height: 'event'
370
+ };
371
+ }
372
+ else if('||' === row.substr(index, 2)) {
373
+ return {
374
+ type: 'pause',
375
+ size: 2,
376
+ nodes: 1,
377
+ height: 'event'
378
+ };
379
+ }
380
+ else if('//' === row.substr(index, 2)) {
381
+ return {
382
+ type: 'comment',
383
+ size: 2,
384
+ nodes: 1,
385
+ height: 'event'
386
+ };
387
+ }
388
+ else if('/**/' === row.substr(index, 4)) {
389
+ return {
390
+ type: 'long-comment',
391
+ size: 4,
392
+ nodes: 2,
393
+ height: 'comment'
394
+ };
395
+ }
396
+ else if('==' === row.substr(index, 2)) {
397
+ return {
398
+ type: 'verify',
399
+ size: 2,
400
+ nodes: 1,
401
+ height: 'event'
402
+ };
403
+ }
404
+ else if('=' === row.substr(index, 1)) {
405
+ return {
406
+ type: 'new',
407
+ size: 1,
408
+ nodes: 1,
409
+ height: 'event'
410
+ };
411
+ }
412
+ else if('!' === row.substr(index, 1)) {
413
+ return {
414
+ type: 'delete',
415
+ size: 1,
416
+ nodes: 1,
417
+ height: 'event'
418
+ };
419
+ }
420
+ else if('browser' === row.substr(index, 7)) {
421
+ return {
422
+ type: 'browser',
423
+ size: 2,
424
+ nodes: 1,
425
+ height: 'event'
426
+ };
427
+ }
428
+ else if('page' === row.substr(index, 4)) {
429
+ return {
430
+ type: 'page',
431
+ size: 2,
432
+ nodes: 1,
433
+ height: 'event'
434
+ };
435
+ }
436
+ else if('click' === row.substr(index, 5)) {
437
+ return {
438
+ type: 'click',
439
+ size: 2,
440
+ nodes: 1,
441
+ height: 'event'
442
+ };
443
+ }
444
+ else if('type' === row.substr(index, 4)) {
445
+ return {
446
+ type: 'type',
447
+ size: 2,
448
+ nodes: 1,
449
+ height: 'event'
450
+ };
451
+ }
452
+ return '';
453
+ }
454
+
455
+ _getNodeIndex(dataSequenceDiagram, nodeName) {
456
+ return dataSequenceDiagram.nodes.findIndex((node) => {
457
+ return node.name === nodeName;
458
+ });
459
+ }
460
+ }
461
+
462
+ MarkupSequenceDiagram.TAG_TITLE = 'Title: ';
463
+ MarkupSequenceDiagram.TAG_TITLE_LENGTH = MarkupSequenceDiagram.TAG_TITLE.length;
464
+
465
+
466
+ module.exports = new MarkupSequenceDiagram();
@@ -0,0 +1,29 @@
1
+
2
+ 'use strict';
3
+
4
+ const DataSystemUnderTestInstances = require('../../data/data-system-under-test/data-system-under-test-instances');
5
+ const MarkupTableKeyValue = require('../markup-table-key-value');
6
+ const MarkupTablesParser = require('../markup-tables-parser');
7
+
8
+
9
+ class MarkupSystemUnderTestInstances {
10
+ stringify(dataSystemUnderTestInstances) {
11
+ return `\n${MarkupTableKeyValue.stringify(new DataSystemUnderTestInstances(), dataSystemUnderTestInstances, true)}\n`;
12
+ }
13
+
14
+ parse(markup) {
15
+ const objectTables = MarkupTablesParser.parse(markup);
16
+ if(!objectTables.success) {
17
+ return {
18
+ success: false,
19
+ rows: objectTables.rows
20
+ };
21
+ }
22
+ return {
23
+ success: true,
24
+ instances: MarkupTableKeyValue.parse(DataSystemUnderTestInstances, objectTables.objects)
25
+ };
26
+ }
27
+ }
28
+
29
+ module.exports = new MarkupSystemUnderTestInstances();
@@ -0,0 +1,30 @@
1
+
2
+ 'use strict';
3
+
4
+ const DataSystemUnderTestNodes = require('../../data/data-system-under-test/data-system-under-test-nodes');
5
+ const MarkupTableKeyValue = require('../markup-table-key-value');
6
+ const MarkupTablesParser = require('../markup-tables-parser');
7
+
8
+
9
+ class MarkupSystemUnderTestNodes {
10
+ stringify(dataSystemUnderTestNodes) {
11
+ return `\n${MarkupTableKeyValue.stringify(new DataSystemUnderTestNodes(), dataSystemUnderTestNodes, true)}\n`;
12
+ }
13
+
14
+ parse(markup) {
15
+ const objectTables = MarkupTablesParser.parse(markup);
16
+ if(!objectTables.success) {
17
+ return {
18
+ success: false,
19
+ rows: objectTables.rows
20
+ };
21
+ }
22
+ return {
23
+ success: true,
24
+ nodes: MarkupTableKeyValue.parse(DataSystemUnderTestNodes, objectTables.objects)
25
+ };
26
+ }
27
+ }
28
+
29
+
30
+ module.exports = new MarkupSystemUnderTestNodes();
@@ -0,0 +1,25 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class MarkupTableKeyValueParse {
6
+ parse(dataObject, objectTables) {
7
+ const objectTable = objectTables.find((objectTable) => {
8
+ return dataObject.name.substr(4) === objectTable[0].columns[0];
9
+ });
10
+ const objects = [];
11
+ if(undefined !== objectTable && 2 <= objectTable.length) {
12
+ const parameterNames = objectTable[1].columns;
13
+ for(let i = 2; i < objectTable.length; ++i) {
14
+ const dataObjectInstance = new dataObject(...objectTable[i].columns);
15
+ if(objectTable[i].commentOut && dataObjectInstance.commentOut) {
16
+ dataObjectInstance.commentOut();
17
+ }
18
+ objects.push(dataObjectInstance);
19
+ }
20
+ }
21
+ return objects;
22
+ }
23
+ }
24
+
25
+ module.exports = new MarkupTableKeyValueParse();
@@ -0,0 +1,91 @@
1
+
2
+ 'use strict';
3
+
4
+
5
+ class MarkupTableKeyValueStringify {
6
+ stringify(dataObject, dataValues, stringifyEmptyTables) {
7
+ const markupTableName = dataObject.getName();
8
+ const markupTableHeadings = dataObject.getHeadings();
9
+ const markupTableRows = this._getMarkupTableRows(markupTableHeadings, dataValues);
10
+ if(0 === markupTableRows.length && !stringifyEmptyTables) {
11
+ return '';
12
+ }
13
+ const sizes = this._calculateSizes(markupTableName, markupTableHeadings, markupTableRows);
14
+ return this._generateMarkup(markupTableName, markupTableHeadings, markupTableRows, sizes);
15
+ }
16
+
17
+ _getMarkupTableRows(markupTableHeadings, dataValues) {
18
+ const markupTableRows = [];
19
+ if(undefined !== dataValues) {
20
+ dataValues.forEach((dataValue) => {
21
+ const markupTableRow = {
22
+ row: [],
23
+ commentOut: false
24
+ };
25
+ markupTableRows.push(markupTableRow);
26
+ markupTableHeadings.forEach((key) => {
27
+ markupTableRow.row.push(dataValue[key]);
28
+ });
29
+ markupTableRow.commentOut = dataValue['_commentOut_'];
30
+ });
31
+ }
32
+ return markupTableRows;
33
+ }
34
+
35
+ _calculateSizes(markupTableName, markupTableHeadings, markupTableRows) {
36
+ const sizes = Array(markupTableHeadings.length).fill(0);
37
+ this._calculateSize(sizes, markupTableHeadings, false);
38
+ markupTableRows.forEach((markupTableRow) => {
39
+ this._calculateSize(sizes, markupTableRow.row, markupTableRow.commentOut);
40
+ });
41
+ return sizes;
42
+ }
43
+
44
+ _calculateSize(sizes, array, commentOut) {
45
+ array.forEach((value, index) => {
46
+ if(undefined !== value) {
47
+ if(sizes[index] < value.length) {
48
+ sizes[index] = value.length + (0 === index && commentOut ? 1 : 0);
49
+ }
50
+ }
51
+ });
52
+ }
53
+
54
+ _generateMarkup(markupTableName, markupTableHeadings, markupTableRows, sizes) {
55
+ const totalColumnSize = sizes.length - 1 + sizes.reduce((prev, curr) => prev + curr);
56
+ if(markupTableName.length <= totalColumnSize) {
57
+ markupTableName += ' '.repeat(totalColumnSize - markupTableName.length);
58
+ this._generateMarkupRow(markupTableHeadings, false, sizes);
59
+ markupTableRows.forEach((markupTableRows) => {
60
+ this._generateMarkupRow(markupTableRows.row, markupTableRows.commentOut, sizes);
61
+ });
62
+ markupTableRows.push({
63
+ row: new Array(sizes.length),
64
+ commentOut: false
65
+ });
66
+ const lastMarkupTableRows = markupTableRows[markupTableRows.length - 1];
67
+ this._generateMarkupRow(lastMarkupTableRows.row, lastMarkupTableRows.commentOut, sizes);
68
+ }
69
+ let markup = `|${markupTableName}|\n|${markupTableHeadings.join('|')}|`;
70
+ markupTableRows.forEach((markupTableRows) => {
71
+ markup += `\n${markupTableRows.commentOut ? '#' : ''}|${markupTableRows.row.join('|')}|`;
72
+ });
73
+ return markup;
74
+ }
75
+
76
+ _generateMarkupRow(row, commentOut, sizes) {
77
+ for(let index = 0; index < row.length; ++index) {
78
+ if(undefined !== row[index]) {
79
+ const repeateSize = sizes[index] - row[index].length - (commentOut && 0 === index ? 1 : 0);
80
+ if(repeateSize > 0) {
81
+ row[index] = row[index] + ' '.repeat(sizes[index] - row[index].length - (commentOut && 0 === index ? 1 : 0));
82
+ }
83
+ }
84
+ else {
85
+ row[index] = ' '.repeat(sizes[index]);
86
+ }
87
+ };
88
+ }
89
+ }
90
+
91
+ module.exports = new MarkupTableKeyValueStringify();
@@ -0,0 +1,18 @@
1
+
2
+ 'use strict';
3
+
4
+ const MarkupTableKeyValueStringify = require('./markup-table-key-value-stringify');
5
+ const MarkupTableKeyValueParse = require('./markup-table-key-value-parse');
6
+
7
+
8
+ class MarkupTableKeyValue {
9
+ stringify(dataObject, dataValues, stringifyEmptyTables) {
10
+ return MarkupTableKeyValueStringify.stringify(dataObject, dataValues, stringifyEmptyTables);
11
+ }
12
+
13
+ parse(dataObjects, markup) {
14
+ return MarkupTableKeyValueParse.parse(dataObjects, markup);
15
+ }
16
+ }
17
+
18
+ module.exports = new MarkupTableKeyValue();