Skip to content

Commit 1752e73

Browse files
author
Dennis Labordus
authored
Merge pull request #97 from com-pas/data-service-websocket
New version and update to support Websocket for Data Service
2 parents a64521e + 9b6cc5f commit 1752e73

File tree

8 files changed

+117
-52
lines changed

8 files changed

+117
-52
lines changed

compas/docker-compose-basex.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ services:
3939
scl-data-service:
4040
labels:
4141
compas: true
42-
image: "lfenergy/compas-scl-data-service:0.11.1-basex"
42+
image: "lfenergy/compas-scl-data-service:0.12.2-basex"
4343
ports:
4444
- "9090:8080"
4545
environment:
@@ -69,7 +69,7 @@ services:
6969
cim-mapping:
7070
labels:
7171
compas: true
72-
image: "lfenergy/compas-cim-mapping:0.9.2"
72+
image: "lfenergy/compas-cim-mapping:0.10.1"
7373
ports:
7474
- "9091:8080"
7575
environment:
@@ -93,7 +93,7 @@ services:
9393
scl-auto-alignment:
9494
labels:
9595
compas: true
96-
image: "lfenergy/compas-scl-auto-alignment:0.3.1"
96+
image: "lfenergy/compas-scl-auto-alignment:0.4.1"
9797
ports:
9898
- "9092:8080"
9999
environment:
@@ -117,7 +117,7 @@ services:
117117
scl-validator:
118118
labels:
119119
compas: true
120-
image: "lfenergy/compas-scl-validator:0.4.4"
120+
image: "lfenergy/compas-scl-validator:0.6.1"
121121
ports:
122122
- "9093:8080"
123123
environment:
@@ -144,7 +144,7 @@ services:
144144
open-scd:
145145
labels:
146146
compas: true
147-
image: "lfenergy/compas-open-scd:v0.25.0.0"
147+
image: "lfenergy/compas-open-scd:v0.26.0.2"
148148
depends_on:
149149
- scl-data-service
150150
- cim-mapping

compas/docker-compose-postgresql.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ services:
4646
scl-data-service:
4747
labels:
4848
compas: true
49-
image: "lfenergy/compas-scl-data-service:0.11.1-postgresql"
49+
image: "lfenergy/compas-scl-data-service:0.12.2-postgresql"
5050
ports:
5151
- "9090:8080"
5252
environment:
@@ -76,7 +76,7 @@ services:
7676
cim-mapping:
7777
labels:
7878
compas: true
79-
image: "lfenergy/compas-cim-mapping:0.9.2"
79+
image: "lfenergy/compas-cim-mapping:0.10.1"
8080
ports:
8181
- "9091:8080"
8282
environment:
@@ -100,7 +100,7 @@ services:
100100
scl-auto-alignment:
101101
labels:
102102
compas: true
103-
image: "lfenergy/compas-scl-auto-alignment:0.3.1"
103+
image: "lfenergy/compas-scl-auto-alignment:0.4.1"
104104
ports:
105105
- "9092:8080"
106106
environment:
@@ -124,7 +124,7 @@ services:
124124
scl-validator:
125125
labels:
126126
compas: true
127-
image: "lfenergy/compas-scl-validator:0.4.4"
127+
image: "lfenergy/compas-scl-validator:0.6.1"
128128
ports:
129129
- "9093:8080"
130130
environment:
@@ -151,7 +151,7 @@ services:
151151
open-scd:
152152
labels:
153153
compas: true
154-
image: "lfenergy/compas-open-scd:v0.25.0.0"
154+
image: "lfenergy/compas-open-scd:v0.26.0.2"
155155
depends_on:
156156
- scl-data-service
157157
- cim-mapping

