Skip to content

Commit 8af240f

Browse files
Janos Gyerikhenryju
authored andcommitted
Use SonarJS in ITs (fix support of SQ 7.3)
1 parent e02bdb6 commit 8af240f

10 files changed

Lines changed: 24 additions & 40 deletions

File tree

its/it-tests/src/test/java/com/sonar/scanner/api/it/PropertiesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class PropertiesTest {
4141
public void testRuntimeEnvironmentPassedAsUserAgent() throws IOException {
4242
SimpleScanner scanner = new SimpleScanner();
4343
Map<String, String> params = new HashMap<>();
44-
BuildResult buildResult = scanner.executeSimpleProject(project("java-sample"), ORCHESTRATOR.getServer().getUrl(), params);
44+
BuildResult buildResult = scanner.executeSimpleProject(project("js-sample"), ORCHESTRATOR.getServer().getUrl(), params);
4545
assertThat(buildResult.getLastStatus()).isEqualTo(0);
4646

4747
Path accessLogs = ORCHESTRATOR.getServer().getAppLogs().toPath().resolveSibling("access.log");

its/it-tests/src/test/java/com/sonar/scanner/api/it/ProxyTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void simple_analysis_with_proxy_no_auth() throws Exception {
176176
SimpleScanner scanner = new SimpleScanner();
177177

178178
// Don't use proxy
179-
BuildResult buildResult = scanner.executeSimpleProject(project("java-sample"), ORCHESTRATOR.getServer().getUrl());
179+
BuildResult buildResult = scanner.executeSimpleProject(project("js-sample"), ORCHESTRATOR.getServer().getUrl());
180180
assertThat(buildResult.getLastStatus()).isEqualTo(0);
181181
assertThat(seenByProxy).isEmpty();
182182

@@ -186,7 +186,7 @@ public void simple_analysis_with_proxy_no_auth() throws Exception {
186186
params.put("http.proxyHost", "localhost");
187187
params.put("http.proxyPort", "" + httpProxyPort);
188188

189-
buildResult = scanner.executeSimpleProject(project("java-sample"), ORCHESTRATOR.getServer().getUrl(), params);
189+
buildResult = scanner.executeSimpleProject(project("js-sample"), ORCHESTRATOR.getServer().getUrl(), params);
190190
assertThat(buildResult.getLastStatus()).isEqualTo(0);
191191
assertThat(seenByProxy).isNotEmpty();
192192
}
@@ -202,14 +202,14 @@ public void simple_analysis_with_proxy_auth() throws Exception {
202202
params.put("http.proxyHost", "localhost");
203203
params.put("http.proxyPort", "" + httpProxyPort);
204204

205-
BuildResult buildResult = scanner.executeSimpleProject(project("java-sample"), ORCHESTRATOR.getServer().getUrl(), params);
205+
BuildResult buildResult = scanner.executeSimpleProject(project("js-sample"), ORCHESTRATOR.getServer().getUrl(), params);
206206
assertThat(buildResult.getLastStatus()).isEqualTo(1);
207207
assertThat(buildResult.getLogs()).contains("Status returned by url", "is not valid: [407]");
208208
assertThat(seenByProxy).isEmpty();
209209

210210
params.put("http.proxyUser", PROXY_USER);
211211
params.put("http.proxyPassword", PROXY_PASSWORD);
212-
buildResult = scanner.executeSimpleProject(project("java-sample"), ORCHESTRATOR.getServer().getUrl(), params);
212+
buildResult = scanner.executeSimpleProject(project("js-sample"), ORCHESTRATOR.getServer().getUrl(), params);
213213
assertThat(seenByProxy).isNotEmpty();
214214
if (ORCHESTRATOR.getServer().version().isGreaterThanOrEquals("6.1")) {
215215
assertThat(buildResult.getLastStatus()).isEqualTo(0);

its/it-tests/src/test/java/com/sonar/scanner/api/it/SSLTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.sonar.orchestrator.build.BuildResult;
2424
import com.sonar.orchestrator.util.NetworkUtils;
2525
import com.sonar.scanner.api.it.tools.SimpleScanner;
26-
2726
import java.nio.file.Path;
2827
import java.nio.file.Paths;
2928
import java.util.HashMap;
@@ -160,7 +159,7 @@ private static ServletHandler newServletHandler() {
160159
public void simple_analysis_with_server_and_client_certificate() throws Exception {
161160
startSSLTransparentReverseProxy(true);
162161
SimpleScanner scanner = new SimpleScanner();
163-
BuildResult buildResult = scanner.executeSimpleProject(project("java-sample"), "https://localhost:" + httpsPort);
162+
BuildResult buildResult = scanner.executeSimpleProject(project("js-sample"), "https://localhost:" + httpsPort);
164163

165164
assertThat(buildResult.getLastStatus()).isNotEqualTo(0);
166165
assertThat(buildResult.getLogs()).contains("javax.net.ssl.SSLHandshakeException");
@@ -176,7 +175,7 @@ public void simple_analysis_with_server_and_client_certificate() throws Exceptio
176175
params.put("javax.net.ssl.keyStore", clientKeystore.toString());
177176
params.put("javax.net.ssl.keyStorePassword", CLIENT_KEYSTORE_PWD);
178177

179-
buildResult = scanner.executeSimpleProject(project("java-sample"), "https://localhost:" + httpsPort, params);
178+
buildResult = scanner.executeSimpleProject(project("js-sample"), "https://localhost:" + httpsPort, params);
180179
assertThat(buildResult.getLastStatus()).isEqualTo(0);
181180
}
182181

@@ -189,7 +188,7 @@ public void simple_analysis_with_server_certificate() throws Exception {
189188
startSSLTransparentReverseProxy(false);
190189
SimpleScanner scanner = new SimpleScanner();
191190

192-
BuildResult buildResult = scanner.executeSimpleProject(project("java-sample"), "https://localhost:" + httpsPort);
191+
BuildResult buildResult = scanner.executeSimpleProject(project("js-sample"), "https://localhost:" + httpsPort);
193192
assertThat(buildResult.getLastStatus()).isNotEqualTo(0);
194193
assertThat(buildResult.getLogs()).contains("javax.net.ssl.SSLHandshakeException");
195194

@@ -201,7 +200,7 @@ public void simple_analysis_with_server_certificate() throws Exception {
201200
params.put("javax.net.ssl.trustStore", clientTruststore.toString());
202201
params.put("javax.net.ssl.trustStorePassword", truststorePassword);
203202

204-
buildResult = scanner.executeSimpleProject(project("java-sample"), "https://localhost:" + httpsPort, params);
203+
buildResult = scanner.executeSimpleProject(project("js-sample"), "https://localhost:" + httpsPort, params);
205204
assertThat(buildResult.getLastStatus()).isEqualTo(0);
206205
}
207206

its/it-tests/src/test/java/com/sonar/scanner/api/it/ScannerApiTestSuite.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
package com.sonar.scanner.api.it;
2121

2222
import com.sonar.orchestrator.Orchestrator;
23-
import java.io.File;
2423
import org.junit.ClassRule;
2524
import org.junit.runner.RunWith;
2625
import org.junit.runners.Suite;
@@ -32,11 +31,8 @@ public class ScannerApiTestSuite {
3231

3332
@ClassRule
3433
public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
35-
.setOrchestratorProperty("javaVersion", "4.11")
36-
.addPlugin("java")
34+
.setOrchestratorProperty("javascriptVersion", "LATEST_RELEASE")
35+
.addPlugin("javascript")
3736
.build();
3837

39-
static boolean isWindows() {
40-
return File.pathSeparatorChar == ';' || System.getProperty("os.name").startsWith("Windows");
41-
}
4238
}

its/projects/java-sample/sonar-project.properties

Lines changed: 0 additions & 7 deletions
This file was deleted.

its/projects/java-sample/src/basic/Hello.java

Lines changed: 0 additions & 9 deletions
This file was deleted.

its/projects/java-sample/src/basic/World.java

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sonar.projectKey=sample
2+
sonar.projectName=JS Sample, with comma
3+
sonar.projectDescription=This is a JS sample
4+
sonar.projectVersion=1.2.3
5+
6+
sonar.sources=src
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function hello() {
2+
let i=356;
3+
if (true) i=5658;
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function world() {
2+
alert("hello world");
3+
}

0 commit comments

Comments
 (0)