38
38
import static org .assertj .core .api .Assertions .tuple ;
39
39
import static org .awaitility .Awaitility .await ;
40
40
import static org .sonarsource .sonarlint .core .rpc .protocol .backend .initialize .BackendCapability .FULL_SYNCHRONIZATION ;
41
+ import static org .sonarsource .sonarlint .core .rpc .protocol .backend .initialize .BackendCapability .SCA_SYNCHRONIZATION ;
41
42
import static org .sonarsource .sonarlint .core .serverconnection .issues .ServerScaIssue .Severity ;
42
43
import static org .sonarsource .sonarlint .core .serverconnection .issues .ServerScaIssue .Status ;
43
44
import static org .sonarsource .sonarlint .core .serverconnection .issues .ServerScaIssue .Type ;
@@ -52,6 +53,7 @@ class ScaIssuesMediumTests {
52
53
@ SonarLintTest
53
54
void it_should_return_no_sca_issues_if_the_scope_does_not_exist (SonarLintTestHarness harness ) {
54
55
var backend = harness .newBackend ()
56
+ .withBackendCapability (SCA_SYNCHRONIZATION )
55
57
.start ();
56
58
57
59
var scaIssues = listAllScaIssues (backend , CONFIG_SCOPE_ID );
@@ -62,6 +64,7 @@ void it_should_return_no_sca_issues_if_the_scope_does_not_exist(SonarLintTestHar
62
64
@ SonarLintTest
63
65
void it_should_return_no_sca_issues_if_the_scope_is_not_bound (SonarLintTestHarness harness ) {
64
66
var backend = harness .newBackend ()
67
+ .withBackendCapability (SCA_SYNCHRONIZATION )
65
68
.withUnboundConfigScope (CONFIG_SCOPE_ID )
66
69
.start ();
67
70
@@ -73,6 +76,7 @@ void it_should_return_no_sca_issues_if_the_scope_is_not_bound(SonarLintTestHarne
73
76
@ SonarLintTest
74
77
void it_should_return_no_sca_issues_if_the_storage_is_empty (SonarLintTestHarness harness ) {
75
78
var backend = harness .newBackend ()
79
+ .withBackendCapability (SCA_SYNCHRONIZATION )
76
80
.withSonarQubeConnection (CONNECTION_ID )
77
81
.withBoundConfigScope (CONFIG_SCOPE_ID , CONNECTION_ID , PROJECT_KEY )
78
82
.start ();
@@ -89,6 +93,7 @@ void it_should_return_the_stored_sca_issues(SonarLintTestHarness harness) {
89
93
.start ();
90
94
var scaIssueKey = UUID .fromString ("550e8400-e29b-41d4-a716-446655440000" );
91
95
var backend = harness .newBackend ()
96
+ .withBackendCapability (SCA_SYNCHRONIZATION )
92
97
.withSonarQubeConnection (CONNECTION_ID , server ,
93
98
storage -> storage .withProject (PROJECT_KEY ,
94
99
project -> project .withMainBranch ("main" ,
@@ -120,6 +125,7 @@ void it_should_refresh_sca_issues_when_requested(SonarLintTestHarness harness) {
120
125
"2.1.0" , List .of ("CONFIRM" )))))
121
126
.start ();
122
127
var backend = harness .newBackend ()
128
+ .withBackendCapability (SCA_SYNCHRONIZATION )
123
129
.withSonarQubeConnection (CONNECTION_ID , server ,
124
130
storage -> storage
125
131
.withGlobalSettings (Map .of ("sonar.sca.enabled" , "true" ))
@@ -153,7 +159,7 @@ void it_should_notify_client_when_new_sca_issues_are_added(SonarLintTestHarness
153
159
harness .newBackend ()
154
160
.withSonarQubeConnection (CONNECTION_ID , server )
155
161
.withBoundConfigScope (CONFIG_SCOPE_ID , CONNECTION_ID , PROJECT_KEY )
156
- .withBackendCapability (FULL_SYNCHRONIZATION )
162
+ .withBackendCapability (FULL_SYNCHRONIZATION , SCA_SYNCHRONIZATION )
157
163
.start (client );
158
164
client .waitForSynchronization ();
159
165
@@ -196,7 +202,7 @@ void it_should_notify_client_when_sca_issues_are_removed(SonarLintTestHarness ha
196
202
.withType (Type .VULNERABILITY )
197
203
.withSeverity (Severity .HIGH )))))
198
204
.withBoundConfigScope (CONFIG_SCOPE_ID , CONNECTION_ID , PROJECT_KEY )
199
- .withBackendCapability (FULL_SYNCHRONIZATION )
205
+ .withBackendCapability (FULL_SYNCHRONIZATION , SCA_SYNCHRONIZATION )
200
206
.start (client );
201
207
client .waitForSynchronization ();
202
208
@@ -235,7 +241,7 @@ void it_should_notify_client_when_sca_issues_are_updated(SonarLintTestHarness ha
235
241
.withStatus (Status .OPEN )
236
242
.withTransitions (List .of (ServerScaIssue .Transition .REOPEN ))))))
237
243
.withBoundConfigScope (CONFIG_SCOPE_ID , CONNECTION_ID , PROJECT_KEY )
238
- .withBackendCapability (FULL_SYNCHRONIZATION )
244
+ .withBackendCapability (FULL_SYNCHRONIZATION , SCA_SYNCHRONIZATION )
239
245
.start (client );
240
246
client .waitForSynchronization ();
241
247
@@ -250,7 +256,8 @@ void it_should_notify_client_when_sca_issues_are_updated(SonarLintTestHarness ha
250
256
.extracting (ScaIssueDto ::getId , ScaIssueDto ::getType , ScaIssueDto ::getSeverity , ScaIssueDto ::getStatus , ScaIssueDto ::getTransitions , ScaIssueDto ::getPackageName ,
251
257
ScaIssueDto ::getPackageVersion )
252
258
.containsExactly (
253
- tuple (scaIssueKey , ScaIssueDto .Type .VULNERABILITY , ScaIssueDto .Severity .LOW , ScaIssueDto .Status .ACCEPT , List .of (ScaIssueDto .Transition .REOPEN ), "com.example.vulnerable" , "2.1.0" ));
259
+ tuple (scaIssueKey , ScaIssueDto .Type .VULNERABILITY , ScaIssueDto .Severity .LOW , ScaIssueDto .Status .ACCEPT , List .of (ScaIssueDto .Transition .REOPEN ), "com.example.vulnerable" ,
260
+ "2.1.0" ));
254
261
});
255
262
}
256
263
0 commit comments