compas/reverse-proxy/nginx.conf

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ http {
4242
proxy_set_header X-Forwarded-Proto $scheme;
4343
proxy_set_header X-Forwarded-Port $server_port;
4444

45-
# Added Header back to browser to get JWT Content for Debugging, should not do this in production.
46-
add_header X-Debug-Bearer "Bearer ${access_token}" always;
47-
4845
proxy_pass http://open-scd:8080/;
4946

5047
proxy_set_header Host $http_host;
@@ -66,6 +63,24 @@ http {
6663
proxy_redirect off;
6764
}
6865

66+
# Forwarding to the SCL Validator Service container (websockets).
67+
location /compas-scl-data-service/scl-ws/ {
68+
include /etc/nginx/include/authenticate.include;
69+
70+
proxy_http_version 1.1;
71+
proxy_set_header Upgrade $http_upgrade;
72+
proxy_set_header Connection "Upgrade";
73+
proxy_set_header Host $host;
74+
75+
proxy_set_header X-Real-IP $remote_addr;
76+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
77+
proxy_set_header X-Forwarded-Proto $scheme;
78+
proxy_set_header X-Forwarded-Port $server_port;
79+
proxy_set_header Authorization "Bearer ${access_token}";
80+
81+
proxy_pass http://scl-data-service:8080/compas-scl-data-service/scl-ws/;
82+
}
83+
6984
# Forwarding to the SCL Data Service container.
7085
location /compas-scl-data-service/ {
7186
include /etc/nginx/include/authenticate.include;
@@ -76,9 +91,6 @@ http {
7691
proxy_set_header X-Forwarded-Port $server_port;
7792
proxy_set_header Authorization "Bearer ${access_token}";
7893

79-
# Added Header back to browser to get JWT Content for Debugging, should not do this in production.
80-
add_header X-Debug-Bearer "Bearer ${access_token}" always;
81-
8294
proxy_pass http://scl-data-service:8080/compas-scl-data-service/;
8395

8496
proxy_set_header Host $http_host;
@@ -96,9 +108,6 @@ http {
96108
proxy_set_header X-Forwarded-Port $server_port;
97109
proxy_set_header Authorization "Bearer ${access_token}";
98110

99-
# Added Header back to browser to get JWT Content for Debugging, should not do this in production.
100-
add_header X-Debug-Bearer "Bearer ${access_token}" always;
101-
102111
proxy_pass http://cim-mapping:8080/compas-cim-mapping/;
103112

104113
proxy_set_header Host $http_host;
@@ -116,9 +125,6 @@ http {
116125
proxy_set_header X-Forwarded-Port $server_port;
117126
proxy_set_header Authorization "Bearer ${access_token}";
118127

119-
# Added Header back to browser to get JWT Content for Debugging, should not do this in production.
120-
add_header X-Debug-Bearer "Bearer ${access_token}" always;
121-
122128
proxy_pass http://scl-auto-alignment:8080/compas-scl-auto-alignment/;
123129

124130
proxy_set_header Host $http_host;
@@ -141,9 +147,6 @@ http {
141147
proxy_set_header X-Forwarded-Port $server_port;
142148
proxy_set_header Authorization "Bearer ${access_token}";
143149

144-
# Added Header back to browser to get JWT Content for Debugging, should not do this in production.
145-
add_header X-Debug-Bearer "Bearer ${access_token}" always;
146-
147150
proxy_pass http://scl-validator:8080/compas-scl-validator/validate-ws/;
148151
}
149152

@@ -159,9 +162,6 @@ http {
159162
proxy_set_header X-Forwarded-Port $server_port;
160163
proxy_set_header Authorization "Bearer ${access_token}";
161164

162-
# Added Header back to browser to get JWT Content for Debugging, should not do this in production.
163-
add_header X-Debug-Bearer "Bearer ${access_token}" always;
164-
165165
proxy_pass http://scl-validator:8080/compas-scl-validator/;
166166

167167
proxy_cache_bypass $http_upgrade;

integration-testing/TestSuite001-basic-compas.robot

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*** Settings ***
66
Documentation Basic test cases for opening and saving SCL files to/from Local File and CoMPAS.
77
Resource ./include/general-compas.robot
8-
Resource include/general-compas.robot
98

109
Test Setup Initialize and Start OpenSCD
1110
Test Teardown Make screenshot and Stop OpenSCD
@@ -20,7 +19,7 @@ TestCase001-01
2019
Get Text ${substation-editor-selector} section > h1:has-text("Sub1")
2120

2221
TestCase001-02
23-
[Documentation] Open project from Local File and Add to CoMPAS
22+
[Documentation] Open project from Local File and Add to CoMPAS (Rest)
2423
Open Menu Open project
2524
Open local file MiniGrid SCD
2625

@@ -34,7 +33,7 @@ TestCase001-02
3433
Get Text ${substation-editor-selector} section > h1:has-text("Sub1")
3534

3635
TestCase001-03
37-
[Documentation] Open project from CoMPAS
36+
[Documentation] Open project from CoMPAS (Rest)
3837
# First we need to add a project to CoMPAS to be able to open it from CoMPAS.
3938
Open Menu Open project
4039
Open local file MiniGrid SCD
@@ -47,6 +46,7 @@ TestCase001-03
4746

4847
Close OpenSCD
4948
Open OpenSCD and Login
49+
Change Websockets setting False
5050

5151
Open Menu Open project
5252
Open from CoMPAS ${sclname} ${scltype} 1.0.0
@@ -55,7 +55,7 @@ TestCase001-03
5555
Get Text ${substation-editor-selector} section > h1:has-text("Sub1")
5656

5757
TestCase001-04
58-
[Documentation] Open project from CoMPAS and Save to Local File
58+
[Documentation] Open project from CoMPAS (Rest) and Save to Local File
5959
# First we need to add a project to CoMPAS to be able to open it from CoMPAS.
6060
Open Menu Open project
6161
Open local file MiniGrid SCD
@@ -70,7 +70,7 @@ TestCase001-04
7070
Save to local file ${sclname} ${scltype}
7171

7272
TestCase001-05
73-
[Documentation] Save a existing project from CoMPAS as new project
73+
[Documentation] Save a existing project from CoMPAS (Rest) as new project
7474
# First we need to add a project to CoMPAS to be able to open it from CoMPAS.
7575
Open Menu Open project
7676
Open local file MiniGrid SCD
@@ -85,7 +85,7 @@ TestCase001-05
8585
Save as to CoMPAS ${sclname}-${current-date}-1.0.0 ${sclname}-as ${scltype} 1.0.0
8686

8787
TestCase001-06
88-
[Documentation] Save local project as new version to existing project in CoMPAS
88+
[Documentation] Save local project as new version to existing project in CoMPAS (Rest)
8989
# First we need to add a project to CoMPAS to be able to open it from CoMPAS.
9090
Open Menu Open project
9191
Open local file MiniGrid SCD
@@ -102,14 +102,14 @@ TestCase001-06
102102
Open Menu Save as version
103103
Save version to CoMPAS MINOR ${sclname} ${scltype} 1.1.0
104104

105-
TestCase001-10
106-
[Documentation] Trying saving local file to CoMPAS with invalid name
105+
TestCase001-11
106+
[Documentation] Trying saving local file to CoMPAS (Rest) with invalid name
107107
# First we will open the local file to be saved.
108108
Open Menu Open project
109109
Open local file MiniGrid SCD
110110

111111
# Try saving the file with a invalid name
112-
Set Test Variable ${sclname} invalid/*name
112+
Set Test Variable ${sclname} ${TEST NAME}-invalid/*name
113113
Set Test Variable ${scltype} CID
114114

115115
Open Menu Save project
@@ -124,5 +124,69 @@ TestCase001-10
124124
Close Menu
125125

126126
# Check if the expected error message is found
127-
Set Test Variable ${secondaryMessage} ApplicationError: Name is not a correct name to be used later as filename. (CORE-8000) (400)
127+
Set Test Variable ${secondaryMessage} ApplicationError: Name is not a correct name to be used later as filename. (CORE-8000)
128+
Check CoMPAS Error ${secondaryMessage}
129+
130+
TestCase001-51
131+
[Documentation] Open project from Local File and Add to CoMPAS (Websocket)
132+
Change Websockets setting True
133+
Open Menu Open project
134+
Open local file MiniGrid SCD
135+
136+
Set Test Variable ${sclname} ${TEST NAME}
137+
Set Test Variable ${scltype} CID
138+
139+
Open Menu Save project
140+
Add to CoMPAS MiniGrid ${sclname} ${scltype} 1.0.0
141+
142+
Select Tab Substation
143+
Get Text ${substation-editor-selector} section > h1:has-text("Sub1")
144+
145+
TestCase001-52
146+
[Documentation] Open project from CoMPAS (Websocket)
147+
# First we need to add a project to CoMPAS to be able to open it from CoMPAS.
148+
Change Websockets setting True
149+
Open Menu Open project
150+
Open local file MiniGrid SCD
151+
152+
Set Test Variable ${sclname} ${TEST NAME}
153+
Set Test Variable ${scltype} CID
154+
155+
Open Menu Save project
156+
Add to CoMPAS MiniGrid ${sclname} ${scltype} 1.0.0
157+
158+
Close OpenSCD
159+
Open OpenSCD and Login
160+
Change Websockets setting True
161+
162+
Open Menu Open project
163+
Open from CoMPAS ${sclname} ${scltype} 1.0.0
164+
165+
Select Tab Substation
166+
Get Text ${substation-editor-selector} section > h1:has-text("Sub1")
167+
168+
TestCase001-61
169+
[Documentation] Trying saving local file to CoMPAS (Websocket) with invalid name
170+
# First we will open the local file to be saved.
171+
Change Websockets setting True
172+
Open Menu Open project
173+
Open local file MiniGrid SCD
174+
175+
# Try saving the file with a invalid name
176+
Set Test Variable ${sclname} ${TEST NAME}-invalid/*name
177+
Set Test Variable ${scltype} CID
178+
179+
Open Menu Save project
180+
Get Text mwc-dialog#compas-save-dlg > compas-save mwc-textfield#name label > input == MiniGrid
181+
Fill Text mwc-dialog#compas-save-dlg > compas-save mwc-textfield#name label > input ${sclname}
182+
Click mwc-dialog#compas-save-dlg > compas-save compas-scltype-select mwc-select
183+
Click mwc-dialog#compas-save-dlg > compas-save compas-scltype-select mwc-select > mwc-list-item[value="${scltype}"]
184+
Click mwc-dialog#compas-save-dlg > mwc-button[slot="primaryAction"] > button
185+
Wait until executed
186+
Click mwc-dialog#compas-save-dlg > mwc-button[slot="secondaryAction"] > button
187+
Wait for dialog is closed
188+
Close Menu
189+
190+
# Check if the expected error message is found
191+
Set Test Variable ${secondaryMessage} ApplicationError: Name is not a correct name to be used later as filename. (CORE-8000)
128192
Check CoMPAS Error ${secondaryMessage}

integration-testing/TestSuite002-versions-compas.robot

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ TestCase002-30
164164
# Next select the first version from the list and compare this to the current open edited version.
165165
Click ${compas-versions-editor-selector} mwc-list > mwc-check-list-item:nth-child(1) mwc-checkbox
166166
Click ${compas-versions-editor-selector} mwc-fab[label="Compare version (current)"] > button
167-
Get Text ${dialog-selector} div#wizard-content mwc-list > mwc-list-item > span:has-text("Substation")
168-
Click ${dialog-selector} mwc-button[slot="secondaryAction"] > button
167+
# The following part won't work in Presentor Mode (-v enable_presenter_mode:true), because the field is non-interactive.
168+
Get Text mwc-dialog#compareDialog > plain-compare-list mwc-list > mwc-list-item > span:has-text("Substation")
169+
Click mwc-dialog#compareDialog > mwc-button[slot="secondaryAction"] > button
169170
Wait for dialog is closed
170171

171172
TestCase002-31
@@ -200,8 +201,9 @@ TestCase002-32
200201
Click ${compas-versions-editor-selector} mwc-list > mwc-check-list-item:nth-child(1) mwc-checkbox
201202
Click ${compas-versions-editor-selector} mwc-list > mwc-check-list-item:nth-child(2) mwc-checkbox
202203
Click ${compas-versions-editor-selector} mwc-fab[label="Compare versions"] > button
203-
Get Text ${dialog-selector} div#wizard-content mwc-list > mwc-list-item > span:has-text("Substation")
204-
Click ${dialog-selector} mwc-button[slot="secondaryAction"] > button
204+
# The following part won't work in Presentor Mode (-v enable_presenter_mode:true), because the field is non-interactive.
205+
Get Text mwc-dialog#compareDialog > plain-compare-list mwc-list > mwc-list-item > span:has-text("Substation")
206+
Click mwc-dialog#compareDialog > mwc-button[slot="secondaryAction"] > button
205207
Wait for dialog is closed
206208

207209
TestCase002-33

integration-testing/TestSuite005-validator.robot

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ TestCase005-02
3636
Set Test Variable ${sclname} SingleSubstation
3737
Set Test Variable ${scltype} SCD
3838

39-
Change Websockets setting False
40-
Open Menu Open project
41-
Open local file ${sclname} ${scltype}
39+
Open Menu Open project
40+
Open local file ${sclname} ${scltype}
4241

4342
Execute SCL Validator
4443

@@ -67,9 +66,8 @@ TestCase005-04
6766
Set Test Variable ${sclname} XsdValidationErrors
6867
Set Test Variable ${scltype} SCD
6968

70-
Change Websockets setting False
71-
Open Menu Open project
72-
Open local file ${sclname} ${scltype}
69+
Open Menu Open project
70+
Open local file ${sclname} ${scltype}
7371

7472
Execute SCL Validator
7573

integration-testing/include/general-compas.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Resource ./general-config.robot
88
Resource ./general-openscd.robot
99

1010
*** Keywords ***
11+
Initialize and Start OpenSCD
12+
Set global variables
13+
Open OpenSCD and Login
14+
Change Websockets setting False
15+
1116
Open from CoMPAS
1217
[Arguments] ${name} ${type} ${expectedVersion}
1318
Click mwc-dialog#compas-open-dlg > compas-open compas-scltype-list > mwc-list > mwc-list-item >> span:has-text("${type.upper()}")

integration-testing/include/general-openscd.robot

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ ${dialog-selector} wizard-dialog
1313
${substation-editor-selector} substation-editor:first-child > action-pane
1414

1515
*** Keywords ***
16-
Initialize and Start OpenSCD
17-
Set global variables
18-
Open OpenSCD and Login
19-
2016
Make screenshot and Stop OpenSCD
2117
Run Keyword If Test Passed Take Screenshot filename=EMBED fullPage=true
2218
Close OpenSCD

0 commit comments

Comments
 (0)